[JDEV] RE: ICQ gateway broken?

Douglas McLaughlin stricq at owlnet.net
Thu Jul 6 15:54:08 CDT 2000


Hi,

> Please do.  Are they the same format then as standard instant messages?

Ok, here goes...

struct MSG_Common {  /* Common format used by several UDP message types.          */
  char *Nick;        /*   MSG_REQ_AUTH, MSG_ADDED, MSG_WEB_PAGER, MSG_EMAIL_PAGER */
  char *First;
  char *Last;
  char *EMail;
  UBYTE Authorize;
  char *Message;
};

The struct has the elements in the correct order.  Each item is
seperated from the others with 0xFE ASCII character.

#define MSG_MSG          0x0001      /* 0001 Used to send a normal message, same for UDP and TCP  */
#define MSG_CHAT         0x0002      /* 0002 Used to initiate a Chat session */
#define MSG_FILE         0x0003      /* 0003 Used to initiate a FileDirect session */
#define MSG_URL          0x0004      /* 0004 Used to send a URL message, same for UDP and TCP */
#define MSG_REQ_AUTH     0x0006      /* 0006 Used to request authorization to add to contact list */
#define MSG_DENY_AUTH    0x0007      /* 0007 Used to deny authorization to add to contact list */
#define MSG_GIVE_AUTH    0x0008      /* 0008 Used to grant authorization to add to contact list */
#define MSG_ADDED        0x000C      /* 0012 Used to notify that your UIN was added to a contact list */
#define MSG_WEB_PAGER    0x000D      /* 0013 Used to receive a web pager message from the white page */
#define MSG_EMAIL_PAGER  0x000E      /* 0014 Used to receive an EMail message from UIN at pager.mirabilis.com */
#define MSG_ADDUIN       0x0013      /* 0019 Used to send UINs from one client to another */
#define MSG_GREETING     0x001A      /* 0026 Used to send a greeting card */

Here's the code I use to parse the message.  At least it will give you
and better idea of how its put together.

  case MSG_REQ_AUTH:
  case MSG_ADDED:
  case MSG_WEB_PAGER:
  case MSG_EMAIL_PAGER: {
    struct MSG_Common *Common = Data;
    Common->Nick = c = Msg;
    d = strchr(c,'\xFE');
    *d = '\0';
    Common->First = c = d+1;
    d = strchr(c,'\xFE');
    *d = '\0';
    Common->Last = c = d+1;
    d = strchr(c,'\xFE');
    *d = '\0';
    Common->EMail = c = d+1;
    d = strchr(c,'\xFE');
    *d = '\0';
    Common->Authorize = (UBYTE)(*(d+1))&0x0F;
    c = d+1;
    d = strchr(c,'\xFE');
    if (!d) Common->Message = c+1;
    else Common->Message = d+1;
    break;
  }

My full source code is at http://stricq.owlnet.net/Support.html

Its under GPL.  You would be most interested in the icq.c and icq.h
files.

Hope this helps.

-- 

Doug (PGP key available upon request.)




More information about the JDev mailing list