Mercurial > pidgin
comparison src/protocols/oscar/family_chat.c @ 13239:f260d319bbbc
[gaim-migrate @ 15605]
Renaming a bunch of structs and typedefs to use the same naming
scheme as the rest of Gaim
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 12 Feb 2006 16:02:05 +0000 |
parents | f2431a7e33aa |
children | 87a7c3077c19 |
comparison
equal
deleted
inserted
replaced
13238:1e855032d7bc | 13239:f260d319bbbc |
---|---|
32 guint16 exchange; | 32 guint16 exchange; |
33 char *name; | 33 char *name; |
34 guint16 instance; | 34 guint16 instance; |
35 }; | 35 }; |
36 | 36 |
37 faim_internal void aim_conn_kill_chat(aim_session_t *sess, aim_conn_t *conn) | 37 faim_internal void aim_conn_kill_chat(OscarSession *sess, OscarConnection *conn) |
38 { | 38 { |
39 struct chatconnpriv *ccp = (struct chatconnpriv *)conn->internal; | 39 struct chatconnpriv *ccp = (struct chatconnpriv *)conn->internal; |
40 | 40 |
41 if (ccp) | 41 if (ccp) |
42 free(ccp->name); | 42 free(ccp->name); |
43 free(ccp); | 43 free(ccp); |
44 | 44 |
45 return; | 45 return; |
46 } | 46 } |
47 | 47 |
48 faim_export char *aim_chat_getname(aim_conn_t *conn) | 48 faim_export char *aim_chat_getname(OscarConnection *conn) |
49 { | 49 { |
50 struct chatconnpriv *ccp; | 50 struct chatconnpriv *ccp; |
51 | 51 |
52 if (!conn) | 52 if (!conn) |
53 return NULL; | 53 return NULL; |
59 | 59 |
60 return ccp->name; | 60 return ccp->name; |
61 } | 61 } |
62 | 62 |
63 /* XXX get this into conn.c -- evil!! */ | 63 /* XXX get this into conn.c -- evil!! */ |
64 faim_export aim_conn_t *aim_chat_getconn(aim_session_t *sess, const char *name) | 64 faim_export OscarConnection *aim_chat_getconn(OscarSession *sess, const char *name) |
65 { | 65 { |
66 aim_conn_t *cur; | 66 OscarConnection *cur; |
67 | 67 |
68 for (cur = sess->connlist; cur; cur = cur->next) { | 68 for (cur = sess->connlist; cur; cur = cur->next) { |
69 struct chatconnpriv *ccp = (struct chatconnpriv *)cur->internal; | 69 struct chatconnpriv *ccp = (struct chatconnpriv *)cur->internal; |
70 | 70 |
71 if (cur->type != AIM_CONN_TYPE_CHAT) | 71 if (cur->type != AIM_CONN_TYPE_CHAT) |
80 } | 80 } |
81 | 81 |
82 return cur; | 82 return cur; |
83 } | 83 } |
84 | 84 |
85 faim_export int aim_chat_attachname(aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance) | 85 faim_export int aim_chat_attachname(OscarConnection *conn, guint16 exchange, const char *roomname, guint16 instance) |
86 { | 86 { |
87 struct chatconnpriv *ccp; | 87 struct chatconnpriv *ccp; |
88 | 88 |
89 if (!conn || !roomname) | 89 if (!conn || !roomname) |
90 return -EINVAL; | 90 return -EINVAL; |
102 conn->internal = (void *)ccp; | 102 conn->internal = (void *)ccp; |
103 | 103 |
104 return 0; | 104 return 0; |
105 } | 105 } |
106 | 106 |
107 faim_internal int aim_chat_readroominfo(aim_bstream_t *bs, struct aim_chat_roominfo *outinfo) | 107 faim_internal int aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo) |
108 { | 108 { |
109 int namelen; | 109 int namelen; |
110 | 110 |
111 if (!bs || !outinfo) | 111 if (!bs || !outinfo) |
112 return 0; | 112 return 0; |
117 outinfo->instance = aimbs_get16(bs); | 117 outinfo->instance = aimbs_get16(bs); |
118 | 118 |
119 return 0; | 119 return 0; |
120 } | 120 } |
121 | 121 |
122 faim_export int aim_chat_leaveroom(aim_session_t *sess, const char *name) | 122 faim_export int aim_chat_leaveroom(OscarSession *sess, const char *name) |
123 { | 123 { |
124 aim_conn_t *conn; | 124 OscarConnection *conn; |
125 | 125 |
126 if (!(conn = aim_chat_getconn(sess, name))) | 126 if (!(conn = aim_chat_getconn(sess, name))) |
127 return -ENOENT; | 127 return -ENOENT; |
128 | 128 |
129 aim_conn_close(conn); | 129 aim_conn_close(conn); |
137 * Values I know are in here but I haven't attached | 137 * Values I know are in here but I haven't attached |
138 * them to any of the 'Unknown's: | 138 * them to any of the 'Unknown's: |
139 * - Language (English) | 139 * - Language (English) |
140 * | 140 * |
141 */ | 141 */ |
142 static int infoupdate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | 142 static int infoupdate(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) |
143 { | 143 { |
144 aim_userinfo_t *userinfo = NULL; | 144 aim_userinfo_t *userinfo = NULL; |
145 aim_rxcallback_t userfunc; | 145 aim_rxcallback_t userfunc; |
146 int ret = 0; | 146 int ret = 0; |
147 int usercount = 0; | 147 int usercount = 0; |
188 * Type 0x0073: Occupant list. | 188 * Type 0x0073: Occupant list. |
189 */ | 189 */ |
190 if (aim_tlv_gettlv(tlvlist, 0x0073, 1)) { | 190 if (aim_tlv_gettlv(tlvlist, 0x0073, 1)) { |
191 int curoccupant = 0; | 191 int curoccupant = 0; |
192 aim_tlv_t *tmptlv; | 192 aim_tlv_t *tmptlv; |
193 aim_bstream_t occbs; | 193 ByteStream occbs; |
194 | 194 |
195 tmptlv = aim_tlv_gettlv(tlvlist, 0x0073, 1); | 195 tmptlv = aim_tlv_gettlv(tlvlist, 0x0073, 1); |
196 | 196 |
197 /* Allocate enough userinfo structs for all occupants */ | 197 /* Allocate enough userinfo structs for all occupants */ |
198 userinfo = calloc(usercount, sizeof(aim_userinfo_t)); | 198 userinfo = calloc(usercount, sizeof(aim_userinfo_t)); |
312 | 312 |
313 return ret; | 313 return ret; |
314 } | 314 } |
315 | 315 |
316 /* Subtypes 0x0003 and 0x0004 */ | 316 /* Subtypes 0x0003 and 0x0004 */ |
317 static int userlistchange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | 317 static int userlistchange(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) |
318 { | 318 { |
319 aim_userinfo_t *userinfo = NULL; | 319 aim_userinfo_t *userinfo = NULL; |
320 aim_rxcallback_t userfunc; | 320 aim_rxcallback_t userfunc; |
321 int curcount = 0, ret = 0; | 321 int curcount = 0, ret = 0; |
322 | 322 |
345 * (Note that WinAIM does not honor this, | 345 * (Note that WinAIM does not honor this, |
346 * and displays the message as normal.) | 346 * and displays the message as normal.) |
347 * | 347 * |
348 * XXX convert this to use tlvchains | 348 * XXX convert this to use tlvchains |
349 */ | 349 */ |
350 faim_export int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language) | 350 faim_export int aim_chat_send_im(OscarSession *sess, OscarConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language) |
351 { | 351 { |
352 int i; | 352 int i; |
353 aim_frame_t *fr; | 353 FlapFrame *fr; |
354 aim_msgcookie_t *cookie; | 354 IcbmCookie *cookie; |
355 aim_snacid_t snacid; | 355 aim_snacid_t snacid; |
356 guint8 ckstr[8]; | 356 guint8 ckstr[8]; |
357 aim_tlvlist_t *otl = NULL, *itl = NULL; | 357 aim_tlvlist_t *otl = NULL, *itl = NULL; |
358 | 358 |
359 if (!sess || !conn || !msg || (msglen <= 0)) | 359 if (!sess || !conn || !msg || (msglen <= 0)) |
459 * message tlv | 459 * message tlv |
460 * message string | 460 * message string |
461 * possibly others | 461 * possibly others |
462 * | 462 * |
463 */ | 463 */ |
464 static int incomingim_ch3(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | 464 static int incomingim_ch3(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) |
465 { | 465 { |
466 int ret = 0, i; | 466 int ret = 0, i; |
467 aim_rxcallback_t userfunc; | 467 aim_rxcallback_t userfunc; |
468 aim_userinfo_t userinfo; | 468 aim_userinfo_t userinfo; |
469 guint8 cookie[8]; | 469 guint8 cookie[8]; |
470 guint16 channel; | 470 guint16 channel; |
471 aim_tlvlist_t *otl; | 471 aim_tlvlist_t *otl; |
472 char *msg = NULL; | 472 char *msg = NULL; |
473 int len = 0; | 473 int len = 0; |
474 char *encoding = NULL, *language = NULL; | 474 char *encoding = NULL, *language = NULL; |
475 aim_msgcookie_t *ck; | 475 IcbmCookie *ck; |
476 | 476 |
477 memset(&userinfo, 0, sizeof(aim_userinfo_t)); | 477 memset(&userinfo, 0, sizeof(aim_userinfo_t)); |
478 | 478 |
479 /* | 479 /* |
480 * Read ICBM Cookie. | 480 * Read ICBM Cookie. |
508 /* | 508 /* |
509 * Type 0x0003: Source User Information | 509 * Type 0x0003: Source User Information |
510 */ | 510 */ |
511 if (aim_tlv_gettlv(otl, 0x0003, 1)) { | 511 if (aim_tlv_gettlv(otl, 0x0003, 1)) { |
512 aim_tlv_t *userinfotlv; | 512 aim_tlv_t *userinfotlv; |
513 aim_bstream_t tbs; | 513 ByteStream tbs; |
514 | 514 |
515 userinfotlv = aim_tlv_gettlv(otl, 0x0003, 1); | 515 userinfotlv = aim_tlv_gettlv(otl, 0x0003, 1); |
516 | 516 |
517 aim_bstream_init(&tbs, userinfotlv->value, userinfotlv->length); | 517 aim_bstream_init(&tbs, userinfotlv->value, userinfotlv->length); |
518 aim_info_extract(sess, &tbs, &userinfo); | 518 aim_info_extract(sess, &tbs, &userinfo); |
532 * Type 0x0005: Message Block. Conains more TLVs. | 532 * Type 0x0005: Message Block. Conains more TLVs. |
533 */ | 533 */ |
534 if (aim_tlv_gettlv(otl, 0x0005, 1)) { | 534 if (aim_tlv_gettlv(otl, 0x0005, 1)) { |
535 aim_tlvlist_t *itl; | 535 aim_tlvlist_t *itl; |
536 aim_tlv_t *msgblock; | 536 aim_tlv_t *msgblock; |
537 aim_bstream_t tbs; | 537 ByteStream tbs; |
538 | 538 |
539 msgblock = aim_tlv_gettlv(otl, 0x0005, 1); | 539 msgblock = aim_tlv_gettlv(otl, 0x0005, 1); |
540 aim_bstream_init(&tbs, msgblock->value, msgblock->length); | 540 aim_bstream_init(&tbs, msgblock->value, msgblock->length); |
541 itl = aim_tlvlist_read(&tbs); | 541 itl = aim_tlvlist_read(&tbs); |
542 | 542 |
571 aim_tlvlist_free(&otl); | 571 aim_tlvlist_free(&otl); |
572 | 572 |
573 return ret; | 573 return ret; |
574 } | 574 } |
575 | 575 |
576 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | 576 static int snachandler(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) |
577 { | 577 { |
578 | 578 |
579 if (snac->subtype == 0x0002) | 579 if (snac->subtype == 0x0002) |
580 return infoupdate(sess, mod, rx, snac, bs); | 580 return infoupdate(sess, mod, rx, snac, bs); |
581 else if ((snac->subtype == 0x0003) || (snac->subtype == 0x0004)) | 581 else if ((snac->subtype == 0x0003) || (snac->subtype == 0x0004)) |
584 return incomingim_ch3(sess, mod, rx, snac, bs); | 584 return incomingim_ch3(sess, mod, rx, snac, bs); |
585 | 585 |
586 return 0; | 586 return 0; |
587 } | 587 } |
588 | 588 |
589 faim_internal int chat_modfirst(aim_session_t *sess, aim_module_t *mod) | 589 faim_internal int chat_modfirst(OscarSession *sess, aim_module_t *mod) |
590 { | 590 { |
591 | 591 |
592 mod->family = 0x000e; | 592 mod->family = 0x000e; |
593 mod->version = 0x0001; | 593 mod->version = 0x0001; |
594 mod->toolid = 0x0010; | 594 mod->toolid = 0x0010; |