comparison libpurple/protocols/oscar/misc.c @ 22717:979a81468e19

All SNACs on FLAP channel 2 except in the auth family are now sent through flap_connection_send_snac() instead of flap_connection_send(). This allows them to be tallied into the rate limiting calculations and to be throttled as necessary to prevent rate limiting violations. This does fix the instantaneous disconnection seen with the addition of ICQ Status Notes support for people with many ICQ contacts with status notes on their buddy list. Unfortunately, we still request the ICQ Status Note many times per contact, so such people now may be rate limited for a significant period of time as they connect.
author Evan Schoenberg <evan.s@dreskin.net>
date Thu, 24 Apr 2008 11:10:03 +0000
parents 44b4e8bd759b
children 97ecc85b6c18
comparison
equal deleted inserted replaced
22715:80c87908ff1d 22717:979a81468e19
40 aim_genericreq_n(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype) 40 aim_genericreq_n(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype)
41 { 41 {
42 FlapFrame *frame; 42 FlapFrame *frame;
43 aim_snacid_t snacid = 0x00000000; 43 aim_snacid_t snacid = 0x00000000;
44 44
45 frame = flap_frame_new(od, 0x02, 10); 45 flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, NULL);
46
47 aim_putsnac(&frame->data, family, subtype, 0x0000, snacid);
48
49 flap_connection_send(conn, frame);
50 } 46 }
51 47
52 void 48 void
53 aim_genericreq_n_snacid(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype) 49 aim_genericreq_n_snacid(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype)
54 { 50 {
55 FlapFrame *frame; 51 FlapFrame *frame;
56 aim_snacid_t snacid; 52 aim_snacid_t snacid;
57 53
58 frame = flap_frame_new(od, 0x02, 10); 54 snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0);
59 55
60 snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0); 56 flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, NULL);
61 aim_putsnac(&frame->data, family, subtype, 0x0000, snacid);
62
63 flap_connection_send(conn, frame);
64 } 57 }
65 58
66 void 59 void
67 aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *longdata) 60 aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *longdata)
68 { 61 {
69 FlapFrame *frame; 62 ByteStream bs;
70 aim_snacid_t snacid; 63 aim_snacid_t snacid;
71 64
72 if (!longdata) 65 if (!longdata)
73 { 66 {
74 aim_genericreq_n(od, conn, family, subtype); 67 aim_genericreq_n(od, conn, family, subtype);
75 return; 68 return;
76 } 69 }
77 70
78 frame = flap_frame_new(od, 0x02, 10+4); 71 byte_stream_new(&bs, 4);
79 72
80 snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0); 73 snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0);
81 74
82 aim_putsnac(&frame->data, family, subtype, 0x0000, snacid); 75 byte_stream_put32(&bs, *longdata);
83 byte_stream_put32(&frame->data, *longdata);
84 76
85 flap_connection_send(conn, frame); 77 flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, NULL);
78
79 byte_stream_destroy(&bs);
86 } 80 }
87 81
88 void 82 void
89 aim_genericreq_s(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *shortdata) 83 aim_genericreq_s(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *shortdata)
90 { 84 {
91 FlapFrame *frame; 85 ByteStream bs;
92 aim_snacid_t snacid; 86 aim_snacid_t snacid;
93 87
94 if (!shortdata) 88 if (!shortdata)
95 { 89 {
96 aim_genericreq_n(od, conn, family, subtype); 90 aim_genericreq_n(od, conn, family, subtype);
97 return; 91 return;
98 } 92 }
99 93
100 frame = flap_frame_new(od, 0x02, 10+2); 94 byte_stream_new(&bs, 2);
101 95
102 snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0); 96 snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0);
103 97
104 aim_putsnac(&frame->data, family, subtype, 0x0000, snacid); 98 byte_stream_put16(&bs, *shortdata);
105 byte_stream_put16(&frame->data, *shortdata);
106 99
107 flap_connection_send(conn, frame); 100 flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, NULL);
101
102 byte_stream_destroy(&bs);
108 } 103 }
109 104
110 /* 105 /*
111 * Should be generic enough to handle the errors for all groups. 106 * Should be generic enough to handle the errors for all groups.
112 * 107 *