Mercurial > pidgin
comparison libfaim/aim_chat.c @ 840:595ac7759563
[gaim-migrate @ 850]
lots of (mostly useless for us) libfaim changes. should help portability, but it was always portable between unices.... stupid win32ers.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 04 Sep 2000 23:37:32 +0000 |
parents | 6e318907bcce |
children | e1da6a6ec42b |
comparison
equal
deleted
inserted
replaced
839:8f66e00af045 | 840:595ac7759563 |
---|---|
5 * | 5 * |
6 */ | 6 */ |
7 | 7 |
8 #include <faim/aim.h> | 8 #include <faim/aim.h> |
9 | 9 |
10 char *aim_chat_getname(struct aim_conn_t *conn) | 10 faim_export char *aim_chat_getname(struct aim_conn_t *conn) |
11 { | 11 { |
12 if (!conn) | 12 if (!conn) |
13 return NULL; | 13 return NULL; |
14 if (conn->type != AIM_CONN_TYPE_CHAT) | 14 if (conn->type != AIM_CONN_TYPE_CHAT) |
15 return NULL; | 15 return NULL; |
16 | 16 |
17 return (char *)conn->priv; /* yuck ! */ | 17 return (char *)conn->priv; /* yuck ! */ |
18 } | 18 } |
19 | 19 |
20 struct aim_conn_t *aim_chat_getconn(struct aim_session_t *sess, char *name) | 20 faim_export struct aim_conn_t *aim_chat_getconn(struct aim_session_t *sess, char *name) |
21 { | 21 { |
22 struct aim_conn_t *cur; | 22 struct aim_conn_t *cur; |
23 | 23 |
24 faim_mutex_lock(&sess->connlistlock); | 24 faim_mutex_lock(&sess->connlistlock); |
25 for (cur = sess->connlist; cur; cur = cur->next) { | 25 for (cur = sess->connlist; cur; cur = cur->next) { |
31 faim_mutex_unlock(&sess->connlistlock); | 31 faim_mutex_unlock(&sess->connlistlock); |
32 | 32 |
33 return cur; | 33 return cur; |
34 } | 34 } |
35 | 35 |
36 int aim_chat_attachname(struct aim_conn_t *conn, char *roomname) | 36 faim_export int aim_chat_attachname(struct aim_conn_t *conn, char *roomname) |
37 { | 37 { |
38 if (!conn || !roomname) | 38 if (!conn || !roomname) |
39 return -1; | 39 return -1; |
40 | 40 |
41 conn->priv = malloc(strlen(roomname)+1); | 41 conn->priv = malloc(strlen(roomname)+1); |
42 strcpy(conn->priv, roomname); | 42 strcpy(conn->priv, roomname); |
43 | 43 |
44 return 0; | 44 return 0; |
45 } | 45 } |
46 | 46 |
47 u_long aim_chat_send_im(struct aim_session_t *sess, | 47 faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess, |
48 struct aim_conn_t *conn, | 48 struct aim_conn_t *conn, |
49 char *msg) | 49 char *msg) |
50 { | 50 { |
51 | 51 |
52 int curbyte,i; | 52 int curbyte,i; |
53 struct command_tx_struct *newpacket; | 53 struct command_tx_struct *newpacket; |
54 | 54 |
119 * basically a Service Request for family 0x000e, | 119 * basically a Service Request for family 0x000e, |
120 * with a little added on to specify the exchange | 120 * with a little added on to specify the exchange |
121 * and room name. | 121 * and room name. |
122 * | 122 * |
123 */ | 123 */ |
124 u_long aim_chat_join(struct aim_session_t *sess, | 124 faim_export unsigned long aim_chat_join(struct aim_session_t *sess, |
125 struct aim_conn_t *conn, | 125 struct aim_conn_t *conn, |
126 u_short exchange, | 126 u_short exchange, |
127 const char *roomname) | 127 const char *roomname) |
128 { | 128 { |
129 struct command_tx_struct *newpacket; | 129 struct command_tx_struct *newpacket; |
130 int i; | 130 int i; |
131 | 131 |
132 if (!sess || !conn || !roomname) | 132 if (!sess || !conn || !roomname) |
186 | 186 |
187 #endif | 187 #endif |
188 return (sess->snac_nextid++); | 188 return (sess->snac_nextid++); |
189 } | 189 } |
190 | 190 |
191 int aim_chat_readroominfo(u_char *buf, struct aim_chat_roominfo *outinfo) | 191 faim_internal int aim_chat_readroominfo(u_char *buf, struct aim_chat_roominfo *outinfo) |
192 { | 192 { |
193 int namelen = 0; | 193 int namelen = 0; |
194 int i = 0; | 194 int i = 0; |
195 | 195 |
196 if (!buf || !outinfo) | 196 if (!buf || !outinfo) |
209 | 209 |
210 outinfo->instance = aimutil_get16(buf+i); | 210 outinfo->instance = aimutil_get16(buf+i); |
211 i += 2; | 211 i += 2; |
212 | 212 |
213 return i; | 213 return i; |
214 }; | 214 } |
215 | 215 |
216 | 216 |
217 /* | 217 /* |
218 * General room information. Lots of stuff. | 218 * General room information. Lots of stuff. |
219 * | 219 * |
221 * them to any of the 'Unknown's: | 221 * them to any of the 'Unknown's: |
222 * - Language (English) | 222 * - Language (English) |
223 * | 223 * |
224 * SNAC 000e/0002 | 224 * SNAC 000e/0002 |
225 */ | 225 */ |
226 int aim_chat_parse_infoupdate(struct aim_session_t *sess, | 226 faim_internal int aim_chat_parse_infoupdate(struct aim_session_t *sess, |
227 struct command_rx_struct *command) | 227 struct command_rx_struct *command) |
228 { | 228 { |
229 struct aim_userinfo_s *userinfo = NULL; | 229 struct aim_userinfo_s *userinfo = NULL; |
230 rxcallback_t userfunc=NULL; | 230 rxcallback_t userfunc=NULL; |
231 int ret = 1, i = 0; | 231 int ret = 1, i = 0; |
232 int usercount = 0; | 232 int usercount = 0; |
356 aim_freetlvchain(&tlvlist); | 356 aim_freetlvchain(&tlvlist); |
357 | 357 |
358 return ret; | 358 return ret; |
359 } | 359 } |
360 | 360 |
361 int aim_chat_parse_joined(struct aim_session_t *sess, | 361 faim_internal int aim_chat_parse_joined(struct aim_session_t *sess, |
362 struct command_rx_struct *command) | 362 struct command_rx_struct *command) |
363 { | 363 { |
364 struct aim_userinfo_s *userinfo = NULL; | 364 struct aim_userinfo_s *userinfo = NULL; |
365 rxcallback_t userfunc=NULL; | 365 rxcallback_t userfunc=NULL; |
366 int i = 10, curcount = 0, ret = 1; | 366 int i = 10, curcount = 0, ret = 1; |
367 | 367 |
382 free(userinfo); | 382 free(userinfo); |
383 | 383 |
384 return ret; | 384 return ret; |
385 } | 385 } |
386 | 386 |
387 int aim_chat_parse_leave(struct aim_session_t *sess, | 387 faim_internal int aim_chat_parse_leave(struct aim_session_t *sess, |
388 struct command_rx_struct *command) | 388 struct command_rx_struct *command) |
389 { | 389 { |
390 | 390 |
391 struct aim_userinfo_s *userinfo = NULL; | 391 struct aim_userinfo_s *userinfo = NULL; |
392 rxcallback_t userfunc=NULL; | 392 rxcallback_t userfunc=NULL; |
393 int i = 10, curcount = 0, ret = 1; | 393 int i = 10, curcount = 0, ret = 1; |
414 /* | 414 /* |
415 * We could probably include this in the normal ICBM parsing | 415 * We could probably include this in the normal ICBM parsing |
416 * code as channel 0x0003, however, since only the start | 416 * code as channel 0x0003, however, since only the start |
417 * would be the same, we might as well do it here. | 417 * would be the same, we might as well do it here. |
418 */ | 418 */ |
419 int aim_chat_parse_incoming(struct aim_session_t *sess, | 419 faim_internal int aim_chat_parse_incoming(struct aim_session_t *sess, |
420 struct command_rx_struct *command) | 420 struct command_rx_struct *command) |
421 { | 421 { |
422 struct aim_userinfo_s userinfo; | 422 struct aim_userinfo_s userinfo; |
423 rxcallback_t userfunc=NULL; | 423 rxcallback_t userfunc=NULL; |
424 int ret = 1, i = 0, z = 0; | 424 int ret = 1, i = 0, z = 0; |
425 u_char cookie[8]; | 425 u_char cookie[8]; |
509 aim_freetlvchain(&outerlist); | 509 aim_freetlvchain(&outerlist); |
510 | 510 |
511 return ret; | 511 return ret; |
512 } | 512 } |
513 | 513 |
514 u_long aim_chat_clientready(struct aim_session_t *sess, | 514 faim_export unsigned long aim_chat_clientready(struct aim_session_t *sess, |
515 struct aim_conn_t *conn) | 515 struct aim_conn_t *conn) |
516 { | 516 { |
517 struct command_tx_struct *newpacket; | 517 struct command_tx_struct *newpacket; |
518 int i; | 518 int i; |
519 | 519 |
520 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 0x20))) | 520 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 0x20))) |
540 aim_tx_enqueue(sess, newpacket); | 540 aim_tx_enqueue(sess, newpacket); |
541 | 541 |
542 return (sess->snac_nextid++); | 542 return (sess->snac_nextid++); |
543 } | 543 } |
544 | 544 |
545 int aim_chat_leaveroom(struct aim_session_t *sess, char *name) | 545 faim_export int aim_chat_leaveroom(struct aim_session_t *sess, char *name) |
546 { | 546 { |
547 struct aim_conn_t *conn; | 547 struct aim_conn_t *conn; |
548 | 548 |
549 if ((conn = aim_chat_getconn(sess, name))) | 549 if ((conn = aim_chat_getconn(sess, name))) |
550 aim_conn_kill(sess, &conn); | 550 aim_conn_kill(sess, &conn); |
555 } | 555 } |
556 | 556 |
557 /* | 557 /* |
558 * conn must be a BOS connection! | 558 * conn must be a BOS connection! |
559 */ | 559 */ |
560 u_long aim_chat_invite(struct aim_session_t *sess, | 560 faim_export unsigned long aim_chat_invite(struct aim_session_t *sess, |
561 struct aim_conn_t *conn, | 561 struct aim_conn_t *conn, |
562 char *sn, | 562 char *sn, |
563 char *msg, | 563 char *msg, |
564 u_short exchange, | 564 u_short exchange, |
565 char *roomname, | 565 char *roomname, |
566 u_short instance) | 566 u_short instance) |
567 { | 567 { |
568 struct command_tx_struct *newpacket; | 568 struct command_tx_struct *newpacket; |
569 int i,curbyte=0; | 569 int i,curbyte=0; |
570 | 570 |
571 if (!sess || !conn || !sn || !msg || !roomname) | 571 if (!sess || !conn || !sn || !msg || !roomname) |