comparison libpurple/protocols/oscar/family_admin.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 091941836747
comparison
equal deleted inserted replaced
22715:80c87908ff1d 22717:979a81468e19
38 * 38 *
39 */ 39 */
40 int 40 int
41 aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info) 41 aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info)
42 { 42 {
43 FlapFrame *fr; 43 ByteStream bs;
44 aim_snacid_t snacid; 44 aim_snacid_t snacid;
45 45
46 fr = flap_frame_new(od, 0x02, 14); 46 byte_stream_new(&bs, 4);
47 47
48 snacid = aim_cachesnac(od, 0x0007, 0x0002, 0x0000, NULL, 0); 48 byte_stream_put16(&bs, info);
49 aim_putsnac(&fr->data, 0x0007, 0x0002, 0x0000, snacid); 49 byte_stream_put16(&bs, 0x0000);
50 50
51 byte_stream_put16(&fr->data, info); 51 snacid = aim_cachesnac(od, 0x0007, 0x0002, 0x0000, NULL, 0);
52 byte_stream_put16(&fr->data, 0x0000); 52 flap_connection_send_snac(od, conn, 0x0007, 0x0002, 0x0000, snacid, &bs);
53 53
54 flap_connection_send(conn, fr); 54 byte_stream_destroy(&bs);
55 55
56 return 0; 56 return 0;
57 } 57 }
58 58
59 /* 59 /*
118 118
119 /* 119 /*
120 * Subtype 0x0004 - Set screenname formatting. 120 * Subtype 0x0004 - Set screenname formatting.
121 * 121 *
122 */ 122 */
123 /*
124 * Subtype 0x0004 - Set screenname formatting.
125 *
126 */
123 int 127 int
124 aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick) 128 aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick)
125 { 129 {
126 FlapFrame *fr; 130 ByteStream bs;
127 aim_snacid_t snacid; 131 aim_snacid_t snacid;
128 GSList *tlvlist = NULL; 132 GSList *tlvlist = NULL;
129 133
130 fr = flap_frame_new(od, 0x02, 10+2+2+strlen(newnick)); 134 byte_stream_new(&bs, 2+2+strlen(newnick));
135
136 aim_tlvlist_add_str(&tlvlist, 0x0001, newnick);
137
138 aim_tlvlist_write(&bs, &tlvlist);
139 aim_tlvlist_free(tlvlist);
131 140
132 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0); 141 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0);
133 aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); 142 flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs);
134 143
135 aim_tlvlist_add_str(&tlvlist, 0x0001, newnick); 144 byte_stream_destroy(&bs);
136
137 aim_tlvlist_write(&fr->data, &tlvlist);
138 aim_tlvlist_free(tlvlist);
139
140 flap_connection_send(conn, fr);
141
142 145
143 return 0; 146 return 0;
144 } 147 }
145 148
146 /* 149 /*
148 * 151 *
149 */ 152 */
150 int 153 int
151 aim_admin_changepasswd(OscarData *od, FlapConnection *conn, const char *newpw, const char *curpw) 154 aim_admin_changepasswd(OscarData *od, FlapConnection *conn, const char *newpw, const char *curpw)
152 { 155 {
153 FlapFrame *fr; 156 ByteStream bs;
154 GSList *tlvlist = NULL; 157 GSList *tlvlist = NULL;
155 aim_snacid_t snacid; 158 aim_snacid_t snacid;
156 159
157 fr = flap_frame_new(od, 0x02, 10+4+strlen(curpw)+4+strlen(newpw)); 160 byte_stream_new(&bs, 4+strlen(curpw)+4+strlen(newpw));
158
159 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0);
160 aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid);
161 161
162 /* new password TLV t(0002) */ 162 /* new password TLV t(0002) */
163 aim_tlvlist_add_str(&tlvlist, 0x0002, newpw); 163 aim_tlvlist_add_str(&tlvlist, 0x0002, newpw);
164 164
165 /* current password TLV t(0012) */ 165 /* current password TLV t(0012) */
166 aim_tlvlist_add_str(&tlvlist, 0x0012, curpw); 166 aim_tlvlist_add_str(&tlvlist, 0x0012, curpw);
167 167
168 aim_tlvlist_write(&fr->data, &tlvlist); 168 aim_tlvlist_write(&bs, &tlvlist);
169 aim_tlvlist_free(tlvlist); 169 aim_tlvlist_free(tlvlist);
170 170
171 flap_connection_send(conn, fr); 171 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0);
172 flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs);
172 173
173 return 0; 174 return 0;
174 } 175 }
175 176
176 /* 177 /*
178 * 179 *
179 */ 180 */
180 int 181 int
181 aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail) 182 aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail)
182 { 183 {
183 FlapFrame *fr; 184 ByteStream bs;
184 aim_snacid_t snacid; 185 aim_snacid_t snacid;
185 GSList *tlvlist = NULL; 186 GSList *tlvlist = NULL;
186 187
187 fr = flap_frame_new(od, 0x02, 10+2+2+strlen(newemail)); 188 byte_stream_new(&bs, 2+2+strlen(newemail));
189
190 aim_tlvlist_add_str(&tlvlist, 0x0011, newemail);
191
192 aim_tlvlist_write(&bs, &tlvlist);
193 aim_tlvlist_free(tlvlist);
188 194
189 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0); 195 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0);
190 aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); 196 flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs);
191 197
192 aim_tlvlist_add_str(&tlvlist, 0x0011, newemail); 198 byte_stream_destroy(&bs);
193
194 aim_tlvlist_write(&fr->data, &tlvlist);
195 aim_tlvlist_free(tlvlist);
196
197 flap_connection_send(conn, fr);
198 199
199 return 0; 200 return 0;
200 } 201 }
201 202
202 /* 203 /*