unsigned short infotype;
};
-u_long aim_getinfo(struct aim_session_t *sess,
- struct aim_conn_t *conn,
- const char *sn,
- unsigned short infotype)
+faim_export unsigned long aim_getinfo(struct aim_session_t *sess,
+ struct aim_conn_t *conn,
+ const char *sn,
+ unsigned short infotype)
{
struct command_tx_struct *newpacket;
int i = 0;
return (sess->snac_nextid++);
}
+faim_internal int aim_parse_locateerr(struct aim_session_t *sess,
+ struct command_rx_struct *command)
+{
+ u_long snacid = 0x000000000;
+ struct aim_snac_t *snac = NULL;
+ int ret = 0;
+ rxcallback_t userfunc = NULL;
+ char *dest;
+ unsigned short reason = 0;
+
+ /*
+ * Get SNAC from packet and look it up
+ * the list of unrepliedto/outstanding
+ * SNACs.
+ *
+ */
+ snacid = aimutil_get32(command->data+6);
+ snac = aim_remsnac(sess, snacid);
+
+ if (!snac) {
+ printf("faim: locerr: got an locate-failed error on an unknown SNAC ID! (%08lx)\n", snacid);
+ dest = NULL;
+ } else
+ dest = snac->data;
+
+ reason = aimutil_get16(command->data+10);
+
+ /*
+ * Call client.
+ */
+ userfunc = aim_callhandler(command->conn, 0x0002, 0x0001);
+ if (userfunc)
+ ret = userfunc(sess, command, dest, reason);
+ else
+ ret = 0;
+
+ if (snac) {
+ free(snac->data);
+ free(snac);
+ }
+
+ return ret;
+}
/*
* Capability blocks.
0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}
};
-u_short aim_getcap(unsigned char *capblock, int buflen)
+faim_internal unsigned short aim_getcap(unsigned char *capblock, int buflen)
{
u_short ret = 0;
int y;
return ret;
}
-int aim_putcap(unsigned char *capblock, int buflen, u_short caps)
+faim_internal int aim_putcap(unsigned char *capblock, int buflen, u_short caps)
{
int offset = 0;
* AIM is fairly regular about providing user info. This
* is a generic routine to extract it in its standard form.
*/
-int aim_extractuserinfo(u_char *buf, struct aim_userinfo_s *outinfo)
+faim_internal int aim_extractuserinfo(u_char *buf, struct aim_userinfo_s *outinfo)
{
int i = 0;
int tlvcnt = 0;
break;
/*
- * Type = 0x0001: Member Class.
+ * Type = 0x0001: User flags
*
* Specified as any of the following bitwise ORed together:
* 0x0001 Trial (user less than 60days)
case 0x0001:
if (tlv1) /* use only the first */
break;
- outinfo->class = aimutil_get16(&buf[i+4]);
+ outinfo->flags = aimutil_get16(&buf[i+4]);
tlv1++;
break;
outinfo->idletime = aimutil_get16(&buf[i+4]);
break;
+ /*
+ * Type = 0x0006: ICQ Online Status
+ *
+ * ICQ's Away/DND/etc "enriched" status
+ * Some decoding of values done by Scott <darkagl@pcnet.com>
+ */
+ case 0x0006:
+ if (aimutil_get16(buf+i+2) != 0x04)
+ break;
+ outinfo->icqinfo.status = aimutil_get16(buf+i+2+2+2);
+ break;
+
/*
* Type = 0x000d
*
* through aim_extractuserinfo() however.
*
*/
-int aim_parse_oncoming_middle(struct aim_session_t *sess,
- struct command_rx_struct *command)
+faim_internal int aim_parse_oncoming_middle(struct aim_session_t *sess,
+ struct command_rx_struct *command)
{
struct aim_userinfo_s userinfo;
u_int i = 0;
* information other than the name it applies to.
*
*/
-int aim_parse_offgoing_middle(struct aim_session_t *sess,
- struct command_rx_struct *command)
+faim_internal int aim_parse_offgoing_middle(struct aim_session_t *sess,
+ struct command_rx_struct *command)
{
char sn[MAXSNLEN+1];
u_int i = 0;
rxcallback_t userfunc=NULL;
- strncpy(sn, command->data+11, (int)command->data[10]);
+ strncpy(sn, (char *)command->data+11, (int)command->data[10]);
sn[(int)command->data[10]] = '\0';
userfunc = aim_callhandler(command->conn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING);
* the higher-level callback (in the user app).
*
*/
-int aim_parse_userinfo_middle(struct aim_session_t *sess,
- struct command_rx_struct *command)
+faim_internal int aim_parse_userinfo_middle(struct aim_session_t *sess,
+ struct command_rx_struct *command)
{
struct aim_userinfo_s userinfo;
char *text_encoding = NULL;
/*
* Inverse of aim_extractuserinfo()
*/
-int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info)
+faim_internal int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info)
{
int i = 0;
struct aim_tlvlist_t *tlvlist = NULL;
/* XXX: we only put down five */
i += aimutil_put16(buf+i, 5);
- aim_addtlvtochain16(&tlvlist, 0x0001, info->class);
+ aim_addtlvtochain16(&tlvlist, 0x0001, info->flags);
aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince);
aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince);
aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime);
/* XXX: should put caps here */
- aim_addtlvtochain32(&tlvlist, (info->class)&AIM_CLASS_AOL?0x0010:0x000f, info->sessionlen);
+ aim_addtlvtochain32(&tlvlist, (unsigned short)((info->flags)&AIM_FLAG_AOL?0x0010:0x000f), info->sessionlen);
i += aim_writetlvchain(buf+i, buflen-i, &tlvlist);
aim_freetlvchain(&tlvlist);
return i;
}
-int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info)
+faim_export int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info)
{
struct command_tx_struct *tx;
int i = 0;
return 0;
}
-int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn)
+faim_export int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn)
{
struct command_tx_struct *tx;
int i = 0;