diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2012-10-20 00:38:33 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2012-10-20 00:38:33 +0100 |
commit | 6042a54e827b36770e8989d9a8ba49a66ec6f846 (patch) | |
tree | 80fb3767c863d88f03d20f310762706664a3ef19 | |
parent | 386042c08547bbe7f0b62ad97cdd8488cc13e97e (diff) |
Massive cleanup in OSCAR.
-rw-r--r-- | protocols/oscar/aim.h | 30 | ||||
-rw-r--r-- | protocols/oscar/aim_internal.h | 7 | ||||
-rw-r--r-- | protocols/oscar/buddylist.c | 58 | ||||
-rw-r--r-- | protocols/oscar/buddylist.h | 4 | ||||
-rw-r--r-- | protocols/oscar/chat.c | 71 | ||||
-rw-r--r-- | protocols/oscar/conn.c | 44 | ||||
-rw-r--r-- | protocols/oscar/icq.c | 75 | ||||
-rw-r--r-- | protocols/oscar/icq.h | 1 | ||||
-rw-r--r-- | protocols/oscar/im.c | 586 | ||||
-rw-r--r-- | protocols/oscar/im.h | 17 | ||||
-rw-r--r-- | protocols/oscar/info.c | 180 | ||||
-rw-r--r-- | protocols/oscar/info.h | 2 | ||||
-rw-r--r-- | protocols/oscar/misc.c | 168 | ||||
-rw-r--r-- | protocols/oscar/oscar_util.c | 90 | ||||
-rw-r--r-- | protocols/oscar/rxhandlers.c | 12 | ||||
-rw-r--r-- | protocols/oscar/search.c | 21 | ||||
-rw-r--r-- | protocols/oscar/search.h | 2 | ||||
-rw-r--r-- | protocols/oscar/service.c | 172 | ||||
-rw-r--r-- | protocols/oscar/ssi.c | 241 | ||||
-rw-r--r-- | protocols/oscar/ssi.h | 5 | ||||
-rw-r--r-- | protocols/oscar/tlv.c | 45 |
21 files changed, 0 insertions, 1831 deletions
diff --git a/protocols/oscar/aim.h b/protocols/oscar/aim.h index 5c4c3f77..3f26b392 100644 --- a/protocols/oscar/aim.h +++ b/protocols/oscar/aim.h @@ -409,15 +409,6 @@ typedef struct { #define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080 #define AIM_USERINFO_PRESENT_SESSIONLEN 0x00000100 -const char *aim_userinfo_sn(aim_userinfo_t *ui); -guint16 aim_userinfo_flags(aim_userinfo_t *ui); -guint16 aim_userinfo_idle(aim_userinfo_t *ui); -float aim_userinfo_warnlevel(aim_userinfo_t *ui); -time_t aim_userinfo_membersince(aim_userinfo_t *ui); -time_t aim_userinfo_onlinesince(aim_userinfo_t *ui); -guint32 aim_userinfo_sessionlen(aim_userinfo_t *ui); -int aim_userinfo_hascap(aim_userinfo_t *ui, guint32 cap); - #define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */ #define AIM_FLAG_ADMINISTRATOR 0x0002 #define AIM_FLAG_AOL 0x0004 @@ -473,7 +464,6 @@ int aim_writetlvchain(aim_bstream_t *bs, aim_tlvlist_t **list); int aim_addtlvtochain8(aim_tlvlist_t **list, const guint16 t, const guint8 v); int aim_addtlvtochain16(aim_tlvlist_t **list, const guint16 t, const guint16 v); int aim_addtlvtochain32(aim_tlvlist_t **list, const guint16 type, const guint32 v); -int aim_addtlvtochain_availmsg(aim_tlvlist_t **list, const guint16 type, const char *msg); int aim_addtlvtochain_raw(aim_tlvlist_t **list, const guint16 t, const guint16 l, const guint8 *v); int aim_addtlvtochain_caps(aim_tlvlist_t **list, const guint16 t, const guint32 caps); int aim_addtlvtochain_noval(aim_tlvlist_t **list, const guint16 type); @@ -600,12 +590,7 @@ struct aim_chat_invitation { #define AIM_WARN_ANON 0x01 -int aim_sendpauseack(aim_session_t *sess, aim_conn_t *conn); -int aim_send_warning(aim_session_t *sess, aim_conn_t *conn, const char *destsn, guint32 flags); -int aim_nop(aim_session_t *, aim_conn_t *); int aim_flap_nop(aim_session_t *sess, aim_conn_t *conn); -int aim_bos_setidle(aim_session_t *, aim_conn_t *, guint32); -int aim_bos_setbuddylist(aim_session_t *, aim_conn_t *, const char *); int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, const char *profile, const char *awaymsg, guint32 caps); int aim_bos_setgroupperm(aim_session_t *, aim_conn_t *, guint32 mask); int aim_bos_setprivacyflags(aim_session_t *, aim_conn_t *, guint32); @@ -614,8 +599,6 @@ int aim_reqservice(aim_session_t *, aim_conn_t *, guint16); int aim_bos_reqrights(aim_session_t *, aim_conn_t *); int aim_bos_reqbuddyrights(aim_session_t *, aim_conn_t *); int aim_bos_reqlocaterights(aim_session_t *, aim_conn_t *); -int aim_setdirectoryinfo(aim_session_t *sess, aim_conn_t *conn, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, guint16 privacy); -int aim_setuserinterests(aim_session_t *sess, aim_conn_t *conn, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy); int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, guint32 status); struct aim_fileheader_t *aim_getlisting(aim_session_t *sess, FILE *); @@ -644,8 +627,6 @@ int aim_oft_getfile_end(aim_session_t *sess, aim_conn_t *conn); #define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 #define AIM_SENDMEMBLOCK_FLAG_ISHASH 1 -int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag); - #define AIM_GETINFO_GENERALINFO 0x00001 #define AIM_GETINFO_AWAYMESSAGE 0x00003 #define AIM_GETINFO_CAPABILITIES 0x0004 @@ -671,12 +652,9 @@ int aim_handlerendconnect(aim_session_t *sess, aim_conn_t *cur); #define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000 #define AIM_TRANSFER_DENY_DECLINE 0x0001 #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 -int aim_denytransfer(aim_session_t *sess, const char *sender, const guint8 *cookie, unsigned short code); aim_conn_t *aim_accepttransfer(aim_session_t *sess, aim_conn_t *conn, const char *sn, const guint8 *cookie, const guint8 *ip, guint16 listingfiles, guint16 listingtotsize, guint16 listingsize, guint32 listingchecksum, guint16 rendid); int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, unsigned short); -int aim_sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info); -int aim_sendbuddyoffgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn); #define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED 0x00000001 #define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED 0x00000002 @@ -744,16 +722,12 @@ struct aim_chat_exchangeinfo { int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen); int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance); -int aim_chat_attachname(aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance); -char *aim_chat_getname(aim_conn_t *conn); -aim_conn_t *aim_chat_getconn(aim_session_t *, const char *name); int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn); int aim_chat_invite(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *msg, guint16 exchange, const char *roomname, guint16 instance); int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, guint16 exchange); -int aim_chat_leaveroom(aim_session_t *sess, const char *name); /* aim_util.c */ /* @@ -809,10 +783,6 @@ int aim_chat_leaveroom(aim_session_t *sess, const char *name); (((*((buf)+3)) << 24) & 0xff000000)) -int aimutil_putstr(u_char *, const char *, int); -int aimutil_tokslen(char *toSearch, int index, char dl); -int aimutil_itemcnt(char *toSearch, char dl); -char *aimutil_itemidx(char *toSearch, int index, char dl); int aim_sncmp(const char *a, const char *b); #include <aim_internal.h> diff --git a/protocols/oscar/aim_internal.h b/protocols/oscar/aim_internal.h index 80a9c758..e4cdd0a2 100644 --- a/protocols/oscar/aim_internal.h +++ b/protocols/oscar/aim_internal.h @@ -111,9 +111,6 @@ aim_snac_t *aim_remsnac(aim_session_t *, aim_snacid_t id); void aim_cleansnacs(aim_session_t *, int maxage); int aim_putsnac(aim_bstream_t *, guint16 family, guint16 type, guint16 flags, aim_snacid_t id); -aim_conn_t *aim_cloneconn(aim_session_t *sess, aim_conn_t *src); -void aim_clonehandlers(aim_session_t *sess, aim_conn_t *dest, aim_conn_t *src); - int aim_oft_buildheader(unsigned char *,struct aim_fileheader_t *); int aim_parse_unknown(aim_session_t *, aim_frame_t *, ...); @@ -194,12 +191,9 @@ int aim_freecookie(aim_session_t *sess, aim_msgcookie_t *cookie); int aim_cookie_free(aim_session_t *sess, aim_msgcookie_t *cookie); int aim_extractuserinfo(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *); -int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info); int aim_chat_readroominfo(aim_bstream_t *bs, struct aim_chat_roominfo *outinfo); -int aim_request_directim(aim_session_t *sess, const char *destsn, guint8 *ip, guint16 port, guint8 *ckret); -int aim_request_sendfile(aim_session_t *sess, const char *sn, const char *filename, guint16 numfiles, guint32 totsize, guint8 *ip, guint16 port, guint8 *ckret); void aim_conn_close_rend(aim_session_t *sess, aim_conn_t *conn); void aim_conn_kill_rend(aim_session_t *sess, aim_conn_t *conn); @@ -209,6 +203,5 @@ void aim_conn_kill_chat(aim_session_t *sess, aim_conn_t *conn); int aim_setversions(aim_session_t *sess, aim_conn_t *conn); int aim_reqrates(aim_session_t *, aim_conn_t *); int aim_rates_addparam(aim_session_t *, aim_conn_t *); -int aim_rates_delparam(aim_session_t *, aim_conn_t *); #endif /* __AIM_INTERNAL_H__ */ diff --git a/protocols/oscar/buddylist.c b/protocols/oscar/buddylist.c index a7b461f2..3335c5ab 100644 --- a/protocols/oscar/buddylist.c +++ b/protocols/oscar/buddylist.c @@ -90,61 +90,3 @@ int buddylist_modfirst(aim_session_t *sess, aim_module_t *mod) return 0; } - -/* - * aim_add_buddy() - * - * Adds a single buddy to your buddy list after login. - * - * XXX this should just be an extension of setbuddylist() - * - */ -int aim_add_buddy(aim_session_t *sess, aim_conn_t *conn, const char *sn) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sn || !strlen(sn)) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0003, 0x0004, 0x0000, sn, strlen(sn)+1); - aim_putsnac(&fr->data, 0x0003, 0x0004, 0x0000, snacid); - - aimbs_put8(&fr->data, strlen(sn)); - aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn)); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -/* - * XXX generalise to support removing multiple buddies (basically, its - * the same as setbuddylist() but with a different snac subtype). - * - */ -int aim_remove_buddy(aim_session_t *sess, aim_conn_t *conn, const char *sn) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sn || !strlen(sn)) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0003, 0x0005, 0x0000, sn, strlen(sn)+1); - aim_putsnac(&fr->data, 0x0003, 0x0005, 0x0000, snacid); - - aimbs_put8(&fr->data, strlen(sn)); - aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn)); - - aim_tx_enqueue(sess, fr); - - return 0; -} - diff --git a/protocols/oscar/buddylist.h b/protocols/oscar/buddylist.h index 9a325279..55189581 100644 --- a/protocols/oscar/buddylist.h +++ b/protocols/oscar/buddylist.h @@ -16,8 +16,4 @@ #define AIM_CB_BUD_OFFGOING 0x000c #define AIM_CB_BUD_DEFAULT 0xffff -/* aim_buddylist.c */ -int aim_add_buddy(aim_session_t *, aim_conn_t *, const char *); -int aim_remove_buddy(aim_session_t *, aim_conn_t *, const char *); - #endif /* __OSCAR_BUDDYLIST_H__ */ diff --git a/protocols/oscar/chat.c b/protocols/oscar/chat.c index a5db8fba..d8399563 100644 --- a/protocols/oscar/chat.c +++ b/protocols/oscar/chat.c @@ -27,65 +27,6 @@ void aim_conn_kill_chat(aim_session_t *sess, aim_conn_t *conn) return; } -char *aim_chat_getname(aim_conn_t *conn) -{ - struct chatconnpriv *ccp; - - if (!conn) - return NULL; - - if (conn->type != AIM_CONN_TYPE_CHAT) - return NULL; - - ccp = (struct chatconnpriv *)conn->priv; - - return ccp->name; -} - -/* XXX get this into conn.c -- evil!! */ -aim_conn_t *aim_chat_getconn(aim_session_t *sess, const char *name) -{ - aim_conn_t *cur; - - for (cur = sess->connlist; cur; cur = cur->next) { - struct chatconnpriv *ccp = (struct chatconnpriv *)cur->priv; - - if (cur->type != AIM_CONN_TYPE_CHAT) - continue; - if (!cur->priv) { - imcb_error(sess->aux_data, "chat connection with no name!"); - continue; - } - - if (strcmp(ccp->name, name) == 0) - break; - } - - return cur; -} - -int aim_chat_attachname(aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance) -{ - struct chatconnpriv *ccp; - - if (!conn || !roomname) - return -EINVAL; - - if (conn->priv) - g_free(conn->priv); - - if (!(ccp = g_malloc(sizeof(struct chatconnpriv)))) - return -ENOMEM; - - ccp->exchange = exchange; - ccp->name = g_strdup(roomname); - ccp->instance = instance; - - conn->priv = (void *)ccp; - - return 0; -} - /* * Send a Chat Message. * @@ -253,18 +194,6 @@ int aim_chat_readroominfo(aim_bstream_t *bs, struct aim_chat_roominfo *outinfo) return 0; } -int aim_chat_leaveroom(aim_session_t *sess, const char *name) -{ - aim_conn_t *conn; - - if (!(conn = aim_chat_getconn(sess, name))) - return -ENOENT; - - aim_conn_close(conn); - - return 0; -} - /* * conn must be a BOS connection! */ diff --git a/protocols/oscar/conn.c b/protocols/oscar/conn.c index 77ffd50f..a178761e 100644 --- a/protocols/oscar/conn.c +++ b/protocols/oscar/conn.c @@ -353,50 +353,6 @@ aim_conn_t *aim_getconn_type_all(aim_session_t *sess, int type) } /** - * aim_cloneconn - clone an aim_conn_t - * @sess: session containing parent - * @src: connection to clone - * - * A new connection is allocated, and the values are filled in - * appropriately. Note that this function sets the new connnection's - * ->priv pointer to be equal to that of its parent: only the pointer - * is copied, not the data it points to. - * - * This function returns a pointer to the new aim_conn_t, or %NULL on - * error - */ -aim_conn_t *aim_cloneconn(aim_session_t *sess, aim_conn_t *src) -{ - aim_conn_t *conn; - - if (!(conn = aim_conn_getnext(sess))) - return NULL; - - conn->fd = src->fd; - conn->type = src->type; - conn->subtype = src->subtype; - conn->seqnum = src->seqnum; - conn->priv = src->priv; - conn->internal = src->internal; - conn->lastactivity = src->lastactivity; - conn->forcedlatency = src->forcedlatency; - conn->sessv = src->sessv; - aim_clonehandlers(sess, conn, src); - - if (src->inside) { - /* - * XXX should clone this section as well, but since currently - * this function only gets called for some of that rendezvous - * crap, and not on SNAC connections, its probably okay for - * now. - * - */ - } - - return conn; -} - -/** * aim_newconn - Open a new connection * @sess: Session to create connection in * @type: Type of connection to create diff --git a/protocols/oscar/icq.c b/protocols/oscar/icq.c index c2f8dda6..bd1ba1d1 100644 --- a/protocols/oscar/icq.c +++ b/protocols/oscar/icq.c @@ -70,44 +70,6 @@ int aim_icq_ackofflinemsgs(aim_session_t *sess) return 0; } -int aim_icq_sendxmlreq(aim_session_t *sess, const char *xml) -{ - aim_conn_t *conn; - aim_frame_t *fr; - aim_snacid_t snacid; - int bslen; - - if (!xml || !strlen(xml)) - return -EINVAL; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) - return -EINVAL; - - bslen = 2 + 10 + 2 + strlen(xml) + 1; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); - - /* For simplicity, don't bother using a tlvlist */ - aimbs_put16(&fr->data, 0x0001); - aimbs_put16(&fr->data, bslen); - - aimbs_putle16(&fr->data, bslen - 2); - aimbs_putle32(&fr->data, atoi(sess->sn)); - aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ - aimbs_putle16(&fr->data, snacid); /* eh. */ - aimbs_putle16(&fr->data, 0x0998); /* shrug. */ - aimbs_putle16(&fr->data, strlen(xml) + 1); - aimbs_putraw(&fr->data, (guint8 *)xml, strlen(xml) + 1); - - aim_tx_enqueue(sess, fr); - - return 0; -} - int aim_icq_getallinfo(aim_session_t *sess, const char *uin) { aim_conn_t *conn; @@ -153,43 +115,6 @@ int aim_icq_getallinfo(aim_session_t *sess, const char *uin) return 0; } -int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin) -{ - aim_conn_t *conn; - aim_frame_t *fr; - aim_snacid_t snacid; - int bslen; - - if (!uin || uin[0] < '0' || uin[0] > '9') - return -EINVAL; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) - return -EINVAL; - - bslen = 2 + 4 + 2 + 2 + 2 + 4; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); - - /* For simplicity, don't bother using a tlvlist */ - aimbs_put16(&fr->data, 0x0001); - aimbs_put16(&fr->data, bslen); - - aimbs_putle16(&fr->data, bslen - 2); - aimbs_putle32(&fr->data, atoi(sess->sn)); - aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ - aimbs_putle16(&fr->data, snacid); /* eh. */ - aimbs_putle16(&fr->data, 0x051f); /* shrug. */ - aimbs_putle32(&fr->data, atoi(uin)); - - aim_tx_enqueue(sess, fr); - - return 0; -} - static void aim_icq_freeinfo(struct aim_icq_info *info) { int i; diff --git a/protocols/oscar/icq.h b/protocols/oscar/icq.h index c496f39c..41b3efb9 100644 --- a/protocols/oscar/icq.h +++ b/protocols/oscar/icq.h @@ -93,6 +93,5 @@ struct aim_icq_info { int aim_icq_reqofflinemsgs(aim_session_t *sess); int aim_icq_ackofflinemsgs(aim_session_t *sess); int aim_icq_getallinfo(aim_session_t *sess, const char *uin); -int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin); #endif /* __OSCAR_ICQ_H__ */ diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c index a01a2614..05e06e91 100644 --- a/protocols/oscar/im.c +++ b/protocols/oscar/im.c @@ -23,22 +23,6 @@ #include "im.h" #include "info.h" -/* This should be endian-safe now... but who knows... */ -guint16 aim_iconsum(const guint8 *buf, int buflen) -{ - guint32 sum; - int i; - - for (i = 0, sum = 0; i + 1 < buflen; i += 2) - sum += (buf[i+1] << 8) + buf[i]; - if (i < buflen) - sum += buf[i]; - - sum = ((sum & 0xffff0000) >> 16) + (sum & 0x0000ffff); - - return (guint16)sum; -} - /* * Send an ICBM (instant message). * @@ -305,483 +289,6 @@ int aim_send_im(aim_session_t *sess, const char *destsn, guint16 flags, const ch return aim_send_im_ext(sess, &args); } -/* - * This is also performance sensitive. (If you can believe it...) - * - */ -int aim_send_icon(aim_session_t *sess, const char *sn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum) -{ - aim_conn_t *conn; - int i; - guint8 ck[8]; - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) - return -EINVAL; - - if (!sn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN)) - return -EINVAL; - - for (i = 0; i < 8; i++) - aimutil_put8(ck+i, (guint8) rand()); - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+2+1+strlen(sn)+2+2+2+8+16+2+2+2+2+2+2+2+4+4+4+iconlen+strlen(AIM_ICONIDENT)+2+2))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); - - /* - * Cookie - */ - aimbs_putraw(&fr->data, ck, 8); - - /* - * Channel (2) - */ - aimbs_put16(&fr->data, 0x0002); - - /* - * Dest sn - */ - aimbs_put8(&fr->data, strlen(sn)); - aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn)); - - /* - * TLV t(0005) - * - * Encompasses everything below. - */ - aimbs_put16(&fr->data, 0x0005); - aimbs_put16(&fr->data, 2+8+16+6+4+4+iconlen+4+4+4+strlen(AIM_ICONIDENT)); - - aimbs_put16(&fr->data, 0x0000); - aimbs_putraw(&fr->data, ck, 8); - aim_putcap(&fr->data, AIM_CAPS_BUDDYICON); - - /* TLV t(000a) */ - aimbs_put16(&fr->data, 0x000a); - aimbs_put16(&fr->data, 0x0002); - aimbs_put16(&fr->data, 0x0001); - - /* TLV t(000f) */ - aimbs_put16(&fr->data, 0x000f); - aimbs_put16(&fr->data, 0x0000); - - /* TLV t(2711) */ - aimbs_put16(&fr->data, 0x2711); - aimbs_put16(&fr->data, 4+4+4+iconlen+strlen(AIM_ICONIDENT)); - aimbs_put16(&fr->data, 0x0000); - aimbs_put16(&fr->data, iconsum); - aimbs_put32(&fr->data, iconlen); - aimbs_put32(&fr->data, stamp); - aimbs_putraw(&fr->data, icon, iconlen); - aimbs_putraw(&fr->data, (guint8 *)AIM_ICONIDENT, strlen(AIM_ICONIDENT)); - - /* TLV t(0003) */ - aimbs_put16(&fr->data, 0x0003); - aimbs_put16(&fr->data, 0x0000); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -/* - * This only works for ICQ 2001b (thats 2001 not 2000). Better, only - * send it to clients advertising the RTF capability. In fact, if you send - * it to a client that doesn't support that capability, the server will gladly - * bounce it back to you. - * - * You'd think this would be in icq.c, but, well, I'm trying to stick with - * the one-group-per-file scheme as much as possible. This could easily - * be an exception, since Rendezvous IMs are external of the Oscar core, - * and therefore are undefined. Really I just need to think of a good way to - * make an interface similar to what AOL actually uses. But I'm not using COM. - * - */ -int aim_send_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args) -{ - const char rtfcap[] = {"{97B12751-243C-4334-AD22-D6ABF73F1492}"}; /* AIM_CAPS_ICQRTF capability in string form */ - aim_conn_t *conn; - int i; - guint8 ck[8]; - aim_frame_t *fr; - aim_snacid_t snacid; - int servdatalen; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) - return -EINVAL; - - if (!args || !args->destsn || !args->rtfmsg) - return -EINVAL; - - servdatalen = 2+2+16+2+4+1+2 + 2+2+4+4+4 + 2+4+2+strlen(args->rtfmsg)+1 + 4+4+4+strlen(rtfcap)+1; - - for (i = 0; i < 8; i++) - aimutil_put8(ck+i, (guint8) rand()); - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+128+servdatalen))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); - - /* - * Cookie - */ - aimbs_putraw(&fr->data, ck, 8); - - /* - * Channel (2) - */ - aimbs_put16(&fr->data, 0x0002); - - /* - * Dest sn - */ - aimbs_put8(&fr->data, strlen(args->destsn)); - aimbs_putraw(&fr->data, (guint8 *)args->destsn, strlen(args->destsn)); - - /* - * TLV t(0005) - * - * Encompasses everything below. - */ - aimbs_put16(&fr->data, 0x0005); - aimbs_put16(&fr->data, 2+8+16 + 2+2+2 + 2+2 + 2+2+servdatalen); - - aimbs_put16(&fr->data, 0x0000); - aimbs_putraw(&fr->data, ck, 8); - aim_putcap(&fr->data, AIM_CAPS_ICQSERVERRELAY); - - /* - * t(000a) l(0002) v(0001) - */ - aimbs_put16(&fr->data, 0x000a); - aimbs_put16(&fr->data, 0x0002); - aimbs_put16(&fr->data, 0x0001); - - /* - * t(000f) l(0000) v() - */ - aimbs_put16(&fr->data, 0x000f); - aimbs_put16(&fr->data, 0x0000); - - /* - * Service Data TLV - */ - aimbs_put16(&fr->data, 0x2711); - aimbs_put16(&fr->data, servdatalen); - - aimbs_putle16(&fr->data, 11 + 16 /* 11 + (sizeof CLSID) */); - aimbs_putle16(&fr->data, 9); - aim_putcap(&fr->data, AIM_CAPS_EMPTY); - aimbs_putle16(&fr->data, 0); - aimbs_putle32(&fr->data, 0); - aimbs_putle8(&fr->data, 0); - aimbs_putle16(&fr->data, 0x03ea); /* trid1 */ - - aimbs_putle16(&fr->data, 14); - aimbs_putle16(&fr->data, 0x03eb); /* trid2 */ - aimbs_putle32(&fr->data, 0); - aimbs_putle32(&fr->data, 0); - aimbs_putle32(&fr->data, 0); - - aimbs_putle16(&fr->data, 0x0001); - aimbs_putle32(&fr->data, 0); - aimbs_putle16(&fr->data, strlen(args->rtfmsg)+1); - aimbs_putraw(&fr->data, (guint8 *)args->rtfmsg, strlen(args->rtfmsg)+1); - - aimbs_putle32(&fr->data, args->fgcolor); - aimbs_putle32(&fr->data, args->bgcolor); - aimbs_putle32(&fr->data, strlen(rtfcap)+1); - aimbs_putraw(&fr->data, (guint8 *)rtfcap, strlen(rtfcap)+1); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -int aim_request_directim(aim_session_t *sess, const char *destsn, guint8 *ip, guint16 port, guint8 *ckret) -{ - aim_conn_t *conn; - guint8 ck[8]; - aim_frame_t *fr; - aim_snacid_t snacid; - aim_tlvlist_t *tl = NULL, *itl = NULL; - int hdrlen, i; - guint8 *hdr; - aim_bstream_t hdrbs; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 256+strlen(destsn)))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); - - /* - * Generate a random message cookie - * - * This cookie needs to be alphanumeric and NULL-terminated to be - * TOC-compatible. - * - * XXX have I mentioned these should be generated in msgcookie.c? - * - */ - for (i = 0; i < 7; i++) - ck[i] = 0x30 + ((guint8) rand() % 10); - ck[7] = '\0'; - - if (ckret) - memcpy(ckret, ck, 8); - - /* Cookie */ - aimbs_putraw(&fr->data, ck, 8); - - /* Channel */ - aimbs_put16(&fr->data, 0x0002); - - /* Destination SN */ - aimbs_put8(&fr->data, strlen(destsn)); - aimbs_putraw(&fr->data, (guint8 *)destsn, strlen(destsn)); - - aim_addtlvtochain_noval(&tl, 0x0003); - - hdrlen = 2+8+16+6+8+6+4; - hdr = g_malloc(hdrlen); - aim_bstream_init(&hdrbs, hdr, hdrlen); - - aimbs_put16(&hdrbs, 0x0000); - aimbs_putraw(&hdrbs, ck, 8); - aim_putcap(&hdrbs, AIM_CAPS_IMIMAGE); - - aim_addtlvtochain16(&itl, 0x000a, 0x0001); - aim_addtlvtochain_raw(&itl, 0x0003, 4, ip); - aim_addtlvtochain16(&itl, 0x0005, port); - aim_addtlvtochain_noval(&itl, 0x000f); - - aim_writetlvchain(&hdrbs, &itl); - - aim_addtlvtochain_raw(&tl, 0x0005, aim_bstream_curpos(&hdrbs), hdr); - - aim_writetlvchain(&fr->data, &tl); - - g_free(hdr); - aim_freetlvchain(&itl); - aim_freetlvchain(&tl); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -int aim_request_sendfile(aim_session_t *sess, const char *sn, const char *filename, guint16 numfiles, guint32 totsize, guint8 *ip, guint16 port, guint8 *ckret) -{ - aim_conn_t *conn; - int i; - guint8 ck[8]; - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) - return -EINVAL; - - if (!sn || !filename) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+2+1+strlen(sn)+2+2+2+8+16+6+8+6+4+2+2+2+2+4+strlen(filename)+4))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); - - for (i = 0; i < 7; i++) - aimutil_put8(ck+i, 0x30 + ((guint8) rand() % 10)); - ck[7] = '\0'; - - if (ckret) - memcpy(ckret, ck, 8); - - /* - * Cookie - */ - aimbs_putraw(&fr->data, ck, 8); - - /* - * Channel (2) - */ - aimbs_put16(&fr->data, 0x0002); - - /* - * Dest sn - */ - aimbs_put8(&fr->data, strlen(sn)); - aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn)); - - /* - * TLV t(0005) - * - * Encompasses everything below. Gee. - */ - aimbs_put16(&fr->data, 0x0005); - aimbs_put16(&fr->data, 2+8+16+6+8+6+4+2+2+2+2+4+strlen(filename)+4); - - aimbs_put16(&fr->data, 0x0000); - aimbs_putraw(&fr->data, ck, 8); - aim_putcap(&fr->data, AIM_CAPS_SENDFILE); - - /* TLV t(000a) */ - aimbs_put16(&fr->data, 0x000a); - aimbs_put16(&fr->data, 0x0002); - aimbs_put16(&fr->data, 0x0001); - - /* TLV t(0003) (IP) */ - aimbs_put16(&fr->data, 0x0003); - aimbs_put16(&fr->data, 0x0004); - aimbs_putraw(&fr->data, ip, 4); - - /* TLV t(0005) (port) */ - aimbs_put16(&fr->data, 0x0005); - aimbs_put16(&fr->data, 0x0002); - aimbs_put16(&fr->data, port); - - /* TLV t(000f) */ - aimbs_put16(&fr->data, 0x000f); - aimbs_put16(&fr->data, 0x0000); - - /* TLV t(2711) */ - aimbs_put16(&fr->data, 0x2711); - aimbs_put16(&fr->data, 2+2+4+strlen(filename)+4); - - /* ? */ - aimbs_put16(&fr->data, 0x0001); - aimbs_put16(&fr->data, numfiles); - aimbs_put32(&fr->data, totsize); - aimbs_putraw(&fr->data, (guint8 *)filename, strlen(filename)); - - /* ? */ - aimbs_put32(&fr->data, 0x00000000); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -/** - * Request the status message of the given ICQ user. - * - * @param sess The oscar session. - * @param sn The UIN of the user of whom you wish to request info. - * @param type The type of info you wish to request. This should be the current - * state of the user, as one of the AIM_ICQ_STATE_* defines. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_send_im_ch2_geticqmessage(aim_session_t *sess, const char *sn, int type) -{ - aim_conn_t *conn; - int i; - guint8 ck[8]; - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)) || !sn) - return -EINVAL; - - for (i = 0; i < 8; i++) - aimutil_put8(ck+i, (guint8) rand()); - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+2+1+strlen(sn) + 4+0x5e + 4))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); - - /* Cookie */ - aimbs_putraw(&fr->data, ck, 8); - - /* Channel (2) */ - aimbs_put16(&fr->data, 0x0002); - - /* Dest sn */ - aimbs_put8(&fr->data, strlen(sn)); - aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn)); - - /* TLV t(0005) - Encompasses almost everything below. */ - aimbs_put16(&fr->data, 0x0005); /* T */ - aimbs_put16(&fr->data, 0x005e); /* L */ - { /* V */ - aimbs_put16(&fr->data, 0x0000); - - /* Cookie */ - aimbs_putraw(&fr->data, ck, 8); - - /* Put the 16 byte server relay capability */ - aim_putcap(&fr->data, AIM_CAPS_ICQSERVERRELAY); - - /* TLV t(000a) */ - aimbs_put16(&fr->data, 0x000a); - aimbs_put16(&fr->data, 0x0002); - aimbs_put16(&fr->data, 0x0001); - - /* TLV t(000f) */ - aimbs_put16(&fr->data, 0x000f); - aimbs_put16(&fr->data, 0x0000); - - /* TLV t(2711) */ - aimbs_put16(&fr->data, 0x2711); - aimbs_put16(&fr->data, 0x0036); - { /* V */ - aimbs_putle16(&fr->data, 0x001b); /* L */ - aimbs_putle16(&fr->data, 0x0008); /* AAA - Protocol version */ - aimbs_putle32(&fr->data, 0x00000000); /* Unknown */ - aimbs_putle32(&fr->data, 0x00000000); /* Unknown */ - aimbs_putle32(&fr->data, 0x00000000); /* Unknown */ - aimbs_putle32(&fr->data, 0x00000000); /* Unknown */ - aimbs_putle16(&fr->data, 0x0000); /* Unknown */ - aimbs_putle16(&fr->data, 0x0003); /* Client features? */ - aimbs_putle16(&fr->data, 0x0000); /* Unknown */ - aimbs_putle8(&fr->data, 0x00); /* Unkizown */ - aimbs_putle16(&fr->data, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */ - - aimbs_putle16(&fr->data, 0x000e); /* L */ - aimbs_putle16(&fr->data, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */ - aimbs_putle32(&fr->data, 0x00000000); /* Unknown */ - aimbs_putle32(&fr->data, 0x00000000); /* Unknown */ - aimbs_putle32(&fr->data, 0x00000000); /* Unknown */ - - /* The type of status message being requested */ - if (type & AIM_ICQ_STATE_CHAT) - aimbs_putle16(&fr->data, 0x03ec); - else if(type & AIM_ICQ_STATE_DND) - aimbs_putle16(&fr->data, 0x03eb); - else if(type & AIM_ICQ_STATE_OUT) - aimbs_putle16(&fr->data, 0x03ea); - else if(type & AIM_ICQ_STATE_BUSY) - aimbs_putle16(&fr->data, 0x03e9); - else if(type & AIM_ICQ_STATE_AWAY) - aimbs_putle16(&fr->data, 0x03e8); - - aimbs_putle16(&fr->data, 0x0000); /* Status? */ - aimbs_putle16(&fr->data, 0x0001); /* Priority of this message? */ - aimbs_putle16(&fr->data, 0x0001); /* L? */ - aimbs_putle8(&fr->data, 0x00); /* Null termination? */ - } /* End TLV t(2711) */ - } /* End TLV t(0005) */ - - /* TLV t(0003) */ - aimbs_put16(&fr->data, 0x0003); - aimbs_put16(&fr->data, 0x0000); - - aim_tx_enqueue(sess, fr); - - return 0; -} - /** * answers status message requests * @param sess the oscar session @@ -991,61 +498,6 @@ static int mpmsg_addsection(aim_session_t *sess, aim_mpmsg_t *mpm, guint16 chars return 0; } -int aim_mpmsg_addraw(aim_session_t *sess, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const guint8 *data, guint16 datalen) -{ - guint8 *dup; - - if (!(dup = g_malloc(datalen))) - return -1; - memcpy(dup, data, datalen); - - if (mpmsg_addsection(sess, mpm, charset, charsubset, dup, datalen) == -1) { - g_free(dup); - return -1; - } - - return 0; -} - -/* XXX should provide a way of saying ISO-8859-1 specifically */ -int aim_mpmsg_addascii(aim_session_t *sess, aim_mpmsg_t *mpm, const char *ascii) -{ - char *dup; - - if (!(dup = g_strdup(ascii))) - return -1; - - if (mpmsg_addsection(sess, mpm, 0x0000, 0x0000, (guint8 *)dup, (guint16) strlen(ascii)) == -1) { - g_free(dup); - return -1; - } - - return 0; -} - -int aim_mpmsg_addunicode(aim_session_t *sess, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen) -{ - guint8 *buf; - aim_bstream_t bs; - int i; - - if (!(buf = g_malloc(unicodelen * 2))) - return -1; - - aim_bstream_init(&bs, buf, unicodelen * 2); - - /* We assume unicode is in /host/ byte order -- convert to network */ - for (i = 0; i < unicodelen; i++) - aimbs_put16(&bs, unicode[i]); - - if (mpmsg_addsection(sess, mpm, 0x0002, 0x0000, buf, aim_bstream_curpos(&bs)) == -1) { - g_free(buf); - return -1; - } - - return 0; -} - void aim_mpmsg_free(aim_session_t *sess, aim_mpmsg_t *mpm) { aim_mpmsg_section_t *cur; @@ -1729,44 +1181,6 @@ static int incomingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a } /* - * Possible codes: - * AIM_TRANSFER_DENY_NOTSUPPORTED -- "client does not support" - * AIM_TRANSFER_DENY_DECLINE -- "client has declined transfer" - * AIM_TRANSFER_DENY_NOTACCEPTING -- "client is not accepting transfers" - * - */ -int aim_denytransfer(aim_session_t *sess, const char *sender, const guint8 *cookie, guint16 code) -{ - aim_conn_t *conn; - aim_frame_t *fr; - aim_snacid_t snacid; - aim_tlvlist_t *tl = NULL; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+2+1+strlen(sender)+6))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0004, 0x000b, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0004, 0x000b, 0x0000, snacid); - - aimbs_putraw(&fr->data, cookie, 8); - - aimbs_put16(&fr->data, 0x0002); /* channel */ - aimbs_put8(&fr->data, strlen(sender)); - aimbs_putraw(&fr->data, (guint8 *)sender, strlen(sender)); - - aim_addtlvtochain16(&tl, 0x0003, code); - aim_writetlvchain(&fr->data, &tl); - aim_freetlvchain(&tl); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -/* * aim_reqicbmparaminfo() * * Request ICBM parameter information. diff --git a/protocols/oscar/im.h b/protocols/oscar/im.h index 42a8a6b1..34d5e238 100644 --- a/protocols/oscar/im.h +++ b/protocols/oscar/im.h @@ -46,9 +46,6 @@ typedef struct aim_mpmsg_s { } aim_mpmsg_t; int aim_mpmsg_init(aim_session_t *sess, aim_mpmsg_t *mpm); -int aim_mpmsg_addraw(aim_session_t *sess, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const guint8 *data, guint16 datalen); -int aim_mpmsg_addascii(aim_session_t *sess, aim_mpmsg_t *mpm, const char *ascii); -int aim_mpmsg_addunicode(aim_session_t *sess, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen); void aim_mpmsg_free(aim_session_t *sess, aim_mpmsg_t *mpm); /* @@ -85,16 +82,6 @@ struct aim_sendimext_args { }; /* - * Arguments to aim_send_rtfmsg(). - */ -struct aim_sendrtfmsg_args { - const char *destsn; - guint32 fgcolor; - guint32 bgcolor; - const char *rtfmsg; /* must be in RTF */ -}; - -/* * This information is provided in the Incoming ICBM callback for * Channel 1 ICBM's. * @@ -182,18 +169,14 @@ struct aim_incomingim_ch4_args { char *msg; /* Reason for auth request, deny, or accept */ }; -int aim_send_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args); int aim_send_im_ext(aim_session_t *sess, struct aim_sendimext_args *args); int aim_send_im(aim_session_t *, const char *destsn, unsigned short flags, const char *msg); -int aim_send_icon(aim_session_t *sess, const char *sn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum); -guint16 aim_iconsum(const guint8 *buf, int buflen); int aim_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing); int aim_send_im_direct(aim_session_t *, aim_conn_t *, const char *msg, int len); const char *aim_directim_getsn(aim_conn_t *conn); aim_conn_t *aim_directim_initiate(aim_session_t *, const char *destsn); aim_conn_t *aim_directim_connect(aim_session_t *, const char *sn, const char *addr, const guint8 *cookie); -int aim_send_im_ch2_geticqmessage(aim_session_t *sess, const char *sn, int type); int aim_im_sendmtn(aim_session_t *sess, guint16 type1, const char *sn, guint16 type2); int aim_send_im_ch2_statusmessage(aim_session_t *sess, const char *sender, const guint8 *cookie, const char *message, const guint8 state, const guint16 dc); diff --git a/protocols/oscar/info.c b/protocols/oscar/info.c index 7cc1dbbc..a5a65147 100644 --- a/protocols/oscar/info.c +++ b/protocols/oscar/info.c @@ -40,79 +40,6 @@ int aim_getinfo(aim_session_t *sess, aim_conn_t *conn, const char *sn, guint16 i return 0; } -const char *aim_userinfo_sn(aim_userinfo_t *ui) -{ - - if (!ui) - return NULL; - - return ui->sn; -} - -guint16 aim_userinfo_flags(aim_userinfo_t *ui) -{ - - if (!ui) - return 0; - - return ui->flags; -} - -guint16 aim_userinfo_idle(aim_userinfo_t *ui) -{ - - if (!ui) - return 0; - - return ui->idletime; -} - -float aim_userinfo_warnlevel(aim_userinfo_t *ui) -{ - - if (!ui) - return 0.00; - - return (ui->warnlevel / 10); -} - -time_t aim_userinfo_membersince(aim_userinfo_t *ui) -{ - - if (!ui) - return 0; - - return (time_t)ui->membersince; -} - -time_t aim_userinfo_onlinesince(aim_userinfo_t *ui) -{ - - if (!ui) - return 0; - - return (time_t)ui->onlinesince; -} - -guint32 aim_userinfo_sessionlen(aim_userinfo_t *ui) -{ - - if (!ui) - return 0; - - return ui->sessionlen; -} - -int aim_userinfo_hascap(aim_userinfo_t *ui, guint32 cap) -{ - - if (!ui || !(ui->present & AIM_USERINFO_PRESENT_CAPABILITIES)) - return -1; - - return !!(ui->capabilities & cap); -} - - /* * Capability blocks. * @@ -486,113 +413,6 @@ int aim_extractuserinfo(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t * } /* - * Inverse of aim_extractuserinfo() - */ -int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info) -{ - aim_tlvlist_t *tlvlist = NULL; - - if (!bs || !info) - return -EINVAL; - - aimbs_put8(bs, strlen(info->sn)); - aimbs_putraw(bs, (guint8 *)info->sn, strlen(info->sn)); - - aimbs_put16(bs, info->warnlevel); - - - aim_addtlvtochain16(&tlvlist, 0x0001, info->flags); - aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince); - aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince); - aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime); - -#if ICQ_OSCAR_SUPPORT - if (atoi(info->sn) != 0) { - aim_addtlvtochain16(&tlvlist, 0x0006, info->icqinfo.status); - aim_addtlvtochain32(&tlvlist, 0x000a, info->icqinfo.ipaddr); - } -#endif - - aim_addtlvtochain_caps(&tlvlist, 0x000d, info->capabilities); - - aim_addtlvtochain32(&tlvlist, (guint16)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen); - - aimbs_put16(bs, aim_counttlvchain(&tlvlist)); - aim_writetlvchain(bs, &tlvlist); - aim_freetlvchain(&tlvlist); - - return 0; -} - -int aim_sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !conn || !info) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0003, 0x000b, 0x0000, NULL, 0); - - aim_putsnac(&fr->data, 0x0003, 0x000b, 0x0000, snacid); - aim_putuserinfo(&fr->data, info); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -int aim_sendbuddyoffgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !conn || !sn) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0003, 0x000c, 0x0000, NULL, 0); - - aim_putsnac(&fr->data, 0x0003, 0x000c, 0x0000, snacid); - aimbs_put8(&fr->data, strlen(sn)); - aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn)); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -/* - * Huh? What is this? - */ -int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !conn || !sn) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0002, 0x000b, 0x0000, NULL, 0); - - aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid); - aimbs_put8(&fr->data, strlen(sn)); - aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn)); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -/* * Normally contains: * t(0001) - short containing max profile length (value = 1024) * t(0002) - short - unknown (value = 16) [max MIME type length?] diff --git a/protocols/oscar/info.h b/protocols/oscar/info.h index b4d99e9f..5651f187 100644 --- a/protocols/oscar/info.h +++ b/protocols/oscar/info.h @@ -39,6 +39,4 @@ #define AIM_CAPS_EXTCHAN2 0x00100000 #define AIM_CAPS_LAST 0x00200000 -int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn); - #endif /* __OSCAR_INFO_H__ */ diff --git a/protocols/oscar/misc.c b/protocols/oscar/misc.c index 58fb6c31..950cd852 100644 --- a/protocols/oscar/misc.c +++ b/protocols/oscar/misc.c @@ -13,56 +13,6 @@ #include <aim.h> -/* - * aim_bos_setbuddylist(buddylist) - * - * This just builds the "set buddy list" command then queues it. - * - * buddy_list = "Screen Name One&ScreenNameTwo&"; - * - * TODO: Clean this up. - * - * XXX: I can't stress the TODO enough. - * - */ -int aim_bos_setbuddylist(aim_session_t *sess, aim_conn_t *conn, const char *buddy_list) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - int len = 0; - char *localcpy = NULL; - char *tmpptr = NULL; - - if (!buddy_list || !(localcpy = g_strdup(buddy_list))) - return -EINVAL; - - for (tmpptr = strtok(localcpy, "&"); tmpptr; ) { - len += 1 + strlen(tmpptr); - tmpptr = strtok(NULL, "&"); - } - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+len))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0003, 0x0004, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0003, 0x0004, 0x0000, snacid); - - strncpy(localcpy, buddy_list, strlen(buddy_list) + 1); - - for (tmpptr = strtok(localcpy, "&"); tmpptr; ) { - - aimbs_put8(&fr->data, strlen(tmpptr)); - aimbs_putraw(&fr->data, (guint8 *)tmpptr, strlen(tmpptr)); - tmpptr = strtok(NULL, "&"); - } - - aim_tx_enqueue(sess, fr); - - g_free(localcpy); - - return 0; -} - /* * aim_bos_setprofile(profile) * @@ -126,40 +76,6 @@ int aim_bos_reqbuddyrights(aim_session_t *sess, aim_conn_t *conn) } /* - * Send a warning to destsn. - * - * Flags: - * AIM_WARN_ANON Send as an anonymous (doesn't count as much) - * - * returns -1 on error (couldn't alloc packet), 0 on success. - * - */ -int aim_send_warning(aim_session_t *sess, aim_conn_t *conn, const char *destsn, guint32 flags) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - guint16 outflags = 0x0000; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, strlen(destsn)+13))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0004, 0x0008, 0x0000, destsn, strlen(destsn)+1); - - aim_putsnac(&fr->data, 0x0004, 0x0008, 0x0000, snacid); - - if (flags & AIM_WARN_ANON) - outflags |= 0x0001; - - aimbs_put16(&fr->data, outflags); - aimbs_put8(&fr->data, strlen(destsn)); - aimbs_putraw(&fr->data, (guint8 *)destsn, strlen(destsn)); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -/* * Generic routine for sending commands. * * @@ -255,90 +171,6 @@ int aim_bos_reqlocaterights(aim_session_t *sess, aim_conn_t *conn) return aim_genericreq_n(sess, conn, 0x0002, 0x0002); } -/* - * Set directory profile data (not the same as aim_bos_setprofile!) - * - * privacy: 1 to allow searching, 0 to disallow. - */ -int aim_setdirectoryinfo(aim_session_t *sess, aim_conn_t *conn, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, guint16 privacy) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - aim_tlvlist_t *tl = NULL; - - - aim_addtlvtochain16(&tl, 0x000a, privacy); - - if (first) - aim_addtlvtochain_raw(&tl, 0x0001, strlen(first), (guint8 *)first); - if (last) - aim_addtlvtochain_raw(&tl, 0x0002, strlen(last), (guint8 *)last); - if (middle) - aim_addtlvtochain_raw(&tl, 0x0003, strlen(middle), (guint8 *)middle); - if (maiden) - aim_addtlvtochain_raw(&tl, 0x0004, strlen(maiden), (guint8 *)maiden); - - if (state) - aim_addtlvtochain_raw(&tl, 0x0007, strlen(state), (guint8 *)state); - if (city) - aim_addtlvtochain_raw(&tl, 0x0008, strlen(city), (guint8 *)city); - - if (nickname) - aim_addtlvtochain_raw(&tl, 0x000c, strlen(nickname), (guint8 *)nickname); - if (zip) - aim_addtlvtochain_raw(&tl, 0x000d, strlen(zip), (guint8 *)zip); - - if (street) - aim_addtlvtochain_raw(&tl, 0x0021, strlen(street), (guint8 *)street); - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0002, 0x0009, 0x0000, NULL, 0); - - aim_putsnac(&fr->data, 0x0002, 0x0009, 0x0000, snacid); - aim_writetlvchain(&fr->data, &tl); - aim_freetlvchain(&tl); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -/* XXX pass these in better */ -int aim_setuserinterests(aim_session_t *sess, aim_conn_t *conn, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy) -{ - aim_frame_t *fr; - aim_tlvlist_t *tl = NULL; - - /* ?? privacy ?? */ - aim_addtlvtochain16(&tl, 0x000a, privacy); - - if (interest1) - aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest1), (guint8 *)interest1); - if (interest2) - aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest2), (guint8 *)interest2); - if (interest3) - aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest3), (guint8 *)interest3); - if (interest4) - aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest4), (guint8 *)interest4); - if (interest5) - aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest5), (guint8 *)interest5); - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) - return -ENOMEM; - - aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0); - - aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0); - aim_writetlvchain(&fr->data, &tl); - aim_freetlvchain(&tl); - - aim_tx_enqueue(sess, fr); - - return 0; -} - /* * Should be generic enough to handle the errors for all groups. * diff --git a/protocols/oscar/oscar_util.c b/protocols/oscar/oscar_util.c index 0ce06bd9..7d41d383 100644 --- a/protocols/oscar/oscar_util.c +++ b/protocols/oscar/oscar_util.c @@ -1,96 +1,6 @@ #include <aim.h> #include <ctype.h> -int aimutil_putstr(u_char *dest, const char *src, int len) -{ - memcpy(dest, src, len); - return len; -} - -/* - * Tokenizing functions. Used to portably replace strtok/sep. - * -- DMP. - * - */ -int aimutil_tokslen(char *toSearch, int index, char dl) -{ - int curCount = 1; - char *next; - char *last; - int toReturn; - - last = toSearch; - next = strchr(toSearch, dl); - - while(curCount < index && next != NULL) { - curCount++; - last = next + 1; - next = strchr(last, dl); - } - - if ((curCount < index) || (next == NULL)) - toReturn = strlen(toSearch) - (curCount - 1); - else - toReturn = next - toSearch - (curCount - 1); - - return toReturn; -} - -int aimutil_itemcnt(char *toSearch, char dl) -{ - int curCount; - char *next; - - curCount = 1; - - next = strchr(toSearch, dl); - - while(next != NULL) { - curCount++; - next = strchr(next + 1, dl); - } - - return curCount; -} - -char *aimutil_itemidx(char *toSearch, int index, char dl) -{ - int curCount; - char *next; - char *last; - char *toReturn; - - curCount = 0; - - last = toSearch; - next = strchr(toSearch, dl); - - while (curCount < index && next != NULL) { - curCount++; - last = next + 1; - next = strchr(last, dl); - } - - if (curCount < index) { - toReturn = g_strdup(""); - } - next = strchr(last, dl); - - if (curCount < index) { - toReturn = g_strdup(""); - } else { - if (next == NULL) { - toReturn = g_malloc((strlen(last) + 1) * sizeof(char)); - strcpy(toReturn, last); - } else { - toReturn = g_malloc((next - last + 1) * sizeof(char)); - memcpy(toReturn, last, (next - last)); - toReturn[next - last] = '\0'; - } - } - return toReturn; -} - /* * int snlen(const char *) * diff --git a/protocols/oscar/rxhandlers.c b/protocols/oscar/rxhandlers.c index 7014e693..bd071505 100644 --- a/protocols/oscar/rxhandlers.c +++ b/protocols/oscar/rxhandlers.c @@ -285,18 +285,6 @@ aim_rxcallback_t aim_callhandler(aim_session_t *sess, aim_conn_t *conn, guint16 return aim_callhandler(sess, conn, family, AIM_CB_SPECIAL_DEFAULT); } -void aim_clonehandlers(aim_session_t *sess, aim_conn_t *dest, aim_conn_t *src) -{ - struct aim_rxcblist_s *cur; - - for (cur = (struct aim_rxcblist_s *)src->handlerlist; cur; cur = cur->next) { - aim_conn_addhandler(sess, dest, cur->family, cur->type, - cur->handler, cur->flags); - } - - return; -} - static int aim_callhandler_noparam(aim_session_t *sess, aim_conn_t *conn,guint16 family, guint16 type, aim_frame_t *ptr) { aim_rxcallback_t userfunc; diff --git a/protocols/oscar/search.c b/protocols/oscar/search.c index 3570e4df..4e0d3858 100644 --- a/protocols/oscar/search.c +++ b/protocols/oscar/search.c @@ -8,27 +8,6 @@ #include <aim.h> -int aim_usersearch_address(aim_session_t *sess, aim_conn_t *conn, const char *address) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !conn || !address) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+strlen(address)))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x000a, 0x0002, 0x0000, g_strdup(address), strlen(address)+1); - aim_putsnac(&fr->data, 0x000a, 0x0002, 0x0000, snacid); - - aimbs_putraw(&fr->data, (guint8 *)address, strlen(address)); - - aim_tx_enqueue(sess, fr); - - return 0; -} - /* XXX can this be integrated with the rest of the error handling? */ static int error(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { diff --git a/protocols/oscar/search.h b/protocols/oscar/search.h index 77eeb265..d5cf9b4d 100644 --- a/protocols/oscar/search.h +++ b/protocols/oscar/search.h @@ -1,6 +1,4 @@ #ifndef __OSCAR_SEARCH_H__ #define __OSCAR_SEARCH_H__ -int aim_usersearch_address(aim_session_t *, aim_conn_t *, const char *); - #endif /* __OSCAR_SEARCH_H__ */ diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c index a2678764..a3b37c33 100644 --- a/protocols/oscar/service.c +++ b/protocols/oscar/service.c @@ -360,28 +360,6 @@ int aim_rates_addparam(aim_session_t *sess, aim_conn_t *conn) return 0; } -/* Delete Rate Parameter (group 1, type 9) */ -int aim_rates_delparam(aim_session_t *sess, aim_conn_t *conn) -{ - aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; - aim_frame_t *fr; - aim_snacid_t snacid; - struct rateclass *rc; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0001, 0x0009, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0001, 0x0009, 0x0000, snacid); - - for (rc = ins->rates; rc; rc = rc->next) - aimbs_put16(&fr->data, rc->classid); - - aim_tx_enqueue(sess, fr); - - return 0; -} - /* Rate Change (group 1, type 0x0a) */ static int ratechange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { @@ -430,43 +408,6 @@ static int serverpause(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, return 0; } -/* - * Service Pause Acknowledgement (group 1, type 0x0c) - * - * It is rather important that aim_sendpauseack() gets called for the exact - * same connection that the Server Pause callback was called for, since - * libfaim extracts the data for the SNAC from the connection structure. - * - * Of course, if you don't do that, more bad things happen than just what - * libfaim can cause. - * - */ -int aim_sendpauseack(aim_session_t *sess, aim_conn_t *conn) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; - struct snacgroup *sg; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1024))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0001, 0x000c, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0001, 0x000c, 0x0000, snacid); - - /* - * This list should have all the groups that the original - * Host Online / Server Ready said this host supports. And - * we want them all back after the migration. - */ - for (sg = ins->groups; sg; sg = sg->next) - aimbs_put16(&fr->data, sg->group); - - aim_tx_enqueue(sess, fr); - - return 0; -} - /* Service Resume (group 1, type 0x0d) */ static int serverresume(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { @@ -519,20 +460,6 @@ static int evilnotify(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a } /* - * Idle Notification (group 1, type 0x11) - * - * Should set your current idle time in seconds. Note that this should - * never be called consecutively with a non-zero idle time. That makes - * OSCAR do funny things. Instead, just set it once you go idle, and then - * call it again with zero when you're back. - * - */ -int aim_bos_setidle(aim_session_t *sess, aim_conn_t *conn, guint32 idletime) -{ - return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime); -} - -/* * Service Migrate (group 1, type 0x12) * * This is the final SNAC sent on the original connection during a migration. @@ -636,17 +563,6 @@ int aim_bos_setprivacyflags(aim_session_t *sess, aim_conn_t *conn, guint32 flags return aim_genericreq_l(sess, conn, 0x0001, 0x0014, &flags); } -/* - * No-op (group 1, type 0x16) - * - * WinAIM sends these every 4min or so to keep the connection alive. Its not - * real necessary. - * - */ -int aim_nop(aim_session_t *sess, aim_conn_t *conn) -{ - return aim_genericreq_n(sess, conn, 0x0001, 0x0016); -} /* * Set client versions (group 1, subtype 0x17) @@ -810,94 +726,6 @@ static int memrequest(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a return 0; } -/* Client verification reply (group 1, subtype 0x20) */ -int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !conn) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+16))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, 0x0001, 0x0020, 0x0000, NULL, 0); - - aim_putsnac(&fr->data, 0x0001, 0x0020, 0x0000, snacid); - aimbs_put16(&fr->data, 0x0010); /* md5 is always 16 bytes */ - - if ((flag == AIM_SENDMEMBLOCK_FLAG_ISHASH) && buf && (len == 0x10)) { /* we're getting a hash */ - - aimbs_putraw(&fr->data, buf, 0x10); - - } else if (buf && (len > 0)) { /* use input buffer */ - md5_state_t state; - md5_byte_t digest[0x10]; - - md5_init(&state); - md5_append(&state, (const md5_byte_t *)buf, len); - md5_finish(&state, digest); - - aimbs_putraw(&fr->data, (guint8 *)digest, 0x10); - - } else if (len == 0) { /* no length, just hash NULL (buf is optional) */ - md5_state_t state; - guint8 nil = '\0'; - md5_byte_t digest[0x10]; - - /* - * These MD5 routines are stupid in that you have to have - * at least one append. So thats why this doesn't look - * real logical. - */ - md5_init(&state); - md5_append(&state, (const md5_byte_t *)&nil, 0); - md5_finish(&state, digest); - - aimbs_putraw(&fr->data, (guint8 *)digest, 0x10); - - } else { - - /* - * This data is correct for AIM 3.5.1670. - * - * Using these blocks is as close to "legal" as you can get - * without using an AIM binary. - * - */ - if ((offset == 0x03ffffff) && (len == 0x03ffffff)) { - -#if 1 /* with "AnrbnrAqhfzcd" */ - aimbs_put32(&fr->data, 0x44a95d26); - aimbs_put32(&fr->data, 0xd2490423); - aimbs_put32(&fr->data, 0x93b8821f); - aimbs_put32(&fr->data, 0x51c54b01); -#else /* no filename */ - aimbs_put32(&fr->data, 0x1df8cbae); - aimbs_put32(&fr->data, 0x5523b839); - aimbs_put32(&fr->data, 0xa0e10db3); - aimbs_put32(&fr->data, 0xa46d3b39); -#endif - -/* len can't be 0 here anyway... - } else if ((offset == 0x00001000) && (len == 0x00000000)) { - - aimbs_put32(&fr->data, 0xd41d8cd9); - aimbs_put32(&fr->data, 0x8f00b204); - aimbs_put32(&fr->data, 0xe9800998); - aimbs_put32(&fr->data, 0xecf8427e); -*/ - } else - imcb_error(sess->aux_data, "Warning: unknown hash request"); - - } - - aim_tx_enqueue(sess, fr); - - return 0; -} - static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { diff --git a/protocols/oscar/ssi.c b/protocols/oscar/ssi.c index 14201a44..e8502f68 100644 --- a/protocols/oscar/ssi.c +++ b/protocols/oscar/ssi.c @@ -262,28 +262,6 @@ int aim_ssi_getpermdeny(struct aim_ssi_item *list) } /** - * Locally find the presence flag item, and return the setting. The returned setting is a - * bitmask of the user flags that you are visible to. See the AIM_FLAG_* #defines - * in aim.h - * - * @param list A pointer to the current list of items. - * @return Return the current visibility mask. - */ -guint32 aim_ssi_getpresence(struct aim_ssi_item *list) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS); - if (cur) { - aim_tlvlist_t *tlvlist = cur->data; - if (tlvlist) { - aim_tlv_t *tlv = aim_gettlv(tlvlist, 0x00c9, 1); - if (tlv && tlv->length) - return aimutil_get32(tlv->value); - } - } - return 0xFFFFFFFF; -} - -/** * Add the given packet to the holding queue. We totally need to send SSI SNACs one at * a time, so we have a local queue where packets get put before they are sent, and * then we send stuff one at a time, nice and orderly-like. @@ -344,143 +322,6 @@ static int aim_ssi_dispatch(aim_session_t *sess, aim_conn_t *conn) } /** - * Send SNACs necessary to remove all SSI data from the server list, - * and then free the local copy as well. - * - * @param sess The oscar session. - * @param conn The bos connection for this session. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_deletelist(aim_session_t *sess, aim_conn_t *conn) -{ - int num; - struct aim_ssi_item *cur, **items; - - for (cur=sess->ssi.items, num=0; cur; cur=cur->next) - num++; - - if (!(items = g_new0(struct aim_ssi_item *, num))) - return -ENOMEM; - - for (cur=sess->ssi.items, num=0; cur; cur=cur->next) { - items[num] = cur; - num++; - } - - aim_ssi_addmoddel(sess, conn, items, num, AIM_CB_SSI_DEL); - g_free(items); - aim_ssi_dispatch(sess, conn); - aim_ssi_freelist(sess); - - return 0; -} - -/** - * This "cleans" the ssi list. It does a few things, with the intent of making - * sure there ain't nothin' wrong with your SSI. - * -Make sure all buddies are in a group, and all groups have the correct - * additional data. - * -Make sure there are no empty groups in the list. While there is nothing - * wrong empty groups in the SSI, it's wiser to not have them. - * - * @param sess The oscar session. - * @param conn The bos connection for this session. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_cleanlist(aim_session_t *sess, aim_conn_t *conn) -{ - unsigned int i; - struct aim_ssi_item *cur, *parentgroup; - - /* Make sure we actually need to clean out the list */ - for (cur=sess->ssi.items, i=0; cur && !i; cur=cur->next) - /* Any buddies directly in the master group */ - if ((cur->type == AIM_SSI_TYPE_BUDDY) && (cur->gid == 0x0000)) - i++; - if (!i) - return 0; - - /* Remove all the additional data from all groups */ - for (cur=sess->ssi.items; cur; cur=cur->next) - if ((cur->data) && (cur->type == AIM_SSI_TYPE_GROUP)) { - aim_freetlvchain((aim_tlvlist_t **)&cur->data); - cur->data = NULL; - } - - /* If there are buddies directly in the master group, make sure */ - /* there is a group to put them in. Any group, any group at all. */ - for (cur=sess->ssi.items; ((cur) && ((cur->type != AIM_SSI_TYPE_BUDDY) || (cur->gid != 0x0000))); cur=cur->next); - if (!cur) { - for (parentgroup=sess->ssi.items; ((parentgroup) && (parentgroup->type!=AIM_SSI_TYPE_GROUP) && (parentgroup->gid==0x0000)); parentgroup=parentgroup->next); - if (!parentgroup) { - char *newgroup; - newgroup = (char*)g_malloc(strlen("Unknown")+1); - strcpy(newgroup, "Unknown"); - aim_ssi_addgroups(sess, conn, &newgroup, 1); - } - } - - /* Set parentgroup equal to any arbitray group */ - for (parentgroup=sess->ssi.items; parentgroup->gid==0x0000 || parentgroup->type!=AIM_SSI_TYPE_GROUP; parentgroup=parentgroup->next); - - /* If there are any buddies directly in the master group, put them in a real group */ - for (cur=sess->ssi.items; cur; cur=cur->next) - if ((cur->type == AIM_SSI_TYPE_BUDDY) && (cur->gid == 0x0000)) { - aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_DEL); - cur->gid = parentgroup->gid; - aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_ADD); - } - - /* Rebuild additional data for all groups */ - for (parentgroup=sess->ssi.items; parentgroup; parentgroup=parentgroup->next) - if (parentgroup->type == AIM_SSI_TYPE_GROUP) - aim_ssi_itemlist_rebuildgroup(&sess->ssi.items, parentgroup); - - /* Send a mod snac for all groups */ - i = 0; - for (cur=sess->ssi.items; cur; cur=cur->next) - if (cur->type == AIM_SSI_TYPE_GROUP) - i++; - if (i > 0) { - /* Allocate an array of pointers to each of the groups */ - struct aim_ssi_item **groups; - if (!(groups = g_new0(struct aim_ssi_item *, i))) - return -ENOMEM; - - for (cur=sess->ssi.items, i=0; cur; cur=cur->next) - if (cur->type == AIM_SSI_TYPE_GROUP) - groups[i] = cur; - - aim_ssi_addmoddel(sess, conn, groups, i, AIM_CB_SSI_MOD); - g_free(groups); - } - - /* Send a del snac for any empty groups */ - i = 0; - for (cur=sess->ssi.items; cur; cur=cur->next) - if ((cur->type == AIM_SSI_TYPE_GROUP) && !(cur->data)) - i++; - if (i > 0) { - /* Allocate an array of pointers to each of the groups */ - struct aim_ssi_item **groups; - if (!(groups = g_new0(struct aim_ssi_item *, i))) - return -ENOMEM; - - for (cur=sess->ssi.items, i=0; cur; cur=cur->next) - if ((cur->type == AIM_SSI_TYPE_GROUP) && !(cur->data)) - groups[i] = cur; - - aim_ssi_addmoddel(sess, conn, groups, i, AIM_CB_SSI_DEL); - g_free(groups); - } - - /* Begin sending SSI SNACs */ - aim_ssi_dispatch(sess, conn); - - return 0; -} - -/** * Add an array of screen names to the given group. * * @param sess The oscar session. @@ -998,57 +839,6 @@ int aim_ssi_delpord(aim_session_t *sess, aim_conn_t *conn, char **sn, unsigned i return 0; } -/** - * Stores your setting for whether you should show up as idle or not. - * - * @param sess The oscar session. - * @param conn The bos connection for this session. - * @param presence I think it's a bitmask, but I only know what one of the bits is: - * 0x00000400 - Allow others to see your idle time - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_setpresence(aim_session_t *sess, aim_conn_t *conn, guint32 presence) { - struct aim_ssi_item *cur; //, *tmp; -// guint16 j; - aim_tlv_t *tlv; - - if (!sess || !conn) - return -EINVAL; - - /* Look up the item */ - cur = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS); - - if (cur) { - /* The item exists */ - if (cur->data && (tlv = aim_gettlv(cur->data, 0x00c9, 1))) { - /* Just change the value of the x00c9 TLV */ - if (tlv->length != 4) { - tlv->length = 4; - g_free(tlv->value); - tlv->value = (guint8 *)g_malloc(4*sizeof(guint8)); - } - aimutil_put32(tlv->value, presence); - } else { - /* Need to add the x00c9 TLV to the TLV chain */ - aim_addtlvtochain32((aim_tlvlist_t**)&cur->data, 0x00c9, presence); - } - - /* Send the mod item SNAC */ - aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_MOD); - } else { - /* Need to add the item */ - if (!(cur = aim_ssi_itemlist_add(&sess->ssi.items, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS))) - return -ENOMEM; - aim_addtlvtochain32((aim_tlvlist_t**)&cur->data, 0x00c9, presence); - aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_ADD); - } - - /* Begin sending SSI SNACs */ - aim_ssi_dispatch(sess, conn); - - return 0; -} - /* * Request SSI Rights. */ @@ -1071,37 +861,6 @@ static int parserights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, return ret; } -/* - * Request SSI Data. - * - * The data will only be sent if it is newer than the posted local - * timestamp and revision. - * - * Note that the client should never increment the revision, only the server. - * - */ -int aim_ssi_reqdata(aim_session_t *sess, aim_conn_t *conn, time_t localstamp, guint16 localrev) -{ - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !conn) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+2))) - return -ENOMEM; - - snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_REQLIST, 0x0000, NULL, 0); - - aim_putsnac(&fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_REQLIST, 0x0000, snacid); - aimbs_put32(&fr->data, localstamp); - aimbs_put16(&fr->data, localrev); - - aim_tx_enqueue(sess, fr); - - return 0; -} - int aim_ssi_reqalldata(aim_session_t *sess, aim_conn_t *conn) { aim_frame_t *fr; diff --git a/protocols/oscar/ssi.h b/protocols/oscar/ssi.h index d01bcea4..60d9faa5 100644 --- a/protocols/oscar/ssi.h +++ b/protocols/oscar/ssi.h @@ -44,7 +44,6 @@ struct aim_ssi_item { /* These build the actual SNACs and queue them to be sent */ int aim_ssi_reqrights(aim_session_t *sess, aim_conn_t *conn); -int aim_ssi_reqdata(aim_session_t *sess, aim_conn_t *conn, time_t localstamp, guint16 localrev); int aim_ssi_reqalldata(aim_session_t *sess, aim_conn_t *conn); int aim_ssi_enable(aim_session_t *sess, aim_conn_t *conn); int aim_ssi_addmoddel(aim_session_t *sess, aim_conn_t *conn, struct aim_ssi_item **items, unsigned int num, guint16 subtype); @@ -56,10 +55,8 @@ struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gi struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, char *gn, char *sn, guint16 type); struct aim_ssi_item *aim_ssi_itemlist_findparent(struct aim_ssi_item *list, char *sn); int aim_ssi_getpermdeny(struct aim_ssi_item *list); -guint32 aim_ssi_getpresence(struct aim_ssi_item *list); /* Send packets */ -int aim_ssi_cleanlist(aim_session_t *sess, aim_conn_t *conn); int aim_ssi_addbuddies(aim_session_t *sess, aim_conn_t *conn, char *gn, char **sn, unsigned int num, unsigned int flags); int aim_ssi_addmastergroup(aim_session_t *sess, aim_conn_t *conn); int aim_ssi_addgroups(aim_session_t *sess, aim_conn_t *conn, char **gn, unsigned int num); @@ -68,9 +65,7 @@ int aim_ssi_movebuddy(aim_session_t *sess, aim_conn_t *conn, char *oldgn, char * int aim_ssi_delbuddies(aim_session_t *sess, aim_conn_t *conn, char *gn, char **sn, unsigned int num); int aim_ssi_delmastergroup(aim_session_t *sess, aim_conn_t *conn); int aim_ssi_delgroups(aim_session_t *sess, aim_conn_t *conn, char **gn, unsigned int num); -int aim_ssi_deletelist(aim_session_t *sess, aim_conn_t *conn); int aim_ssi_delpord(aim_session_t *sess, aim_conn_t *conn, char **sn, unsigned int num, guint16 type); -int aim_ssi_setpresence(aim_session_t *sess, aim_conn_t *conn, guint32 presence); int aim_ssi_auth_request(aim_session_t *sess, aim_conn_t *conn, char *uin, char *reason); int aim_ssi_auth_reply(aim_session_t *sess, aim_conn_t *conn, char *uin, int yesno, char *reason); diff --git a/protocols/oscar/tlv.c b/protocols/oscar/tlv.c index 9d827caf..89ef6f26 100644 --- a/protocols/oscar/tlv.c +++ b/protocols/oscar/tlv.c @@ -222,39 +222,6 @@ int aim_addtlvtochain32(aim_tlvlist_t **list, const guint16 t, const guint32 v) } /** - * aim_addtlvtochain_availmsg - Add a ICQ availability message to a TLV chain - * @list: Destination chain - * @type: TLV type to add - * @val: Value to add - * - * Adds a available message to a TLV chain - * - */ -int aim_addtlvtochain_availmsg(aim_tlvlist_t **list, const guint16 t, const char *msg) -{ - int ret; - guint16 unknown_data = 0x00; - guint8 add_data_len = 4; - guint16 msg_len = strlen(msg); - guint8 total_len = strlen(msg) + add_data_len; - guint8 *data, *cur; - guint8 alloc_len = msg_len + (3*sizeof(guint16)) + (2*sizeof(guint8)); - data = cur = g_malloc(alloc_len); - - cur += aimutil_put16(cur, 2); - cur += aimutil_put8(cur, add_data_len); - cur += aimutil_put8(cur, total_len); - cur += aimutil_put16(cur, msg_len); - cur += aimutil_putstr(cur, msg, msg_len); - cur += aimutil_put16(cur, unknown_data); - - ret = aim_addtlvtochain_raw(list, t, alloc_len, data); - g_free(data); - - return ret; -} - -/** * aim_addtlvtochain_caps - Add a capability block to a TLV chain * @list: Destination chain * @type: TLV type to add @@ -279,18 +246,6 @@ int aim_addtlvtochain_caps(aim_tlvlist_t **list, const guint16 t, const guint32 return aim_addtlvtochain_raw(list, t, aim_bstream_curpos(&bs), buf); } -int aim_addtlvtochain_userinfo(aim_tlvlist_t **list, guint16 type, aim_userinfo_t *ui) -{ - guint8 buf[1024]; /* bleh */ - aim_bstream_t bs; - - aim_bstream_init(&bs, buf, sizeof(buf)); - - aim_putuserinfo(&bs, ui); - - return aim_addtlvtochain_raw(list, type, aim_bstream_curpos(&bs), buf); -} - /** * aim_addtlvtochain_noval - Add a blank TLV to a TLV chain * @list: Destination chain |