Mercurial > pidgin.yaz
comparison libfaim/aim_rxhandlers.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 | 88f8f98de02d |
children | e18815f5a4e9 |
comparison
equal
deleted
inserted
replaced
839:8f66e00af045 | 840:595ac7759563 |
---|---|
11 | 11 |
12 /* | 12 /* |
13 * Bleck functions get called when there's no non-bleck functions | 13 * Bleck functions get called when there's no non-bleck functions |
14 * around to cleanup the mess... | 14 * around to cleanup the mess... |
15 */ | 15 */ |
16 int bleck(struct aim_session_t *sess,struct command_rx_struct *workingPtr, ...) | 16 faim_internal int bleck(struct aim_session_t *sess,struct command_rx_struct *workingPtr, ...) |
17 { | 17 { |
18 u_short family; | 18 u_short family; |
19 u_short subtype; | 19 u_short subtype; |
20 | 20 |
21 u_short maxf; | 21 u_short maxf; |
179 printf("bleck: null handler for %04x/%04x (no literal)\n",family,subtype); | 179 printf("bleck: null handler for %04x/%04x (no literal)\n",family,subtype); |
180 | 180 |
181 return 1; | 181 return 1; |
182 } | 182 } |
183 | 183 |
184 int aim_conn_addhandler(struct aim_session_t *sess, | 184 faim_export int aim_conn_addhandler(struct aim_session_t *sess, |
185 struct aim_conn_t *conn, | 185 struct aim_conn_t *conn, |
186 u_short family, | 186 u_short family, |
187 u_short type, | 187 u_short type, |
188 rxcallback_t newhandler, | 188 rxcallback_t newhandler, |
189 u_short flags) | 189 u_short flags) |
216 } | 216 } |
217 | 217 |
218 return 0; | 218 return 0; |
219 } | 219 } |
220 | 220 |
221 int aim_clearhandlers(struct aim_conn_t *conn) | 221 faim_export int aim_clearhandlers(struct aim_conn_t *conn) |
222 { | 222 { |
223 struct aim_rxcblist_t *cur,*tmp; | 223 struct aim_rxcblist_t *cur,*tmp; |
224 if (!conn) | 224 if (!conn) |
225 return -1; | 225 return -1; |
226 | 226 |
232 cur = tmp; | 232 cur = tmp; |
233 } | 233 } |
234 return 0; | 234 return 0; |
235 } | 235 } |
236 | 236 |
237 rxcallback_t aim_callhandler(struct aim_conn_t *conn, | 237 faim_internal rxcallback_t aim_callhandler(struct aim_conn_t *conn, |
238 u_short family, | 238 u_short family, |
239 u_short type) | 239 u_short type) |
240 { | 240 { |
241 struct aim_rxcblist_t *cur; | 241 struct aim_rxcblist_t *cur; |
242 | 242 |
243 if (!conn) | 243 if (!conn) |
244 return NULL; | 244 return NULL; |
256 if (type==0xffff) | 256 if (type==0xffff) |
257 return NULL; | 257 return NULL; |
258 return aim_callhandler(conn, family, 0xffff); | 258 return aim_callhandler(conn, family, 0xffff); |
259 } | 259 } |
260 | 260 |
261 int aim_callhandler_noparam(struct aim_session_t *sess, | 261 faim_internal int aim_callhandler_noparam(struct aim_session_t *sess, |
262 struct aim_conn_t *conn, | 262 struct aim_conn_t *conn, |
263 u_short family, | 263 u_short family, |
264 u_short type, | 264 u_short type, |
265 struct command_rx_struct *ptr) | 265 struct command_rx_struct *ptr) |
266 { | 266 { |
267 rxcallback_t userfunc = NULL; | 267 rxcallback_t userfunc = NULL; |
268 userfunc = aim_callhandler(conn, family, type); | 268 userfunc = aim_callhandler(conn, family, type); |
269 if (userfunc) | 269 if (userfunc) |
270 return userfunc(sess, ptr); | 270 return userfunc(sess, ptr); |
292 TODO: Clean up. | 292 TODO: Clean up. |
293 TODO: More support for mid-level handlers. | 293 TODO: More support for mid-level handlers. |
294 TODO: Allow for NULL handlers. | 294 TODO: Allow for NULL handlers. |
295 | 295 |
296 */ | 296 */ |
297 int aim_rxdispatch(struct aim_session_t *sess) | 297 faim_export int aim_rxdispatch(struct aim_session_t *sess) |
298 { | 298 { |
299 int i = 0; | 299 int i = 0; |
300 struct command_rx_struct *workingPtr = NULL; | 300 struct command_rx_struct *workingPtr = NULL; |
301 | 301 |
302 if (sess->queue_incoming == NULL) { | 302 if (sess->queue_incoming == NULL) { |
374 default: | 374 default: |
375 #if 0 | 375 #if 0 |
376 /* Old login protocol */ | 376 /* Old login protocol */ |
377 /* any user callbacks will be called from here */ | 377 /* any user callbacks will be called from here */ |
378 workingPtr->handled = aim_authparse(sess, workingPtr); | 378 workingPtr->handled = aim_authparse(sess, workingPtr); |
379 break; | |
380 #endif | 379 #endif |
380 break; | |
381 } | 381 } |
382 } | 382 } |
383 break; | 383 break; |
384 } | 384 } |
385 case AIM_CONN_TYPE_BOS: { | 385 case AIM_CONN_TYPE_BOS: { |
612 aim_purge_rxqueue(sess); | 612 aim_purge_rxqueue(sess); |
613 | 613 |
614 return 0; | 614 return 0; |
615 } | 615 } |
616 | 616 |
617 int aim_parse_msgack_middle(struct aim_session_t *sess, struct command_rx_struct *command) | 617 faim_internal int aim_parse_msgack_middle(struct aim_session_t *sess, struct command_rx_struct *command) |
618 { | 618 { |
619 rxcallback_t userfunc = NULL; | 619 rxcallback_t userfunc = NULL; |
620 char sn[MAXSNLEN]; | 620 char sn[MAXSNLEN]; |
621 unsigned short type; | 621 unsigned short type; |
622 int i = 10+8; /* skip SNAC and cookie */ | 622 int i = 10+8; /* skip SNAC and cookie */ |
628 | 628 |
629 snlen = aimutil_get8(command->data+i); | 629 snlen = aimutil_get8(command->data+i); |
630 i++; | 630 i++; |
631 | 631 |
632 memset(sn, 0, sizeof(sn)); | 632 memset(sn, 0, sizeof(sn)); |
633 strncpy(sn, command->data+i, snlen); | 633 strncpy(sn, (char *)command->data+i, snlen); |
634 | 634 |
635 if ((userfunc = aim_callhandler(command->conn, 0x0004, 0x000c))) | 635 if ((userfunc = aim_callhandler(command->conn, 0x0004, 0x000c))) |
636 ret = userfunc(sess, command, type, sn); | 636 ret = userfunc(sess, command, type, sn); |
637 | 637 |
638 return ret; | 638 return ret; |
639 } | 639 } |
640 | 640 |
641 int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command) | 641 faim_internal int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command) |
642 { | 642 { |
643 rxcallback_t userfunc = NULL; | 643 rxcallback_t userfunc = NULL; |
644 int ret = 1; | 644 int ret = 1; |
645 unsigned long newrate; | 645 unsigned long newrate; |
646 | 646 |
655 ret = userfunc(sess, command, newrate); | 655 ret = userfunc(sess, command, newrate); |
656 | 656 |
657 return ret; | 657 return ret; |
658 } | 658 } |
659 | 659 |
660 int aim_parse_evilnotify_middle(struct aim_session_t *sess, struct command_rx_struct *command) | 660 faim_internal int aim_parse_evilnotify_middle(struct aim_session_t *sess, struct command_rx_struct *command) |
661 { | 661 { |
662 rxcallback_t userfunc = NULL; | 662 rxcallback_t userfunc = NULL; |
663 int ret = 1, pos; | 663 int ret = 1, pos; |
664 char *sn = NULL; | 664 char *sn = NULL; |
665 | 665 |
680 free(sn); | 680 free(sn); |
681 | 681 |
682 return ret; | 682 return ret; |
683 } | 683 } |
684 | 684 |
685 int aim_parsemotd_middle(struct aim_session_t *sess, | 685 faim_internal int aim_parsemotd_middle(struct aim_session_t *sess, |
686 struct command_rx_struct *command, ...) | 686 struct command_rx_struct *command, ...) |
687 { | 687 { |
688 rxcallback_t userfunc = NULL; | 688 rxcallback_t userfunc = NULL; |
689 char *msg; | 689 char *msg; |
690 int ret=1; | 690 int ret=1; |
691 struct aim_tlvlist_t *tlvlist; | 691 struct aim_tlvlist_t *tlvlist; |
722 free(msg); | 722 free(msg); |
723 | 723 |
724 return ret; | 724 return ret; |
725 } | 725 } |
726 | 726 |
727 int aim_handleredirect_middle(struct aim_session_t *sess, | 727 faim_internal int aim_handleredirect_middle(struct aim_session_t *sess, |
728 struct command_rx_struct *command, ...) | 728 struct command_rx_struct *command, ...) |
729 { | 729 { |
730 struct aim_tlv_t *tmptlv = NULL; | 730 struct aim_tlv_t *tmptlv = NULL; |
731 int serviceid = 0x00; | 731 int serviceid = 0x00; |
732 char cookie[AIM_COOKIELEN]; | 732 unsigned char cookie[AIM_COOKIELEN]; |
733 char *ip = NULL; | 733 char *ip = NULL; |
734 rxcallback_t userfunc = NULL; | 734 rxcallback_t userfunc = NULL; |
735 struct aim_tlvlist_t *tlvlist; | 735 struct aim_tlvlist_t *tlvlist; |
736 int ret = 1; | 736 int ret = 1; |
737 | 737 |
789 aim_freetlvchain(&tlvlist); | 789 aim_freetlvchain(&tlvlist); |
790 | 790 |
791 return ret; | 791 return ret; |
792 } | 792 } |
793 | 793 |
794 int aim_parse_unknown(struct aim_session_t *sess, | 794 faim_internal int aim_parse_unknown(struct aim_session_t *sess, |
795 struct command_rx_struct *command, ...) | 795 struct command_rx_struct *command, ...) |
796 { | 796 { |
797 u_int i = 0; | 797 u_int i = 0; |
798 | 798 |
799 faimdprintf(1, "\nRecieved unknown packet:"); | 799 faimdprintf(1, "\nRecieved unknown packet:"); |
800 | 800 |
810 | 810 |
811 return 1; | 811 return 1; |
812 } | 812 } |
813 | 813 |
814 | 814 |
815 int aim_negchan_middle(struct aim_session_t *sess, | 815 faim_internal int aim_negchan_middle(struct aim_session_t *sess, |
816 struct command_rx_struct *command) | 816 struct command_rx_struct *command) |
817 { | 817 { |
818 struct aim_tlvlist_t *tlvlist; | 818 struct aim_tlvlist_t *tlvlist; |
819 char *msg = NULL; | 819 char *msg = NULL; |
820 unsigned short code = 0; | 820 unsigned short code = 0; |
821 struct aim_tlv_t *tmptlv; | 821 struct aim_tlv_t *tmptlv; |
845 * aim_parse_generalerrs() | 845 * aim_parse_generalerrs() |
846 * | 846 * |
847 * Middle handler for 0x0001 snac of each family. | 847 * Middle handler for 0x0001 snac of each family. |
848 * | 848 * |
849 */ | 849 */ |
850 int aim_parse_generalerrs(struct aim_session_t *sess, | 850 faim_internal int aim_parse_generalerrs(struct aim_session_t *sess, |
851 struct command_rx_struct *command, ...) | 851 struct command_rx_struct *command, ...) |
852 { | 852 { |
853 u_short family; | 853 u_short family; |
854 u_short subtype; | 854 u_short subtype; |
855 | 855 |
856 family = aimutil_get16(command->data+0); | 856 family = aimutil_get16(command->data+0); |