Changes in / [1444be5:91ae87d]
- Files:
-
- 1 added
- 3 deleted
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
debian/changelog
r1444be5 r91ae87d 1 bitlbee (3.0.6-1) unstable; urgency=low 2 3 * New upstream release. 4 5 -- Wilmer van der Gaast <wilmer@gaast.net> Sun, 28 Oct 2012 19:58:33 +0000 6 1 7 bitlbee (3.0.5-1.2) unstable; urgency=low 2 8 -
protocols/jabber/message.c
r1444be5 r91ae87d 24 24 #include "jabber.h" 25 25 26 static unsigned int next_receipt_id = 1;27 28 26 xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) 29 27 { 30 28 struct im_connection *ic = data; 31 struct jabber_data *jd = ic->proto_data;32 29 char *from = xt_find_attr( node, "from" ); 33 30 char *type = xt_find_attr( node, "type" ); … … 35 32 struct xt_node *body = xt_find_node( node->children, "body" ), *c; 36 33 struct xt_node *request = xt_find_node( node->children, "request" ); 37 struct xt_node *received, *receipt;38 34 struct jabber_buddy *bud = NULL; 39 35 char *s, *room = NULL, *reason = NULL; … … 51 47 * <received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/> 52 48 * </message> */ 49 struct xt_node *received, *receipt; 50 53 51 received = xt_new_node( "received", NULL, NULL ); 54 52 xt_add_attr( received, "xmlns", XMLNS_RECEIPTS ); 55 53 xt_add_attr( received, "id", id ); 56 54 receipt = jabber_make_packet( "message", NULL, from, received ); 57 xt_add_attr( receipt, "from", jd->me );58 59 char *id = g_strdup_printf( "%sRCPT%05x", JABBER_PACKET_ID, ( next_receipt_id++ ) & 0xfffff );60 xt_add_attr( receipt, "id", id );61 g_free( id );62 55 63 56 jabber_write_packet( ic, receipt ); -
protocols/msn/msn.h
r1444be5 r91ae87d 242 242 243 243 /* msn_util.c */ 244 int msn_logged_in( struct im_connection *ic );245 244 int msn_buddy_list_add( struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *realname_, const char *group ); 246 245 int msn_buddy_list_remove( struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *group ); -
protocols/msn/msn_util.c
r1444be5 r91ae87d 29 29 #include "soap.h" 30 30 #include <ctype.h> 31 32 int msn_logged_in( struct im_connection *ic )33 {34 imcb_connected( ic );35 36 return( 0 );37 }38 31 39 32 static char *adlrml_entry( const char *handle_, msn_buddy_flags_t list ) -
protocols/nogaim.h
r1444be5 r91ae87d 198 198 void (* rem_permit) (struct im_connection *, char *who); 199 199 void (* rem_deny) (struct im_connection *, char *who); 200 /* Doesn't actually have UI hooks. */200 /* Doesn't actually have UI hooks. Not used at all, can be removed. */ 201 201 void (* set_permit_deny)(struct im_connection *); 202 202 -
protocols/oscar/aim.h
r1444be5 r91ae87d 410 410 #define AIM_USERINFO_PRESENT_SESSIONLEN 0x00000100 411 411 412 const char *aim_userinfo_sn(aim_userinfo_t *ui);413 guint16 aim_userinfo_flags(aim_userinfo_t *ui);414 guint16 aim_userinfo_idle(aim_userinfo_t *ui);415 float aim_userinfo_warnlevel(aim_userinfo_t *ui);416 time_t aim_userinfo_membersince(aim_userinfo_t *ui);417 time_t aim_userinfo_onlinesince(aim_userinfo_t *ui);418 guint32 aim_userinfo_sessionlen(aim_userinfo_t *ui);419 int aim_userinfo_hascap(aim_userinfo_t *ui, guint32 cap);420 421 412 #define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */ 422 413 #define AIM_FLAG_ADMINISTRATOR 0x0002 … … 474 465 int aim_addtlvtochain16(aim_tlvlist_t **list, const guint16 t, const guint16 v); 475 466 int aim_addtlvtochain32(aim_tlvlist_t **list, const guint16 type, const guint32 v); 476 int aim_addtlvtochain_availmsg(aim_tlvlist_t **list, const guint16 type, const char *msg);477 467 int aim_addtlvtochain_raw(aim_tlvlist_t **list, const guint16 t, const guint16 l, const guint8 *v); 478 468 int aim_addtlvtochain_caps(aim_tlvlist_t **list, const guint16 t, const guint32 caps); … … 601 591 #define AIM_WARN_ANON 0x01 602 592 603 int aim_sendpauseack(aim_session_t *sess, aim_conn_t *conn);604 int aim_send_warning(aim_session_t *sess, aim_conn_t *conn, const char *destsn, guint32 flags);605 int aim_nop(aim_session_t *, aim_conn_t *);606 593 int aim_flap_nop(aim_session_t *sess, aim_conn_t *conn); 607 int aim_bos_setidle(aim_session_t *, aim_conn_t *, guint32);608 int aim_bos_changevisibility(aim_session_t *, aim_conn_t *, int, const char *);609 int aim_bos_setbuddylist(aim_session_t *, aim_conn_t *, const char *);610 594 int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, const char *profile, const char *awaymsg, guint32 caps); 611 595 int aim_bos_setgroupperm(aim_session_t *, aim_conn_t *, guint32 mask); … … 616 600 int aim_bos_reqbuddyrights(aim_session_t *, aim_conn_t *); 617 601 int aim_bos_reqlocaterights(aim_session_t *, aim_conn_t *); 618 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);619 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);620 602 int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, guint32 status); 621 603 … … 627 609 #define AIM_CLIENTTYPE_WINAIM41 0x0003 628 610 #define AIM_CLIENTTYPE_AOL_TOC 0x0004 629 unsigned short aim_fingerprintclient(unsigned char *msghdr, int len);630 611 631 612 #define AIM_RATE_CODE_CHANGE 0x0001 … … 646 627 #define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 647 628 #define AIM_SENDMEMBLOCK_FLAG_ISHASH 1 648 649 int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag);650 629 651 630 #define AIM_GETINFO_GENERALINFO 0x00001 … … 674 653 #define AIM_TRANSFER_DENY_DECLINE 0x0001 675 654 #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 676 int aim_denytransfer(aim_session_t *sess, const char *sender, const guint8 *cookie, unsigned short code);677 655 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); 678 656 679 657 int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, unsigned short); 680 int aim_sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info);681 int aim_sendbuddyoffgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn);682 658 683 659 #define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED 0x00000001 … … 747 723 int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen); 748 724 int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance); 749 int aim_chat_attachname(aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance);750 char *aim_chat_getname(aim_conn_t *conn);751 aim_conn_t *aim_chat_getconn(aim_session_t *, const char *name);752 725 753 726 int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn); … … 756 729 757 730 int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, guint16 exchange); 758 int aim_chat_leaveroom(aim_session_t *sess, const char *name);759 731 760 732 /* aim_util.c */ … … 812 784 813 785 814 int aimutil_putstr(u_char *, const char *, int);815 int aimutil_tokslen(char *toSearch, int index, char dl);816 int aimutil_itemcnt(char *toSearch, char dl);817 char *aimutil_itemidx(char *toSearch, int index, char dl);818 786 int aim_sncmp(const char *a, const char *b); 819 787 -
protocols/oscar/aim_internal.h
r1444be5 r91ae87d 112 112 int aim_putsnac(aim_bstream_t *, guint16 family, guint16 type, guint16 flags, aim_snacid_t id); 113 113 114 aim_conn_t *aim_cloneconn(aim_session_t *sess, aim_conn_t *src);115 void aim_clonehandlers(aim_session_t *sess, aim_conn_t *dest, aim_conn_t *src);116 117 114 int aim_oft_buildheader(unsigned char *,struct aim_fileheader_t *); 118 115 … … 195 192 196 193 int aim_extractuserinfo(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *); 197 int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info);198 194 199 195 int aim_chat_readroominfo(aim_bstream_t *bs, struct aim_chat_roominfo *outinfo); 200 196 201 int aim_request_directim(aim_session_t *sess, const char *destsn, guint8 *ip, guint16 port, guint8 *ckret);202 int aim_request_sendfile(aim_session_t *sess, const char *sn, const char *filename, guint16 numfiles, guint32 totsize, guint8 *ip, guint16 port, guint8 *ckret);203 197 void aim_conn_close_rend(aim_session_t *sess, aim_conn_t *conn); 204 198 void aim_conn_kill_rend(aim_session_t *sess, aim_conn_t *conn); … … 210 204 int aim_reqrates(aim_session_t *, aim_conn_t *); 211 205 int aim_rates_addparam(aim_session_t *, aim_conn_t *); 212 int aim_rates_delparam(aim_session_t *, aim_conn_t *);213 206 214 207 #endif /* __AIM_INTERNAL_H__ */ -
protocols/oscar/bos.c
r1444be5 r91ae87d 56 56 } 57 57 58 /*59 * Modify permit/deny lists (group 9, types 5, 6, 7, and 8)60 *61 * Changes your visibility depending on changetype:62 *63 * AIM_VISIBILITYCHANGE_PERMITADD: Lets provided list of names see you64 * AIM_VISIBILITYCHANGE_PERMIDREMOVE: Removes listed names from permit list65 * AIM_VISIBILITYCHANGE_DENYADD: Hides you from provided list of names66 * AIM_VISIBILITYCHANGE_DENYREMOVE: Lets list see you again67 *68 * list should be a list of69 * screen names in the form "Screen Name One&ScreenNameTwo&" etc.70 *71 * Equivelents to options in WinAIM:72 * - Allow all users to contact me: Send an AIM_VISIBILITYCHANGE_DENYADD73 * with only your name on it.74 * - Allow only users on my Buddy List: Send an75 * AIM_VISIBILITYCHANGE_PERMITADD with the list the same as your76 * buddy list77 * - Allow only the uesrs below: Send an AIM_VISIBILITYCHANGE_PERMITADD78 * with everyone listed that you want to see you.79 * - Block all users: Send an AIM_VISIBILITYCHANGE_PERMITADD with only80 * yourself in the list81 * - Block the users below: Send an AIM_VISIBILITYCHANGE_DENYADD with82 * the list of users to be blocked83 *84 * XXX ye gods.85 */86 int aim_bos_changevisibility(aim_session_t *sess, aim_conn_t *conn, int changetype, const char *denylist)87 {88 aim_frame_t *fr;89 int packlen = 0;90 guint16 subtype;91 char *localcpy = NULL, *tmpptr = NULL;92 int i;93 int listcount;94 aim_snacid_t snacid;95 96 if (!denylist)97 return -EINVAL;98 99 if (changetype == AIM_VISIBILITYCHANGE_PERMITADD)100 subtype = 0x05;101 else if (changetype == AIM_VISIBILITYCHANGE_PERMITREMOVE)102 subtype = 0x06;103 else if (changetype == AIM_VISIBILITYCHANGE_DENYADD)104 subtype = 0x07;105 else if (changetype == AIM_VISIBILITYCHANGE_DENYREMOVE)106 subtype = 0x08;107 else108 return -EINVAL;109 110 localcpy = g_strdup(denylist);111 112 listcount = aimutil_itemcnt(localcpy, '&');113 packlen = aimutil_tokslen(localcpy, 99, '&') + listcount + 9;114 115 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, packlen))) {116 g_free(localcpy);117 return -ENOMEM;118 }119 120 snacid = aim_cachesnac(sess, 0x0009, subtype, 0x0000, NULL, 0);121 aim_putsnac(&fr->data, 0x0009, subtype, 0x00, snacid);122 123 for (i = 0; (i < (listcount - 1)) && (i < 99); i++) {124 tmpptr = aimutil_itemidx(localcpy, i, '&');125 126 aimbs_put8(&fr->data, strlen(tmpptr));127 aimbs_putraw(&fr->data, (guint8 *)tmpptr, strlen(tmpptr));128 129 g_free(tmpptr);130 }131 g_free(localcpy);132 133 aim_tx_enqueue(sess, fr);134 135 return 0;136 }137 138 58 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 139 59 { -
protocols/oscar/buddylist.c
r1444be5 r91ae87d 91 91 return 0; 92 92 } 93 94 /*95 * aim_add_buddy()96 *97 * Adds a single buddy to your buddy list after login.98 *99 * XXX this should just be an extension of setbuddylist()100 *101 */102 int aim_add_buddy(aim_session_t *sess, aim_conn_t *conn, const char *sn)103 {104 aim_frame_t *fr;105 aim_snacid_t snacid;106 107 if (!sn || !strlen(sn))108 return -EINVAL;109 110 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn))))111 return -ENOMEM;112 113 snacid = aim_cachesnac(sess, 0x0003, 0x0004, 0x0000, sn, strlen(sn)+1);114 aim_putsnac(&fr->data, 0x0003, 0x0004, 0x0000, snacid);115 116 aimbs_put8(&fr->data, strlen(sn));117 aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn));118 119 aim_tx_enqueue(sess, fr);120 121 return 0;122 }123 124 /*125 * XXX generalise to support removing multiple buddies (basically, its126 * the same as setbuddylist() but with a different snac subtype).127 *128 */129 int aim_remove_buddy(aim_session_t *sess, aim_conn_t *conn, const char *sn)130 {131 aim_frame_t *fr;132 aim_snacid_t snacid;133 134 if (!sn || !strlen(sn))135 return -EINVAL;136 137 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn))))138 return -ENOMEM;139 140 snacid = aim_cachesnac(sess, 0x0003, 0x0005, 0x0000, sn, strlen(sn)+1);141 aim_putsnac(&fr->data, 0x0003, 0x0005, 0x0000, snacid);142 143 aimbs_put8(&fr->data, strlen(sn));144 aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn));145 146 aim_tx_enqueue(sess, fr);147 148 return 0;149 }150 -
protocols/oscar/buddylist.h
r1444be5 r91ae87d 17 17 #define AIM_CB_BUD_DEFAULT 0xffff 18 18 19 /* aim_buddylist.c */20 int aim_add_buddy(aim_session_t *, aim_conn_t *, const char *);21 int aim_remove_buddy(aim_session_t *, aim_conn_t *, const char *);22 23 19 #endif /* __OSCAR_BUDDYLIST_H__ */ -
protocols/oscar/chat.c
r1444be5 r91ae87d 26 26 27 27 return; 28 }29 30 char *aim_chat_getname(aim_conn_t *conn)31 {32 struct chatconnpriv *ccp;33 34 if (!conn)35 return NULL;36 37 if (conn->type != AIM_CONN_TYPE_CHAT)38 return NULL;39 40 ccp = (struct chatconnpriv *)conn->priv;41 42 return ccp->name;43 }44 45 /* XXX get this into conn.c -- evil!! */46 aim_conn_t *aim_chat_getconn(aim_session_t *sess, const char *name)47 {48 aim_conn_t *cur;49 50 for (cur = sess->connlist; cur; cur = cur->next) {51 struct chatconnpriv *ccp = (struct chatconnpriv *)cur->priv;52 53 if (cur->type != AIM_CONN_TYPE_CHAT)54 continue;55 if (!cur->priv) {56 imcb_error(sess->aux_data, "chat connection with no name!");57 continue;58 }59 60 if (strcmp(ccp->name, name) == 0)61 break;62 }63 64 return cur;65 }66 67 int aim_chat_attachname(aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance)68 {69 struct chatconnpriv *ccp;70 71 if (!conn || !roomname)72 return -EINVAL;73 74 if (conn->priv)75 g_free(conn->priv);76 77 if (!(ccp = g_malloc(sizeof(struct chatconnpriv))))78 return -ENOMEM;79 80 ccp->exchange = exchange;81 ccp->name = g_strdup(roomname);82 ccp->instance = instance;83 84 conn->priv = (void *)ccp;85 86 return 0;87 28 } 88 29 … … 250 191 outinfo->name = aimbs_getstr(bs, namelen); 251 192 outinfo->instance = aimbs_get16(bs); 252 253 return 0;254 }255 256 int aim_chat_leaveroom(aim_session_t *sess, const char *name)257 {258 aim_conn_t *conn;259 260 if (!(conn = aim_chat_getconn(sess, name)))261 return -ENOENT;262 263 aim_conn_close(conn);264 193 265 194 return 0; -
protocols/oscar/conn.c
r1444be5 r91ae87d 351 351 352 352 return cur; 353 }354 355 /**356 * aim_cloneconn - clone an aim_conn_t357 * @sess: session containing parent358 * @src: connection to clone359 *360 * A new connection is allocated, and the values are filled in361 * appropriately. Note that this function sets the new connnection's362 * ->priv pointer to be equal to that of its parent: only the pointer363 * is copied, not the data it points to.364 *365 * This function returns a pointer to the new aim_conn_t, or %NULL on366 * error367 */368 aim_conn_t *aim_cloneconn(aim_session_t *sess, aim_conn_t *src)369 {370 aim_conn_t *conn;371 372 if (!(conn = aim_conn_getnext(sess)))373 return NULL;374 375 conn->fd = src->fd;376 conn->type = src->type;377 conn->subtype = src->subtype;378 conn->seqnum = src->seqnum;379 conn->priv = src->priv;380 conn->internal = src->internal;381 conn->lastactivity = src->lastactivity;382 conn->forcedlatency = src->forcedlatency;383 conn->sessv = src->sessv;384 aim_clonehandlers(sess, conn, src);385 386 if (src->inside) {387 /*388 * XXX should clone this section as well, but since currently389 * this function only gets called for some of that rendezvous390 * crap, and not on SNAC connections, its probably okay for391 * now.392 *393 */394 }395 396 return conn;397 353 } 398 354 -
protocols/oscar/icq.c
r1444be5 r91ae87d 65 65 aimbs_putle16(&fr->data, 0x003e); /* I command thee. */ 66 66 aimbs_putle16(&fr->data, snacid); /* eh. */ 67 68 aim_tx_enqueue(sess, fr);69 70 return 0;71 }72 73 int aim_icq_sendxmlreq(aim_session_t *sess, const char *xml)74 {75 aim_conn_t *conn;76 aim_frame_t *fr;77 aim_snacid_t snacid;78 int bslen;79 80 if (!xml || !strlen(xml))81 return -EINVAL;82 83 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015)))84 return -EINVAL;85 86 bslen = 2 + 10 + 2 + strlen(xml) + 1;87 88 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen)))89 return -ENOMEM;90 91 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0);92 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid);93 94 /* For simplicity, don't bother using a tlvlist */95 aimbs_put16(&fr->data, 0x0001);96 aimbs_put16(&fr->data, bslen);97 98 aimbs_putle16(&fr->data, bslen - 2);99 aimbs_putle32(&fr->data, atoi(sess->sn));100 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */101 aimbs_putle16(&fr->data, snacid); /* eh. */102 aimbs_putle16(&fr->data, 0x0998); /* shrug. */103 aimbs_putle16(&fr->data, strlen(xml) + 1);104 aimbs_putraw(&fr->data, (guint8 *)xml, strlen(xml) + 1);105 67 106 68 aim_tx_enqueue(sess, fr); … … 152 114 153 115 return 0; 154 }155 156 int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin)157 {158 aim_conn_t *conn;159 aim_frame_t *fr;160 aim_snacid_t snacid;161 int bslen;162 163 if (!uin || uin[0] < '0' || uin[0] > '9')164 return -EINVAL;165 166 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015)))167 return -EINVAL;168 169 bslen = 2 + 4 + 2 + 2 + 2 + 4;170 171 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen)))172 return -ENOMEM;173 174 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0);175 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid);176 177 /* For simplicity, don't bother using a tlvlist */178 aimbs_put16(&fr->data, 0x0001);179 aimbs_put16(&fr->data, bslen);180 181 aimbs_putle16(&fr->data, bslen - 2);182 aimbs_putle32(&fr->data, atoi(sess->sn));183 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */184 aimbs_putle16(&fr->data, snacid); /* eh. */185 aimbs_putle16(&fr->data, 0x051f); /* shrug. */186 aimbs_putle32(&fr->data, atoi(uin));187 188 aim_tx_enqueue(sess, fr);189 190 return 0;191 116 } 192 117 -
protocols/oscar/icq.h
r1444be5 r91ae87d 94 94 int aim_icq_ackofflinemsgs(aim_session_t *sess); 95 95 int aim_icq_getallinfo(aim_session_t *sess, const char *uin); 96 int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin);97 96 98 97 #endif /* __OSCAR_ICQ_H__ */ -
protocols/oscar/im.c
r1444be5 r91ae87d 23 23 #include "im.h" 24 24 #include "info.h" 25 26 /*27 * Takes a msghdr (and a length) and returns a client type28 * code. Note that this is *only a guess* and has a low likelihood29 * of actually being accurate.30 *31 * Its based on experimental data, with the help of Eric Warmenhoven32 * who seems to have collected a wide variety of different AIM clients.33 *34 *35 * Heres the current collection:36 * 0501 0003 0101 0101 01 AOL Mobile Communicator, WinAIM 1.0.41437 * 0501 0003 0101 0201 01 WinAIM 2.0.847, 2.1.1187, 3.0.1464,38 * 4.3.2229, 4.4.228639 * 0501 0004 0101 0102 0101 WinAIM 4.1.2010, libfaim (right here)40 * 0501 0001 0101 01 AOL v6.0, CompuServe 2000 v6.0, any41 * TOC client42 *43 * Note that in this function, only the feature bytes are tested, since44 * the rest will always be the same.45 *46 */47 guint16 aim_fingerprintclient(guint8 *msghdr, int len)48 {49 static const struct {50 guint16 clientid;51 int len;52 guint8 data[10];53 } fingerprints[] = {54 /* AOL Mobile Communicator, WinAIM 1.0.414 */55 { AIM_CLIENTTYPE_MC,56 3, {0x01, 0x01, 0x01}},57 58 /* WinAIM 2.0.847, 2.1.1187, 3.0.1464, 4.3.2229, 4.4.2286 */59 { AIM_CLIENTTYPE_WINAIM,60 3, {0x01, 0x01, 0x02}},61 62 /* WinAIM 4.1.2010, libfaim */63 { AIM_CLIENTTYPE_WINAIM41,64 4, {0x01, 0x01, 0x01, 0x02}},65 66 /* AOL v6.0, CompuServe 2000 v6.0, any TOC client */67 { AIM_CLIENTTYPE_AOL_TOC,68 1, {0x01}},69 70 { 0, 0}71 };72 int i;73 74 if (!msghdr || (len <= 0))75 return AIM_CLIENTTYPE_UNKNOWN;76 77 for (i = 0; fingerprints[i].len; i++) {78 if (fingerprints[i].len != len)79 continue;80 if (memcmp(fingerprints[i].data, msghdr, fingerprints[i].len) == 0)81 return fingerprints[i].clientid;82 }83 84 return AIM_CLIENTTYPE_UNKNOWN;85 }86 87 /* This should be endian-safe now... but who knows... */88 guint16 aim_iconsum(const guint8 *buf, int buflen)89 {90 guint32 sum;91 int i;92 93 for (i = 0, sum = 0; i + 1 < buflen; i += 2)94 sum += (buf[i+1] << 8) + buf[i];95 if (i < buflen)96 sum += buf[i];97 98 sum = ((sum & 0xffff0000) >> 16) + (sum & 0x0000ffff);99 100 return (guint16)sum;101 }102 25 103 26 /* … … 367 290 } 368 291 369 /*370 * This is also performance sensitive. (If you can believe it...)371 *372 */373 int aim_send_icon(aim_session_t *sess, const char *sn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum)374 {375 aim_conn_t *conn;376 int i;377 guint8 ck[8];378 aim_frame_t *fr;379 aim_snacid_t snacid;380 381 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))382 return -EINVAL;383 384 if (!sn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN))385 return -EINVAL;386 387 for (i = 0; i < 8; i++)388 aimutil_put8(ck+i, (guint8) rand());389 390 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)))391 return -ENOMEM;392 393 snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0);394 aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid);395 396 /*397 * Cookie398 */399 aimbs_putraw(&fr->data, ck, 8);400 401 /*402 * Channel (2)403 */404 aimbs_put16(&fr->data, 0x0002);405 406 /*407 * Dest sn408 */409 aimbs_put8(&fr->data, strlen(sn));410 aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn));411 412 /*413 * TLV t(0005)414 *415 * Encompasses everything below.416 */417 aimbs_put16(&fr->data, 0x0005);418 aimbs_put16(&fr->data, 2+8+16+6+4+4+iconlen+4+4+4+strlen(AIM_ICONIDENT));419 420 aimbs_put16(&fr->data, 0x0000);421 aimbs_putraw(&fr->data, ck, 8);422 aim_putcap(&fr->data, AIM_CAPS_BUDDYICON);423 424 /* TLV t(000a) */425 aimbs_put16(&fr->data, 0x000a);426 aimbs_put16(&fr->data, 0x0002);427 aimbs_put16(&fr->data, 0x0001);428 429 /* TLV t(000f) */430 aimbs_put16(&fr->data, 0x000f);431 aimbs_put16(&fr->data, 0x0000);432 433 /* TLV t(2711) */434 aimbs_put16(&fr->data, 0x2711);435 aimbs_put16(&fr->data, 4+4+4+iconlen+strlen(AIM_ICONIDENT));436 aimbs_put16(&fr->data, 0x0000);437 aimbs_put16(&fr->data, iconsum);438 aimbs_put32(&fr->data, iconlen);439 aimbs_put32(&fr->data, stamp);440 aimbs_putraw(&fr->data, icon, iconlen);441 aimbs_putraw(&fr->data, (guint8 *)AIM_ICONIDENT, strlen(AIM_ICONIDENT));442 443 /* TLV t(0003) */444 aimbs_put16(&fr->data, 0x0003);445 aimbs_put16(&fr->data, 0x0000);446 447 aim_tx_enqueue(sess, fr);448 449 return 0;450 }451 452 /*453 * This only works for ICQ 2001b (thats 2001 not 2000). Better, only454 * send it to clients advertising the RTF capability. In fact, if you send455 * it to a client that doesn't support that capability, the server will gladly456 * bounce it back to you.457 *458 * You'd think this would be in icq.c, but, well, I'm trying to stick with459 * the one-group-per-file scheme as much as possible. This could easily460 * be an exception, since Rendezvous IMs are external of the Oscar core,461 * and therefore are undefined. Really I just need to think of a good way to462 * make an interface similar to what AOL actually uses. But I'm not using COM.463 *464 */465 int aim_send_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args)466 {467 const char rtfcap[] = {"{97B12751-243C-4334-AD22-D6ABF73F1492}"}; /* AIM_CAPS_ICQRTF capability in string form */468 aim_conn_t *conn;469 int i;470 guint8 ck[8];471 aim_frame_t *fr;472 aim_snacid_t snacid;473 int servdatalen;474 475 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))476 return -EINVAL;477 478 if (!args || !args->destsn || !args->rtfmsg)479 return -EINVAL;480 481 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;482 483 for (i = 0; i < 8; i++)484 aimutil_put8(ck+i, (guint8) rand());485 486 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+128+servdatalen)))487 return -ENOMEM;488 489 snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0);490 aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid);491 492 /*493 * Cookie494 */495 aimbs_putraw(&fr->data, ck, 8);496 497 /*498 * Channel (2)499 */500 aimbs_put16(&fr->data, 0x0002);501 502 /*503 * Dest sn504 */505 aimbs_put8(&fr->data, strlen(args->destsn));506 aimbs_putraw(&fr->data, (guint8 *)args->destsn, strlen(args->destsn));507 508 /*509 * TLV t(0005)510 *511 * Encompasses everything below.512 */513 aimbs_put16(&fr->data, 0x0005);514 aimbs_put16(&fr->data, 2+8+16 + 2+2+2 + 2+2 + 2+2+servdatalen);515 516 aimbs_put16(&fr->data, 0x0000);517 aimbs_putraw(&fr->data, ck, 8);518 aim_putcap(&fr->data, AIM_CAPS_ICQSERVERRELAY);519 520 /*521 * t(000a) l(0002) v(0001)522 */523 aimbs_put16(&fr->data, 0x000a);524 aimbs_put16(&fr->data, 0x0002);525 aimbs_put16(&fr->data, 0x0001);526 527 /*528 * t(000f) l(0000) v()529 */530 aimbs_put16(&fr->data, 0x000f);531 aimbs_put16(&fr->data, 0x0000);532 533 /*534 * Service Data TLV535 */536 aimbs_put16(&fr->data, 0x2711);537 aimbs_put16(&fr->data, servdatalen);538 539 aimbs_putle16(&fr->data, 11 + 16 /* 11 + (sizeof CLSID) */);540 aimbs_putle16(&fr->data, 9);541 aim_putcap(&fr->data, AIM_CAPS_EMPTY);542 aimbs_putle16(&fr->data, 0);543 aimbs_putle32(&fr->data, 0);544 aimbs_putle8(&fr->data, 0);545 aimbs_putle16(&fr->data, 0x03ea); /* trid1 */546 547 aimbs_putle16(&fr->data, 14);548 aimbs_putle16(&fr->data, 0x03eb); /* trid2 */549 aimbs_putle32(&fr->data, 0);550 aimbs_putle32(&fr->data, 0);551 aimbs_putle32(&fr->data, 0);552 553 aimbs_putle16(&fr->data, 0x0001);554 aimbs_putle32(&fr->data, 0);555 aimbs_putle16(&fr->data, strlen(args->rtfmsg)+1);556 aimbs_putraw(&fr->data, (guint8 *)args->rtfmsg, strlen(args->rtfmsg)+1);557 558 aimbs_putle32(&fr->data, args->fgcolor);559 aimbs_putle32(&fr->data, args->bgcolor);560 aimbs_putle32(&fr->data, strlen(rtfcap)+1);561 aimbs_putraw(&fr->data, (guint8 *)rtfcap, strlen(rtfcap)+1);562 563 aim_tx_enqueue(sess, fr);564 565 return 0;566 }567 568 int aim_request_directim(aim_session_t *sess, const char *destsn, guint8 *ip, guint16 port, guint8 *ckret)569 {570 aim_conn_t *conn;571 guint8 ck[8];572 aim_frame_t *fr;573 aim_snacid_t snacid;574 aim_tlvlist_t *tl = NULL, *itl = NULL;575 int hdrlen, i;576 guint8 *hdr;577 aim_bstream_t hdrbs;578 579 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))580 return -EINVAL;581 582 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 256+strlen(destsn))))583 return -ENOMEM;584 585 snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0);586 aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid);587 588 /*589 * Generate a random message cookie590 *591 * This cookie needs to be alphanumeric and NULL-terminated to be592 * TOC-compatible.593 *594 * XXX have I mentioned these should be generated in msgcookie.c?595 *596 */597 for (i = 0; i < 7; i++)598 ck[i] = 0x30 + ((guint8) rand() % 10);599 ck[7] = '\0';600 601 if (ckret)602 memcpy(ckret, ck, 8);603 604 /* Cookie */605 aimbs_putraw(&fr->data, ck, 8);606 607 /* Channel */608 aimbs_put16(&fr->data, 0x0002);609 610 /* Destination SN */611 aimbs_put8(&fr->data, strlen(destsn));612 aimbs_putraw(&fr->data, (guint8 *)destsn, strlen(destsn));613 614 aim_addtlvtochain_noval(&tl, 0x0003);615 616 hdrlen = 2+8+16+6+8+6+4;617 hdr = g_malloc(hdrlen);618 aim_bstream_init(&hdrbs, hdr, hdrlen);619 620 aimbs_put16(&hdrbs, 0x0000);621 aimbs_putraw(&hdrbs, ck, 8);622 aim_putcap(&hdrbs, AIM_CAPS_IMIMAGE);623 624 aim_addtlvtochain16(&itl, 0x000a, 0x0001);625 aim_addtlvtochain_raw(&itl, 0x0003, 4, ip);626 aim_addtlvtochain16(&itl, 0x0005, port);627 aim_addtlvtochain_noval(&itl, 0x000f);628 629 aim_writetlvchain(&hdrbs, &itl);630 631 aim_addtlvtochain_raw(&tl, 0x0005, aim_bstream_curpos(&hdrbs), hdr);632 633 aim_writetlvchain(&fr->data, &tl);634 635 g_free(hdr);636 aim_freetlvchain(&itl);637 aim_freetlvchain(&tl);638 639 aim_tx_enqueue(sess, fr);640 641 return 0;642 }643 644 int aim_request_sendfile(aim_session_t *sess, const char *sn, const char *filename, guint16 numfiles, guint32 totsize, guint8 *ip, guint16 port, guint8 *ckret)645 {646 aim_conn_t *conn;647 int i;648 guint8 ck[8];649 aim_frame_t *fr;650 aim_snacid_t snacid;651 652 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))653 return -EINVAL;654 655 if (!sn || !filename)656 return -EINVAL;657 658 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)))659 return -ENOMEM;660 661 snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0);662 aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid);663 664 for (i = 0; i < 7; i++)665 aimutil_put8(ck+i, 0x30 + ((guint8) rand() % 10));666 ck[7] = '\0';667 668 if (ckret)669 memcpy(ckret, ck, 8);670 671 /*672 * Cookie673 */674 aimbs_putraw(&fr->data, ck, 8);675 676 /*677 * Channel (2)678 */679 aimbs_put16(&fr->data, 0x0002);680 681 /*682 * Dest sn683 */684 aimbs_put8(&fr->data, strlen(sn));685 aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn));686 687 /*688 * TLV t(0005)689 *690 * Encompasses everything below. Gee.691 */692 aimbs_put16(&fr->data, 0x0005);693 aimbs_put16(&fr->data, 2+8+16+6+8+6+4+2+2+2+2+4+strlen(filename)+4);694 695 aimbs_put16(&fr->data, 0x0000);696 aimbs_putraw(&fr->data, ck, 8);697 aim_putcap(&fr->data, AIM_CAPS_SENDFILE);698 699 /* TLV t(000a) */700 aimbs_put16(&fr->data, 0x000a);701 aimbs_put16(&fr->data, 0x0002);702 aimbs_put16(&fr->data, 0x0001);703 704 /* TLV t(0003) (IP) */705 aimbs_put16(&fr->data, 0x0003);706 aimbs_put16(&fr->data, 0x0004);707 aimbs_putraw(&fr->data, ip, 4);708 709 /* TLV t(0005) (port) */710 aimbs_put16(&fr->data, 0x0005);711 aimbs_put16(&fr->data, 0x0002);712 aimbs_put16(&fr->data, port);713 714 /* TLV t(000f) */715 aimbs_put16(&fr->data, 0x000f);716 aimbs_put16(&fr->data, 0x0000);717 718 /* TLV t(2711) */719 aimbs_put16(&fr->data, 0x2711);720 aimbs_put16(&fr->data, 2+2+4+strlen(filename)+4);721 722 /* ? */723 aimbs_put16(&fr->data, 0x0001);724 aimbs_put16(&fr->data, numfiles);725 aimbs_put32(&fr->data, totsize);726 aimbs_putraw(&fr->data, (guint8 *)filename, strlen(filename));727 728 /* ? */729 aimbs_put32(&fr->data, 0x00000000);730 731 aim_tx_enqueue(sess, fr);732 733 return 0;734 }735 736 /**737 * Request the status message of the given ICQ user.738 *739 * @param sess The oscar session.740 * @param sn The UIN of the user of whom you wish to request info.741 * @param type The type of info you wish to request. This should be the current742 * state of the user, as one of the AIM_ICQ_STATE_* defines.743 * @return Return 0 if no errors, otherwise return the error number.744 */745 int aim_send_im_ch2_geticqmessage(aim_session_t *sess, const char *sn, int type)746 {747 aim_conn_t *conn;748 int i;749 guint8 ck[8];750 aim_frame_t *fr;751 aim_snacid_t snacid;752 753 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)) || !sn)754 return -EINVAL;755 756 for (i = 0; i < 8; i++)757 aimutil_put8(ck+i, (guint8) rand());758 759 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+2+1+strlen(sn) + 4+0x5e + 4)))760 return -ENOMEM;761 762 snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0);763 aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid);764 765 /* Cookie */766 aimbs_putraw(&fr->data, ck, 8);767 768 /* Channel (2) */769 aimbs_put16(&fr->data, 0x0002);770 771 /* Dest sn */772 aimbs_put8(&fr->data, strlen(sn));773 aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn));774 775 /* TLV t(0005) - Encompasses almost everything below. */776 aimbs_put16(&fr->data, 0x0005); /* T */777 aimbs_put16(&fr->data, 0x005e); /* L */778 { /* V */779 aimbs_put16(&fr->data, 0x0000);780 781 /* Cookie */782 aimbs_putraw(&fr->data, ck, 8);783 784 /* Put the 16 byte server relay capability */785 aim_putcap(&fr->data, AIM_CAPS_ICQSERVERRELAY);786 787 /* TLV t(000a) */788 aimbs_put16(&fr->data, 0x000a);789 aimbs_put16(&fr->data, 0x0002);790 aimbs_put16(&fr->data, 0x0001);791 792 /* TLV t(000f) */793 aimbs_put16(&fr->data, 0x000f);794 aimbs_put16(&fr->data, 0x0000);795 796 /* TLV t(2711) */797 aimbs_put16(&fr->data, 0x2711);798 aimbs_put16(&fr->data, 0x0036);799 { /* V */800 aimbs_putle16(&fr->data, 0x001b); /* L */801 aimbs_putle16(&fr->data, 0x0008); /* AAA - Protocol version */802 aimbs_putle32(&fr->data, 0x00000000); /* Unknown */803 aimbs_putle32(&fr->data, 0x00000000); /* Unknown */804 aimbs_putle32(&fr->data, 0x00000000); /* Unknown */805 aimbs_putle32(&fr->data, 0x00000000); /* Unknown */806 aimbs_putle16(&fr->data, 0x0000); /* Unknown */807 aimbs_putle16(&fr->data, 0x0003); /* Client features? */808 aimbs_putle16(&fr->data, 0x0000); /* Unknown */809 aimbs_putle8(&fr->data, 0x00); /* Unkizown */810 aimbs_putle16(&fr->data, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */811 812 aimbs_putle16(&fr->data, 0x000e); /* L */813 aimbs_putle16(&fr->data, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */814 aimbs_putle32(&fr->data, 0x00000000); /* Unknown */815 aimbs_putle32(&fr->data, 0x00000000); /* Unknown */816 aimbs_putle32(&fr->data, 0x00000000); /* Unknown */817 818 /* The type of status message being requested */819 if (type & AIM_ICQ_STATE_CHAT)820 aimbs_putle16(&fr->data, 0x03ec);821 else if(type & AIM_ICQ_STATE_DND)822 aimbs_putle16(&fr->data, 0x03eb);823 else if(type & AIM_ICQ_STATE_OUT)824 aimbs_putle16(&fr->data, 0x03ea);825 else if(type & AIM_ICQ_STATE_BUSY)826 aimbs_putle16(&fr->data, 0x03e9);827 else if(type & AIM_ICQ_STATE_AWAY)828 aimbs_putle16(&fr->data, 0x03e8);829 830 aimbs_putle16(&fr->data, 0x0000); /* Status? */831 aimbs_putle16(&fr->data, 0x0001); /* Priority of this message? */832 aimbs_putle16(&fr->data, 0x0001); /* L? */833 aimbs_putle8(&fr->data, 0x00); /* Null termination? */834 } /* End TLV t(2711) */835 } /* End TLV t(0005) */836 837 /* TLV t(0003) */838 aimbs_put16(&fr->data, 0x0003);839 aimbs_put16(&fr->data, 0x0000);840 841 aim_tx_enqueue(sess, fr);842 843 return 0;844 }845 846 292 /** 847 293 * answers status message requests … … 1050 496 mpm->numparts++; 1051 497 1052 return 0;1053 }1054 1055 int aim_mpmsg_addraw(aim_session_t *sess, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const guint8 *data, guint16 datalen)1056 {1057 guint8 *dup;1058 1059 if (!(dup = g_malloc(datalen)))1060 return -1;1061 memcpy(dup, data, datalen);1062 1063 if (mpmsg_addsection(sess, mpm, charset, charsubset, dup, datalen) == -1) {1064 g_free(dup);1065 return -1;1066 }1067 1068 return 0;1069 }1070 1071 /* XXX should provide a way of saying ISO-8859-1 specifically */1072 int aim_mpmsg_addascii(aim_session_t *sess, aim_mpmsg_t *mpm, const char *ascii)1073 {1074 char *dup;1075 1076 if (!(dup = g_strdup(ascii)))1077 return -1;1078 1079 if (mpmsg_addsection(sess, mpm, 0x0000, 0x0000, (guint8 *)dup, (guint16) strlen(ascii)) == -1) {1080 g_free(dup);1081 return -1;1082 }1083 1084 return 0;1085 }1086 1087 int aim_mpmsg_addunicode(aim_session_t *sess, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen)1088 {1089 guint8 *buf;1090 aim_bstream_t bs;1091 int i;1092 1093 if (!(buf = g_malloc(unicodelen * 2)))1094 return -1;1095 1096 aim_bstream_init(&bs, buf, unicodelen * 2);1097 1098 /* We assume unicode is in /host/ byte order -- convert to network */1099 for (i = 0; i < unicodelen; i++)1100 aimbs_put16(&bs, unicode[i]);1101 1102 if (mpmsg_addsection(sess, mpm, 0x0002, 0x0000, buf, aim_bstream_curpos(&bs)) == -1) {1103 g_free(buf);1104 return -1;1105 }1106 1107 498 return 0; 1108 499 } … … 1788 1179 1789 1180 return ret; 1790 }1791 1792 /*1793 * Possible codes:1794 * AIM_TRANSFER_DENY_NOTSUPPORTED -- "client does not support"1795 * AIM_TRANSFER_DENY_DECLINE -- "client has declined transfer"1796 * AIM_TRANSFER_DENY_NOTACCEPTING -- "client is not accepting transfers"1797 *1798 */1799 int aim_denytransfer(aim_session_t *sess, const char *sender, const guint8 *cookie, guint16 code)1800 {1801 aim_conn_t *conn;1802 aim_frame_t *fr;1803 aim_snacid_t snacid;1804 aim_tlvlist_t *tl = NULL;1805 1806 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))1807 return -EINVAL;1808 1809 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+2+1+strlen(sender)+6)))1810 return -ENOMEM;1811 1812 snacid = aim_cachesnac(sess, 0x0004, 0x000b, 0x0000, NULL, 0);1813 aim_putsnac(&fr->data, 0x0004, 0x000b, 0x0000, snacid);1814 1815 aimbs_putraw(&fr->data, cookie, 8);1816 1817 aimbs_put16(&fr->data, 0x0002); /* channel */1818 aimbs_put8(&fr->data, strlen(sender));1819 aimbs_putraw(&fr->data, (guint8 *)sender, strlen(sender));1820 1821 aim_addtlvtochain16(&tl, 0x0003, code);1822 aim_writetlvchain(&fr->data, &tl);1823 aim_freetlvchain(&tl);1824 1825 aim_tx_enqueue(sess, fr);1826 1827 return 0;1828 1181 } 1829 1182 -
protocols/oscar/im.h
r1444be5 r91ae87d 47 47 48 48 int aim_mpmsg_init(aim_session_t *sess, aim_mpmsg_t *mpm); 49 int aim_mpmsg_addraw(aim_session_t *sess, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const guint8 *data, guint16 datalen);50 int aim_mpmsg_addascii(aim_session_t *sess, aim_mpmsg_t *mpm, const char *ascii);51 int aim_mpmsg_addunicode(aim_session_t *sess, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen);52 49 void aim_mpmsg_free(aim_session_t *sess, aim_mpmsg_t *mpm); 53 50 … … 83 80 guint16 charset; 84 81 guint16 charsubset; 85 };86 87 /*88 * Arguments to aim_send_rtfmsg().89 */90 struct aim_sendrtfmsg_args {91 const char *destsn;92 guint32 fgcolor;93 guint32 bgcolor;94 const char *rtfmsg; /* must be in RTF */95 82 }; 96 83 … … 183 170 }; 184 171 185 int aim_send_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args);186 172 int aim_send_im_ext(aim_session_t *sess, struct aim_sendimext_args *args); 187 173 int aim_send_im(aim_session_t *, const char *destsn, unsigned short flags, const char *msg); 188 int aim_send_icon(aim_session_t *sess, const char *sn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum);189 guint16 aim_iconsum(const guint8 *buf, int buflen);190 174 int aim_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing); 191 175 int aim_send_im_direct(aim_session_t *, aim_conn_t *, const char *msg, int len); … … 194 178 aim_conn_t *aim_directim_connect(aim_session_t *, const char *sn, const char *addr, const guint8 *cookie); 195 179 196 int aim_send_im_ch2_geticqmessage(aim_session_t *sess, const char *sn, int type);197 180 int aim_im_sendmtn(aim_session_t *sess, guint16 type1, const char *sn, guint16 type2); 198 181 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); -
protocols/oscar/info.c
r1444be5 r91ae87d 40 40 return 0; 41 41 } 42 43 const char *aim_userinfo_sn(aim_userinfo_t *ui)44 {45 46 if (!ui)47 return NULL;48 49 return ui->sn;50 }51 52 guint16 aim_userinfo_flags(aim_userinfo_t *ui)53 {54 55 if (!ui)56 return 0;57 58 return ui->flags;59 }60 61 guint16 aim_userinfo_idle(aim_userinfo_t *ui)62 {63 64 if (!ui)65 return 0;66 67 return ui->idletime;68 }69 70 float aim_userinfo_warnlevel(aim_userinfo_t *ui)71 {72 73 if (!ui)74 return 0.00;75 76 return (ui->warnlevel / 10);77 }78 79 time_t aim_userinfo_membersince(aim_userinfo_t *ui)80 {81 82 if (!ui)83 return 0;84 85 return (time_t)ui->membersince;86 }87 88 time_t aim_userinfo_onlinesince(aim_userinfo_t *ui)89 {90 91 if (!ui)92 return 0;93 94 return (time_t)ui->onlinesince;95 }96 97 guint32 aim_userinfo_sessionlen(aim_userinfo_t *ui)98 {99 100 if (!ui)101 return 0;102 103 return ui->sessionlen;104 }105 106 int aim_userinfo_hascap(aim_userinfo_t *ui, guint32 cap)107 {108 109 if (!ui || !(ui->present & AIM_USERINFO_PRESENT_CAPABILITIES))110 return -1;111 112 return !!(ui->capabilities & cap);113 }114 115 42 116 43 /* … … 482 409 aim_bstream_setpos(bs, endpos); 483 410 } 484 485 return 0;486 }487 488 /*489 * Inverse of aim_extractuserinfo()490 */491 int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info)492 {493 aim_tlvlist_t *tlvlist = NULL;494 495 if (!bs || !info)496 return -EINVAL;497 498 aimbs_put8(bs, strlen(info->sn));499 aimbs_putraw(bs, (guint8 *)info->sn, strlen(info->sn));500 501 aimbs_put16(bs, info->warnlevel);502 503 504 aim_addtlvtochain16(&tlvlist, 0x0001, info->flags);505 aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince);506 aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince);507 aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime);508 509 #if ICQ_OSCAR_SUPPORT510 if (atoi(info->sn) != 0) {511 aim_addtlvtochain16(&tlvlist, 0x0006, info->icqinfo.status);512 aim_addtlvtochain32(&tlvlist, 0x000a, info->icqinfo.ipaddr);513 }514 #endif515 516 aim_addtlvtochain_caps(&tlvlist, 0x000d, info->capabilities);517 518 aim_addtlvtochain32(&tlvlist, (guint16)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen);519 520 aimbs_put16(bs, aim_counttlvchain(&tlvlist));521 aim_writetlvchain(bs, &tlvlist);522 aim_freetlvchain(&tlvlist);523 524 return 0;525 }526 527 int aim_sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info)528 {529 aim_frame_t *fr;530 aim_snacid_t snacid;531 532 if (!sess || !conn || !info)533 return -EINVAL;534 535 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))536 return -ENOMEM;537 538 snacid = aim_cachesnac(sess, 0x0003, 0x000b, 0x0000, NULL, 0);539 540 aim_putsnac(&fr->data, 0x0003, 0x000b, 0x0000, snacid);541 aim_putuserinfo(&fr->data, info);542 543 aim_tx_enqueue(sess, fr);544 545 return 0;546 }547 548 int aim_sendbuddyoffgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn)549 {550 aim_frame_t *fr;551 aim_snacid_t snacid;552 553 if (!sess || !conn || !sn)554 return -EINVAL;555 556 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn))))557 return -ENOMEM;558 559 snacid = aim_cachesnac(sess, 0x0003, 0x000c, 0x0000, NULL, 0);560 561 aim_putsnac(&fr->data, 0x0003, 0x000c, 0x0000, snacid);562 aimbs_put8(&fr->data, strlen(sn));563 aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn));564 565 aim_tx_enqueue(sess, fr);566 567 return 0;568 }569 570 /*571 * Huh? What is this?572 */573 int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn)574 {575 aim_frame_t *fr;576 aim_snacid_t snacid;577 578 if (!sess || !conn || !sn)579 return -EINVAL;580 581 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn))))582 return -ENOMEM;583 584 snacid = aim_cachesnac(sess, 0x0002, 0x000b, 0x0000, NULL, 0);585 586 aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid);587 aimbs_put8(&fr->data, strlen(sn));588 aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn));589 590 aim_tx_enqueue(sess, fr);591 411 592 412 return 0; -
protocols/oscar/info.h
r1444be5 r91ae87d 40 40 #define AIM_CAPS_LAST 0x00200000 41 41 42 int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn);43 44 42 #endif /* __OSCAR_INFO_H__ */ -
protocols/oscar/misc.c
r1444be5 r91ae87d 13 13 14 14 #include <aim.h> 15 16 /*17 * aim_bos_setbuddylist(buddylist)18 *19 * This just builds the "set buddy list" command then queues it.20 *21 * buddy_list = "Screen Name One&ScreenNameTwo&";22 *23 * TODO: Clean this up.24 *25 * XXX: I can't stress the TODO enough.26 *27 */28 int aim_bos_setbuddylist(aim_session_t *sess, aim_conn_t *conn, const char *buddy_list)29 {30 aim_frame_t *fr;31 aim_snacid_t snacid;32 int len = 0;33 char *localcpy = NULL;34 char *tmpptr = NULL;35 36 if (!buddy_list || !(localcpy = g_strdup(buddy_list)))37 return -EINVAL;38 39 for (tmpptr = strtok(localcpy, "&"); tmpptr; ) {40 len += 1 + strlen(tmpptr);41 tmpptr = strtok(NULL, "&");42 }43 44 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+len)))45 return -ENOMEM;46 47 snacid = aim_cachesnac(sess, 0x0003, 0x0004, 0x0000, NULL, 0);48 aim_putsnac(&fr->data, 0x0003, 0x0004, 0x0000, snacid);49 50 strncpy(localcpy, buddy_list, strlen(buddy_list) + 1);51 52 for (tmpptr = strtok(localcpy, "&"); tmpptr; ) {53 54 aimbs_put8(&fr->data, strlen(tmpptr));55 aimbs_putraw(&fr->data, (guint8 *)tmpptr, strlen(tmpptr));56 tmpptr = strtok(NULL, "&");57 }58 59 aim_tx_enqueue(sess, fr);60 61 g_free(localcpy);62 63 return 0;64 }65 15 66 16 /* … … 127 77 128 78 /* 129 * Send a warning to destsn.130 *131 * Flags:132 * AIM_WARN_ANON Send as an anonymous (doesn't count as much)133 *134 * returns -1 on error (couldn't alloc packet), 0 on success.135 *136 */137 int aim_send_warning(aim_session_t *sess, aim_conn_t *conn, const char *destsn, guint32 flags)138 {139 aim_frame_t *fr;140 aim_snacid_t snacid;141 guint16 outflags = 0x0000;142 143 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, strlen(destsn)+13)))144 return -ENOMEM;145 146 snacid = aim_cachesnac(sess, 0x0004, 0x0008, 0x0000, destsn, strlen(destsn)+1);147 148 aim_putsnac(&fr->data, 0x0004, 0x0008, 0x0000, snacid);149 150 if (flags & AIM_WARN_ANON)151 outflags |= 0x0001;152 153 aimbs_put16(&fr->data, outflags);154 aimbs_put8(&fr->data, strlen(destsn));155 aimbs_putraw(&fr->data, (guint8 *)destsn, strlen(destsn));156 157 aim_tx_enqueue(sess, fr);158 159 return 0;160 }161 162 /*163 79 * Generic routine for sending commands. 164 80 * … … 254 170 { 255 171 return aim_genericreq_n(sess, conn, 0x0002, 0x0002); 256 }257 258 /*259 * Set directory profile data (not the same as aim_bos_setprofile!)260 *261 * privacy: 1 to allow searching, 0 to disallow.262 */263 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)264 {265 aim_frame_t *fr;266 aim_snacid_t snacid;267 aim_tlvlist_t *tl = NULL;268 269 270 aim_addtlvtochain16(&tl, 0x000a, privacy);271 272 if (first)273 aim_addtlvtochain_raw(&tl, 0x0001, strlen(first), (guint8 *)first);274 if (last)275 aim_addtlvtochain_raw(&tl, 0x0002, strlen(last), (guint8 *)last);276 if (middle)277 aim_addtlvtochain_raw(&tl, 0x0003, strlen(middle), (guint8 *)middle);278 if (maiden)279 aim_addtlvtochain_raw(&tl, 0x0004, strlen(maiden), (guint8 *)maiden);280 281 if (state)282 aim_addtlvtochain_raw(&tl, 0x0007, strlen(state), (guint8 *)state);283 if (city)284 aim_addtlvtochain_raw(&tl, 0x0008, strlen(city), (guint8 *)city);285 286 if (nickname)287 aim_addtlvtochain_raw(&tl, 0x000c, strlen(nickname), (guint8 *)nickname);288 if (zip)289 aim_addtlvtochain_raw(&tl, 0x000d, strlen(zip), (guint8 *)zip);290 291 if (street)292 aim_addtlvtochain_raw(&tl, 0x0021, strlen(street), (guint8 *)street);293 294 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl))))295 return -ENOMEM;296 297 snacid = aim_cachesnac(sess, 0x0002, 0x0009, 0x0000, NULL, 0);298 299 aim_putsnac(&fr->data, 0x0002, 0x0009, 0x0000, snacid);300 aim_writetlvchain(&fr->data, &tl);301 aim_freetlvchain(&tl);302 303 aim_tx_enqueue(sess, fr);304 305 return 0;306 }307 308 /* XXX pass these in better */309 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)310 {311 aim_frame_t *fr;312 aim_tlvlist_t *tl = NULL;313 314 /* ?? privacy ?? */315 aim_addtlvtochain16(&tl, 0x000a, privacy);316 317 if (interest1)318 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest1), (guint8 *)interest1);319 if (interest2)320 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest2), (guint8 *)interest2);321 if (interest3)322 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest3), (guint8 *)interest3);323 if (interest4)324 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest4), (guint8 *)interest4);325 if (interest5)326 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest5), (guint8 *)interest5);327 328 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl))))329 return -ENOMEM;330 331 aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0);332 333 aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0);334 aim_writetlvchain(&fr->data, &tl);335 aim_freetlvchain(&tl);336 337 aim_tx_enqueue(sess, fr);338 339 return 0;340 172 } 341 173 -
protocols/oscar/oscar.c
r1444be5 r91ae87d 2103 2103 } 2104 2104 2105 static void oscar_set_permit_deny(struct im_connection *ic) {2106 struct oscar_data *od = (struct oscar_data *)ic->proto_data;2107 if (od->icq) {2108 GSList *list;2109 char buf[MAXMSGLEN];2110 int at;2111 2112 switch(ic->permdeny) {2113 case 1:2114 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->acc->user);2115 break;2116 case 2:2117 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->acc->user);2118 break;2119 case 3:2120 list = ic->permit;2121 at = 0;2122 while (list) {2123 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);2124 list = list->next;2125 }2126 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf);2127 break;2128 case 4:2129 list = ic->deny;2130 at = 0;2131 while (list) {2132 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);2133 list = list->next;2134 }2135 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf);2136 break;2137 default:2138 break;2139 }2140 } else {2141 if (od->sess->ssi.received_data)2142 aim_ssi_setpermdeny(od->sess, od->conn, ic->permdeny, 0xffffffff);2143 }2144 }2145 2146 2105 static void oscar_add_permit(struct im_connection *ic, char *who) { 2147 2106 struct oscar_data *od = (struct oscar_data *)ic->proto_data; … … 2624 2583 ret->rem_permit = oscar_rem_permit; 2625 2584 ret->rem_deny = oscar_rem_deny; 2626 ret->set_permit_deny = oscar_set_permit_deny;2627 2585 ret->send_typing = oscar_send_typing; 2628 2586 -
protocols/oscar/oscar_util.c
r1444be5 r91ae87d 1 1 #include <aim.h> 2 2 #include <ctype.h> 3 4 int aimutil_putstr(u_char *dest, const char *src, int len)5 {6 memcpy(dest, src, len);7 return len;8 }9 10 /*11 * Tokenizing functions. Used to portably replace strtok/sep.12 * -- DMP.13 *14 */15 int aimutil_tokslen(char *toSearch, int index, char dl)16 {17 int curCount = 1;18 char *next;19 char *last;20 int toReturn;21 22 last = toSearch;23 next = strchr(toSearch, dl);24 25 while(curCount < index && next != NULL) {26 curCount++;27 last = next + 1;28 next = strchr(last, dl);29 }30 31 if ((curCount < index) || (next == NULL))32 toReturn = strlen(toSearch) - (curCount - 1);33 else34 toReturn = next - toSearch - (curCount - 1);35 36 return toReturn;37 }38 39 int aimutil_itemcnt(char *toSearch, char dl)40 {41 int curCount;42 char *next;43 44 curCount = 1;45 46 next = strchr(toSearch, dl);47 48 while(next != NULL) {49 curCount++;50 next = strchr(next + 1, dl);51 }52 53 return curCount;54 }55 56 char *aimutil_itemidx(char *toSearch, int index, char dl)57 {58 int curCount;59 char *next;60 char *last;61 char *toReturn;62 63 curCount = 0;64 65 last = toSearch;66 next = strchr(toSearch, dl);67 68 while (curCount < index && next != NULL) {69 curCount++;70 last = next + 1;71 next = strchr(last, dl);72 }73 74 if (curCount < index) {75 toReturn = g_strdup("");76 }77 next = strchr(last, dl);78 79 if (curCount < index) {80 toReturn = g_strdup("");81 } else {82 if (next == NULL) {83 toReturn = g_malloc((strlen(last) + 1) * sizeof(char));84 strcpy(toReturn, last);85 } else {86 toReturn = g_malloc((next - last + 1) * sizeof(char));87 memcpy(toReturn, last, (next - last));88 toReturn[next - last] = '\0';89 }90 }91 return toReturn;92 }93 3 94 4 /* -
protocols/oscar/rxhandlers.c
r1444be5 r91ae87d 286 286 } 287 287 288 void aim_clonehandlers(aim_session_t *sess, aim_conn_t *dest, aim_conn_t *src)289 {290 struct aim_rxcblist_s *cur;291 292 for (cur = (struct aim_rxcblist_s *)src->handlerlist; cur; cur = cur->next) {293 aim_conn_addhandler(sess, dest, cur->family, cur->type,294 cur->handler, cur->flags);295 }296 297 return;298 }299 300 288 static int aim_callhandler_noparam(aim_session_t *sess, aim_conn_t *conn,guint16 family, guint16 type, aim_frame_t *ptr) 301 289 { -
protocols/oscar/search.c
r1444be5 r91ae87d 8 8 9 9 #include <aim.h> 10 11 int aim_usersearch_address(aim_session_t *sess, aim_conn_t *conn, const char *address)12 {13 aim_frame_t *fr;14 aim_snacid_t snacid;15 16 if (!sess || !conn || !address)17 return -EINVAL;18 19 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+strlen(address))))20 return -ENOMEM;21 22 snacid = aim_cachesnac(sess, 0x000a, 0x0002, 0x0000, g_strdup(address), strlen(address)+1);23 aim_putsnac(&fr->data, 0x000a, 0x0002, 0x0000, snacid);24 25 aimbs_putraw(&fr->data, (guint8 *)address, strlen(address));26 27 aim_tx_enqueue(sess, fr);28 29 return 0;30 }31 10 32 11 /* XXX can this be integrated with the rest of the error handling? */ -
protocols/oscar/search.h
r1444be5 r91ae87d 2 2 #define __OSCAR_SEARCH_H__ 3 3 4 int aim_usersearch_address(aim_session_t *, aim_conn_t *, const char *);5 6 4 #endif /* __OSCAR_SEARCH_H__ */ -
protocols/oscar/service.c
r1444be5 r91ae87d 352 352 snacid = aim_cachesnac(sess, 0x0001, 0x0008, 0x0000, NULL, 0); 353 353 aim_putsnac(&fr->data, 0x0001, 0x0008, 0x0000, snacid); 354 355 for (rc = ins->rates; rc; rc = rc->next)356 aimbs_put16(&fr->data, rc->classid);357 358 aim_tx_enqueue(sess, fr);359 360 return 0;361 }362 363 /* Delete Rate Parameter (group 1, type 9) */364 int aim_rates_delparam(aim_session_t *sess, aim_conn_t *conn)365 {366 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;367 aim_frame_t *fr;368 aim_snacid_t snacid;369 struct rateclass *rc;370 371 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512)))372 return -ENOMEM;373 374 snacid = aim_cachesnac(sess, 0x0001, 0x0009, 0x0000, NULL, 0);375 aim_putsnac(&fr->data, 0x0001, 0x0009, 0x0000, snacid);376 354 377 355 for (rc = ins->rates; rc; rc = rc->next) … … 431 409 } 432 410 433 /*434 * Service Pause Acknowledgement (group 1, type 0x0c)435 *436 * It is rather important that aim_sendpauseack() gets called for the exact437 * same connection that the Server Pause callback was called for, since438 * libfaim extracts the data for the SNAC from the connection structure.439 *440 * Of course, if you don't do that, more bad things happen than just what441 * libfaim can cause.442 *443 */444 int aim_sendpauseack(aim_session_t *sess, aim_conn_t *conn)445 {446 aim_frame_t *fr;447 aim_snacid_t snacid;448 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;449 struct snacgroup *sg;450 451 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1024)))452 return -ENOMEM;453 454 snacid = aim_cachesnac(sess, 0x0001, 0x000c, 0x0000, NULL, 0);455 aim_putsnac(&fr->data, 0x0001, 0x000c, 0x0000, snacid);456 457 /*458 * This list should have all the groups that the original459 * Host Online / Server Ready said this host supports. And460 * we want them all back after the migration.461 */462 for (sg = ins->groups; sg; sg = sg->next)463 aimbs_put16(&fr->data, sg->group);464 465 aim_tx_enqueue(sess, fr);466 467 return 0;468 }469 470 411 /* Service Resume (group 1, type 0x0d) */ 471 412 static int serverresume(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) … … 517 458 518 459 return 0; 519 }520 521 /*522 * Idle Notification (group 1, type 0x11)523 *524 * Should set your current idle time in seconds. Note that this should525 * never be called consecutively with a non-zero idle time. That makes526 * OSCAR do funny things. Instead, just set it once you go idle, and then527 * call it again with zero when you're back.528 *529 */530 int aim_bos_setidle(aim_session_t *sess, aim_conn_t *conn, guint32 idletime)531 {532 return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime);533 460 } 534 461 … … 637 564 } 638 565 639 /*640 * No-op (group 1, type 0x16)641 *642 * WinAIM sends these every 4min or so to keep the connection alive. Its not643 * real necessary.644 *645 */646 int aim_nop(aim_session_t *sess, aim_conn_t *conn)647 {648 return aim_genericreq_n(sess, conn, 0x0001, 0x0016);649 }650 566 651 567 /* … … 807 723 g_free(modname); 808 724 aim_freetlvchain(&list); 809 810 return 0;811 }812 813 /* Client verification reply (group 1, subtype 0x20) */814 int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag)815 {816 aim_frame_t *fr;817 aim_snacid_t snacid;818 819 if (!sess || !conn)820 return -EINVAL;821 822 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+16)))823 return -ENOMEM;824 825 snacid = aim_cachesnac(sess, 0x0001, 0x0020, 0x0000, NULL, 0);826 827 aim_putsnac(&fr->data, 0x0001, 0x0020, 0x0000, snacid);828 aimbs_put16(&fr->data, 0x0010); /* md5 is always 16 bytes */829 830 if ((flag == AIM_SENDMEMBLOCK_FLAG_ISHASH) && buf && (len == 0x10)) { /* we're getting a hash */831 832 aimbs_putraw(&fr->data, buf, 0x10);833 834 } else if (buf && (len > 0)) { /* use input buffer */835 md5_state_t state;836 md5_byte_t digest[0x10];837 838 md5_init(&state);839 md5_append(&state, (const md5_byte_t *)buf, len);840 md5_finish(&state, digest);841 842 aimbs_putraw(&fr->data, (guint8 *)digest, 0x10);843 844 } else if (len == 0) { /* no length, just hash NULL (buf is optional) */845 md5_state_t state;846 guint8 nil = '\0';847 md5_byte_t digest[0x10];848 849 /*850 * These MD5 routines are stupid in that you have to have851 * at least one append. So thats why this doesn't look852 * real logical.853 */854 md5_init(&state);855 md5_append(&state, (const md5_byte_t *)&nil, 0);856 md5_finish(&state, digest);857 858 aimbs_putraw(&fr->data, (guint8 *)digest, 0x10);859 860 } else {861 862 /*863 * This data is correct for AIM 3.5.1670.864 *865 * Using these blocks is as close to "legal" as you can get866 * without using an AIM binary.867 *868 */869 if ((offset == 0x03ffffff) && (len == 0x03ffffff)) {870 871 #if 1 /* with "AnrbnrAqhfzcd" */872 aimbs_put32(&fr->data, 0x44a95d26);873 aimbs_put32(&fr->data, 0xd2490423);874 aimbs_put32(&fr->data, 0x93b8821f);875 aimbs_put32(&fr->data, 0x51c54b01);876 #else /* no filename */877 aimbs_put32(&fr->data, 0x1df8cbae);878 aimbs_put32(&fr->data, 0x5523b839);879 aimbs_put32(&fr->data, 0xa0e10db3);880 aimbs_put32(&fr->data, 0xa46d3b39);881 #endif882 883 /* len can't be 0 here anyway...884 } else if ((offset == 0x00001000) && (len == 0x00000000)) {885 886 aimbs_put32(&fr->data, 0xd41d8cd9);887 aimbs_put32(&fr->data, 0x8f00b204);888 aimbs_put32(&fr->data, 0xe9800998);889 aimbs_put32(&fr->data, 0xecf8427e);890 */891 } else892 imcb_error(sess->aux_data, "Warning: unknown hash request");893 894 }895 896 aim_tx_enqueue(sess, fr);897 725 898 726 return 0; -
protocols/oscar/ssi.c
r1444be5 r91ae87d 263 263 264 264 /** 265 * Locally find the presence flag item, and return the setting. The returned setting is a266 * bitmask of the user flags that you are visible to. See the AIM_FLAG_* #defines267 * in aim.h268 *269 * @param list A pointer to the current list of items.270 * @return Return the current visibility mask.271 */272 guint32 aim_ssi_getpresence(struct aim_ssi_item *list)273 {274 struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS);275 if (cur) {276 aim_tlvlist_t *tlvlist = cur->data;277 if (tlvlist) {278 aim_tlv_t *tlv = aim_gettlv(tlvlist, 0x00c9, 1);279 if (tlv && tlv->length)280 return aimutil_get32(tlv->value);281 }282 }283 return 0xFFFFFFFF;284 }285 286 /**287 265 * Add the given packet to the holding queue. We totally need to send SSI SNACs one at 288 266 * a time, so we have a local queue where packets get put before they are sent, and … … 345 323 346 324 /** 347 * Send SNACs necessary to remove all SSI data from the server list,348 * and then free the local copy as well.349 *350 * @param sess The oscar session.351 * @param conn The bos connection for this session.352 * @return Return 0 if no errors, otherwise return the error number.353 */354 int aim_ssi_deletelist(aim_session_t *sess, aim_conn_t *conn)355 {356 int num;357 struct aim_ssi_item *cur, **items;358 359 for (cur=sess->ssi.items, num=0; cur; cur=cur->next)360 num++;361 362 if (!(items = g_new0(struct aim_ssi_item *, num)))363 return -ENOMEM;364 365 for (cur=sess->ssi.items, num=0; cur; cur=cur->next) {366 items[num] = cur;367 num++;368 }369 370 aim_ssi_addmoddel(sess, conn, items, num, AIM_CB_SSI_DEL);371 g_free(items);372 aim_ssi_dispatch(sess, conn);373 aim_ssi_freelist(sess);374 375 return 0;376 }377 378 /**379 * This "cleans" the ssi list. It does a few things, with the intent of making380 * sure there ain't nothin' wrong with your SSI.381 * -Make sure all buddies are in a group, and all groups have the correct382 * additional data.383 * -Make sure there are no empty groups in the list. While there is nothing384 * wrong empty groups in the SSI, it's wiser to not have them.385 *386 * @param sess The oscar session.387 * @param conn The bos connection for this session.388 * @return Return 0 if no errors, otherwise return the error number.389 */390 int aim_ssi_cleanlist(aim_session_t *sess, aim_conn_t *conn)391 {392 unsigned int i;393 struct aim_ssi_item *cur, *parentgroup;394 395 /* Make sure we actually need to clean out the list */396 for (cur=sess->ssi.items, i=0; cur && !i; cur=cur->next)397 /* Any buddies directly in the master group */398 if ((cur->type == AIM_SSI_TYPE_BUDDY) && (cur->gid == 0x0000))399 i++;400 if (!i)401 return 0;402 403 /* Remove all the additional data from all groups */404 for (cur=sess->ssi.items; cur; cur=cur->next)405 if ((cur->data) && (cur->type == AIM_SSI_TYPE_GROUP)) {406 aim_freetlvchain((aim_tlvlist_t **)&cur->data);407 cur->data = NULL;408 }409 410 /* If there are buddies directly in the master group, make sure */411 /* there is a group to put them in. Any group, any group at all. */412 for (cur=sess->ssi.items; ((cur) && ((cur->type != AIM_SSI_TYPE_BUDDY) || (cur->gid != 0x0000))); cur=cur->next);413 if (!cur) {414 for (parentgroup=sess->ssi.items; ((parentgroup) && (parentgroup->type!=AIM_SSI_TYPE_GROUP) && (parentgroup->gid==0x0000)); parentgroup=parentgroup->next);415 if (!parentgroup) {416 char *newgroup;417 newgroup = (char*)g_malloc(strlen("Unknown")+1);418 strcpy(newgroup, "Unknown");419 aim_ssi_addgroups(sess, conn, &newgroup, 1);420 }421 }422 423 /* Set parentgroup equal to any arbitray group */424 for (parentgroup=sess->ssi.items; parentgroup->gid==0x0000 || parentgroup->type!=AIM_SSI_TYPE_GROUP; parentgroup=parentgroup->next);425 426 /* If there are any buddies directly in the master group, put them in a real group */427 for (cur=sess->ssi.items; cur; cur=cur->next)428 if ((cur->type == AIM_SSI_TYPE_BUDDY) && (cur->gid == 0x0000)) {429 aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_DEL);430 cur->gid = parentgroup->gid;431 aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_ADD);432 }433 434 /* Rebuild additional data for all groups */435 for (parentgroup=sess->ssi.items; parentgroup; parentgroup=parentgroup->next)436 if (parentgroup->type == AIM_SSI_TYPE_GROUP)437 aim_ssi_itemlist_rebuildgroup(&sess->ssi.items, parentgroup);438 439 /* Send a mod snac for all groups */440 i = 0;441 for (cur=sess->ssi.items; cur; cur=cur->next)442 if (cur->type == AIM_SSI_TYPE_GROUP)443 i++;444 if (i > 0) {445 /* Allocate an array of pointers to each of the groups */446 struct aim_ssi_item **groups;447 if (!(groups = g_new0(struct aim_ssi_item *, i)))448 return -ENOMEM;449 450 for (cur=sess->ssi.items, i=0; cur; cur=cur->next)451 if (cur->type == AIM_SSI_TYPE_GROUP)452 groups[i] = cur;453 454 aim_ssi_addmoddel(sess, conn, groups, i, AIM_CB_SSI_MOD);455 g_free(groups);456 }457 458 /* Send a del snac for any empty groups */459 i = 0;460 for (cur=sess->ssi.items; cur; cur=cur->next)461 if ((cur->type == AIM_SSI_TYPE_GROUP) && !(cur->data))462 i++;463 if (i > 0) {464 /* Allocate an array of pointers to each of the groups */465 struct aim_ssi_item **groups;466 if (!(groups = g_new0(struct aim_ssi_item *, i)))467 return -ENOMEM;468 469 for (cur=sess->ssi.items, i=0; cur; cur=cur->next)470 if ((cur->type == AIM_SSI_TYPE_GROUP) && !(cur->data))471 groups[i] = cur;472 473 aim_ssi_addmoddel(sess, conn, groups, i, AIM_CB_SSI_DEL);474 g_free(groups);475 }476 477 /* Begin sending SSI SNACs */478 aim_ssi_dispatch(sess, conn);479 480 return 0;481 }482 483 /**484 325 * Add an array of screen names to the given group. 485 326 * … … 999 840 } 1000 841 1001 /**1002 * Stores your permit/deny setting on the server, and starts using it.1003 *1004 * @param sess The oscar session.1005 * @param conn The bos connection for this session.1006 * @param permdeny Your permit/deny setting. Can be one of the following:1007 * 1 - Allow all users1008 * 2 - Block all users1009 * 3 - Allow only the users below1010 * 4 - Block only the users below1011 * 5 - Allow only users on my buddy list1012 * @param vismask A bitmask of the class of users to whom you want to be1013 * visible. See the AIM_FLAG_BLEH #defines in aim.h1014 * @return Return 0 if no errors, otherwise return the error number.1015 */1016 int aim_ssi_setpermdeny(aim_session_t *sess, aim_conn_t *conn, guint8 permdeny, guint32 vismask) {1017 struct aim_ssi_item *cur; //, *tmp;1018 // guint16 j;1019 aim_tlv_t *tlv;1020 1021 if (!sess || !conn)1022 return -EINVAL;1023 1024 /* Look up the permit/deny settings item */1025 cur = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, NULL, AIM_SSI_TYPE_PDINFO);1026 1027 if (cur) {1028 /* The permit/deny item exists */1029 if (cur->data && (tlv = aim_gettlv(cur->data, 0x00ca, 1))) {1030 /* Just change the value of the x00ca TLV */1031 if (tlv->length != 1) {1032 tlv->length = 1;1033 g_free(tlv->value);1034 tlv->value = (guint8 *)g_malloc(sizeof(guint8));1035 }1036 tlv->value[0] = permdeny;1037 } else {1038 /* Need to add the x00ca TLV to the TLV chain */1039 aim_addtlvtochain8((aim_tlvlist_t**)&cur->data, 0x00ca, permdeny);1040 }1041 1042 if (cur->data && (tlv = aim_gettlv(cur->data, 0x00cb, 1))) {1043 /* Just change the value of the x00cb TLV */1044 if (tlv->length != 4) {1045 tlv->length = 4;1046 g_free(tlv->value);1047 tlv->value = (guint8 *)g_malloc(4*sizeof(guint8));1048 }1049 aimutil_put32(tlv->value, vismask);1050 } else {1051 /* Need to add the x00cb TLV to the TLV chain */1052 aim_addtlvtochain32((aim_tlvlist_t**)&cur->data, 0x00cb, vismask);1053 }1054 1055 /* Send the mod item SNAC */1056 aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_MOD);1057 } else {1058 /* Need to add the permit/deny item */1059 if (!(cur = aim_ssi_itemlist_add(&sess->ssi.items, NULL, NULL, AIM_SSI_TYPE_PDINFO)))1060 return -ENOMEM;1061 aim_addtlvtochain8((aim_tlvlist_t**)&cur->data, 0x00ca, permdeny);1062 aim_addtlvtochain32((aim_tlvlist_t**)&cur->data, 0x00cb, vismask);1063 aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_ADD);1064 }1065 1066 /* Begin sending SSI SNACs */1067 aim_ssi_dispatch(sess, conn);1068 1069 return 0;1070 }1071 1072 /**1073 * Stores your setting for whether you should show up as idle or not.1074 *1075 * @param sess The oscar session.1076 * @param conn The bos connection for this session.1077 * @param presence I think it's a bitmask, but I only know what one of the bits is:1078 * 0x00000400 - Allow others to see your idle time1079 * @return Return 0 if no errors, otherwise return the error number.1080 */1081 int aim_ssi_setpresence(aim_session_t *sess, aim_conn_t *conn, guint32 presence) {1082 struct aim_ssi_item *cur; //, *tmp;1083 // guint16 j;1084 aim_tlv_t *tlv;1085 1086 if (!sess || !conn)1087 return -EINVAL;1088 1089 /* Look up the item */1090 cur = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS);1091 1092 if (cur) {1093 /* The item exists */1094 if (cur->data && (tlv = aim_gettlv(cur->data, 0x00c9, 1))) {1095 /* Just change the value of the x00c9 TLV */1096 if (tlv->length != 4) {1097 tlv->length = 4;1098 g_free(tlv->value);1099 tlv->value = (guint8 *)g_malloc(4*sizeof(guint8));1100 }1101 aimutil_put32(tlv->value, presence);1102 } else {1103 /* Need to add the x00c9 TLV to the TLV chain */1104 aim_addtlvtochain32((aim_tlvlist_t**)&cur->data, 0x00c9, presence);1105 }1106 1107 /* Send the mod item SNAC */1108 aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_MOD);1109 } else {1110 /* Need to add the item */1111 if (!(cur = aim_ssi_itemlist_add(&sess->ssi.items, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS)))1112 return -ENOMEM;1113 aim_addtlvtochain32((aim_tlvlist_t**)&cur->data, 0x00c9, presence);1114 aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_ADD);1115 }1116 1117 /* Begin sending SSI SNACs */1118 aim_ssi_dispatch(sess, conn);1119 1120 return 0;1121 }1122 1123 842 /* 1124 843 * Request SSI Rights. … … 1141 860 1142 861 return ret; 1143 }1144 1145 /*1146 * Request SSI Data.1147 *1148 * The data will only be sent if it is newer than the posted local1149 * timestamp and revision.1150 *1151 * Note that the client should never increment the revision, only the server.1152 *1153 */1154 int aim_ssi_reqdata(aim_session_t *sess, aim_conn_t *conn, time_t localstamp, guint16 localrev)1155 {1156 aim_frame_t *fr;1157 aim_snacid_t snacid;1158 1159 if (!sess || !conn)1160 return -EINVAL;1161 1162 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+2)))1163 return -ENOMEM;1164 1165 snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_REQLIST, 0x0000, NULL, 0);1166 1167 aim_putsnac(&fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_REQLIST, 0x0000, snacid);1168 aimbs_put32(&fr->data, localstamp);1169 aimbs_put16(&fr->data, localrev);1170 1171 aim_tx_enqueue(sess, fr);1172 1173 return 0;1174 862 } 1175 863 -
protocols/oscar/ssi.h
r1444be5 r91ae87d 45 45 /* These build the actual SNACs and queue them to be sent */ 46 46 int aim_ssi_reqrights(aim_session_t *sess, aim_conn_t *conn); 47 int aim_ssi_reqdata(aim_session_t *sess, aim_conn_t *conn, time_t localstamp, guint16 localrev);48 47 int aim_ssi_reqalldata(aim_session_t *sess, aim_conn_t *conn); 49 48 int aim_ssi_enable(aim_session_t *sess, aim_conn_t *conn); … … 57 56 struct aim_ssi_item *aim_ssi_itemlist_findparent(struct aim_ssi_item *list, char *sn); 58 57 int aim_ssi_getpermdeny(struct aim_ssi_item *list); 59 guint32 aim_ssi_getpresence(struct aim_ssi_item *list);60 58 61 59 /* Send packets */ 62 int aim_ssi_cleanlist(aim_session_t *sess, aim_conn_t *conn);63 60 int aim_ssi_addbuddies(aim_session_t *sess, aim_conn_t *conn, char *gn, char **sn, unsigned int num, unsigned int flags); 64 61 int aim_ssi_addmastergroup(aim_session_t *sess, aim_conn_t *conn); … … 69 66 int aim_ssi_delmastergroup(aim_session_t *sess, aim_conn_t *conn); 70 67 int aim_ssi_delgroups(aim_session_t *sess, aim_conn_t *conn, char **gn, unsigned int num); 71 int aim_ssi_deletelist(aim_session_t *sess, aim_conn_t *conn);72 68 int aim_ssi_delpord(aim_session_t *sess, aim_conn_t *conn, char **sn, unsigned int num, guint16 type); 73 int aim_ssi_setpermdeny(aim_session_t *sess, aim_conn_t *conn, guint8 permdeny, guint32 vismask);74 int aim_ssi_setpresence(aim_session_t *sess, aim_conn_t *conn, guint32 presence);75 69 int aim_ssi_auth_request(aim_session_t *sess, aim_conn_t *conn, char *uin, char *reason); 76 70 int aim_ssi_auth_reply(aim_session_t *sess, aim_conn_t *conn, char *uin, int yesno, char *reason); -
protocols/oscar/tlv.c
r1444be5 r91ae87d 223 223 224 224 /** 225 * aim_addtlvtochain_availmsg - Add a ICQ availability message to a TLV chain226 * @list: Destination chain227 * @type: TLV type to add228 * @val: Value to add229 *230 * Adds a available message to a TLV chain231 *232 */233 int aim_addtlvtochain_availmsg(aim_tlvlist_t **list, const guint16 t, const char *msg)234 {235 int ret;236 guint16 unknown_data = 0x00;237 guint8 add_data_len = 4;238 guint16 msg_len = strlen(msg);239 guint8 total_len = strlen(msg) + add_data_len;240 guint8 *data, *cur;241 guint8 alloc_len = msg_len + (3*sizeof(guint16)) + (2*sizeof(guint8));242 data = cur = g_malloc(alloc_len);243 244 cur += aimutil_put16(cur, 2);245 cur += aimutil_put8(cur, add_data_len);246 cur += aimutil_put8(cur, total_len);247 cur += aimutil_put16(cur, msg_len);248 cur += aimutil_putstr(cur, msg, msg_len);249 cur += aimutil_put16(cur, unknown_data);250 251 ret = aim_addtlvtochain_raw(list, t, alloc_len, data);252 g_free(data);253 254 return ret;255 }256 257 /**258 225 * aim_addtlvtochain_caps - Add a capability block to a TLV chain 259 226 * @list: Destination chain … … 278 245 279 246 return aim_addtlvtochain_raw(list, t, aim_bstream_curpos(&bs), buf); 280 }281 282 int aim_addtlvtochain_userinfo(aim_tlvlist_t **list, guint16 type, aim_userinfo_t *ui)283 {284 guint8 buf[1024]; /* bleh */285 aim_bstream_t bs;286 287 aim_bstream_init(&bs, buf, sizeof(buf));288 289 aim_putuserinfo(&bs, ui);290 291 return aim_addtlvtochain_raw(list, type, aim_bstream_curpos(&bs), buf);292 247 } 293 248 -
protocols/yahoo/Makefile
r1444be5 r91ae87d 13 13 14 14 # [SH] Program variables 15 objects = yahoo.o crypt.o libyahoo2.o yahoo_fn.o yahoo_httplib.o yahoo_util.o15 objects = yahoo.o libyahoo2.o yahoo_httplib.o yahoo_util.o 16 16 17 17 CFLAGS += -DSTDC_HEADERS -DHAVE_STRING_H -DHAVE_STRCHR -DHAVE_MEMCPY -DHAVE_GLIB -
protocols/yahoo/libyahoo2.c
r1444be5 r91ae87d 83 83 #include "yahoo_httplib.h" 84 84 #include "yahoo_util.h" 85 #include "yahoo_fn.h"86 85 87 86 #include "yahoo2_callbacks.h" … … 120 119 va_end(ap); 121 120 return YAHOO_CALLBACK(ext_yahoo_log) ("%s", out); 122 }123 124 int yahoo_connect(char *host, int port)125 {126 return YAHOO_CALLBACK(ext_yahoo_connect) (host, port);127 121 } 128 122 … … 375 369 */ 376 370 371 #if 0 377 372 static struct yahoo_input_data *find_input_by_id_and_webcam_user(int id, 378 373 const char *who) … … 391 386 return NULL; 392 387 } 388 #endif 393 389 394 390 static struct yahoo_input_data *find_input_by_id_and_type(int id, … … 430 426 return c; 431 427 } 432 433 extern char *yahoo_crypt(char *, char *);434 428 435 429 /* Free a buddy list */ … … 2643 2637 } 2644 2638 2639 #if 0 2645 2640 static struct yab *yahoo_yab_read(unsigned char *d, int len) 2646 2641 { … … 2793 2788 return yab; 2794 2789 } 2790 #endif 2795 2791 2796 2792 static char *yahoo_getwebcam_master(struct yahoo_input_data *yid) … … 3100 3096 } 3101 3097 3098 #if 0 3102 3099 static void yahoo_process_yab_connection(struct yahoo_input_data *yid, int over) 3103 3100 { … … 3159 3156 yd->buddies); 3160 3157 } 3158 #endif 3161 3159 3162 3160 static void yahoo_process_search_connection(struct yahoo_input_data *yid, … … 3414 3412 int over) = { 3415 3413 yahoo_process_pager_connection, yahoo_process_ft_connection, 3416 yahoo_process_yab_connection,3414 NULL, /*yahoo_process_yab_connection, */ 3417 3415 yahoo_process_webcam_master_connection, 3418 3416 yahoo_process_webcam_connection, … … 3578 3576 } 3579 3577 3578 #if 0 3580 3579 void yahoo_send_buzz(int id, const char *from, const char *who) 3581 3580 { 3582 3581 yahoo_send_im(id, from, who, "<ding>", 1, 0); 3583 3582 } 3583 #endif 3584 3584 3585 3585 void yahoo_send_im(int id, const char *from, const char *who, const char *what, … … 3723 3723 } 3724 3724 3725 #if 0 3725 3726 void yahoo_get_list(int id) 3726 3727 { … … 3742 3743 } 3743 3744 } 3745 #endif 3744 3746 3745 3747 static void _yahoo_http_connected(int id, void *fd, int error, void *data) … … 3758 3760 } 3759 3761 3762 #if 0 3760 3763 /* FIXME Get address book from address.yahoo.com instead */ 3761 3764 void yahoo_get_yab(int id) … … 3898 3901 } 3899 3902 } 3903 #endif 3900 3904 3901 3905 void yahoo_keepalive(int id) … … 3915 3919 } 3916 3920 3921 #if 0 3917 3922 void yahoo_chat_keepalive(int id) 3918 3923 { … … 3932 3937 yahoo_packet_free(pkt); 3933 3938 } 3939 #endif 3934 3940 3935 3941 void yahoo_add_buddy(int id, const char *who, const char *group, … … 4024 4030 } 4025 4031 4032 #if 0 4026 4033 void yahoo_ignore_buddy(int id, const char *who, int unignore) 4027 4034 { … … 4070 4077 yahoo_packet_free(pkt); 4071 4078 } 4079 #endif 4072 4080 4073 4081 void yahoo_change_buddy_group(int id, const char *who, const char *old_group, … … 4098 4106 } 4099 4107 4108 #if 0 4100 4109 void yahoo_group_rename(int id, const char *old_group, const char *new_group) 4101 4110 { … … 4149 4158 yahoo_packet_free(pkt); 4150 4159 } 4160 #endif 4151 4161 4152 4162 void yahoo_conference_invite(int id, const char *from, YList *who, … … 4290 4300 } 4291 4301 4302 #if 0 4292 4303 void yahoo_get_chatrooms(int id, int chatroomid) 4293 4304 { … … 4732 4743 /* Not Implemented */ 4733 4744 } 4745 #endif 4734 4746 4735 4747 /* File Transfer */ … … 4759 4771 }; 4760 4772 4773 #if 0 4761 4774 static char *yahoo_get_random(void) 4762 4775 { … … 4788 4801 return strdup(out); 4789 4802 } 4803 #endif 4790 4804 4791 4805 static int _are_same_id(const void *sfd1, const void *id) … … 5168 5182 } 5169 5183 5184 #if 0 5170 5185 void yahoo_send_file(int id, const char *who, const char *msg, 5171 5186 const char *name, unsigned long size, … … 5246 5261 yahoo_remove_active_transfer(sfd); 5247 5262 } 5263 #endif 5248 5264 5249 5265 static void yahoo_process_ft_connection(struct yahoo_input_data *yid, int over) … … 5359 5375 /* End File Transfer */ 5360 5376 5377 #if 0 5361 5378 enum yahoo_status yahoo_current_status(int id) 5362 5379 { … … 5408 5425 return NULL; 5409 5426 } 5427 #endif 5410 5428 5411 5429 const char *yahoo_get_profile_url(void) -
protocols/yahoo/yahoo.c
r1444be5 r91ae87d 570 570 } 571 571 572 void ext_yahoo_got_ignore( int id, YList *igns )573 {574 }575 576 572 void ext_yahoo_got_identities( int id, YList *ids ) 577 573 { … … 814 810 } 815 811 816 /* Because we don't want asynchronous connects in BitlBee, and because817 libyahoo doesn't seem to use this one anyway, this one is now defunct. */818 int ext_yahoo_connect(const char *host, int port)819 {820 return -1;821 }822 823 812 static void byahoo_accept_conf( void *data ) 824 813 { -
protocols/yahoo/yahoo2.h
r1444be5 r91ae87d 121 121 void yahoo_send_im(int id, const char *from, const char *who, 122 122 const char *msg, int utf8, int picture); 123 void yahoo_send_buzz(int id, const char *from, const char *who);123 // void yahoo_send_buzz(int id, const char *from, const char *who); 124 124 /* if type is true, send typing notice, else send stopped typing notice */ 125 125 void yahoo_send_typing(int id, const char *from, const char *who, -
protocols/yahoo/yahoo2_callbacks.h
r1444be5 r91ae87d 113 113 * igns - the ignore list 114 114 */ 115 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore) (int id, YList *igns);115 // void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore) (int id, YList *igns); 116 116 117 117 /* … … 678 678 * a unix file descriptor to the socket 679 679 */ 680 int YAHOO_CALLBACK_TYPE(ext_yahoo_connect) (const char *host, int port);680 // int YAHOO_CALLBACK_TYPE(ext_yahoo_connect) (const char *host, int port); 681 681 682 682 /* -
protocols/yahoo/yahoo_httplib.c
r1444be5 r91ae87d 62 62 extern enum yahoo_log_level log_level; 63 63 64 #if 0 64 65 int yahoo_tcp_readline(char *ptr, int maxlen, void *fd) 65 66 { … … 93 94 return (n); 94 95 } 96 #endif 95 97 96 98 static int url_to_host_port_path(const char *url, … … 183 185 } 184 186 187 #if 0 185 188 char *yahoo_urldecode(const char *instr) 186 189 { … … 279 282 return (str); 280 283 } 284 #endif 281 285 282 286 typedef void (*http_connected) (int id, void *fd, int error);
Note: See TracChangeset
for help on using the changeset viewer.