comparison libpurple/protocols/oscar/family_admin.c @ 22829:ab2322195dab

Minor changes... mostly whitespace related. Also changed some functions in family_admin.c to be void instead of returning the same int every time, and fixed a tiny memleak in family_admin.c. Oh, I think there was a variable in family_icbm.c that was being redeclared inside of a block--functionally it was fine, but it could have led to confusion.
author Mark Doliner <mark@kingant.net>
date Mon, 05 May 2008 09:22:46 +0000
parents 091941836747
children 9c0ee2491ed1
comparison
equal deleted inserted replaced
22821:61e0bcbf31ab 22829:ab2322195dab
26 * 26 *
27 */ 27 */
28 28
29 #include "oscar.h" 29 #include "oscar.h"
30 30
31 /* 31 /**
32 * Subtype 0x0002 - Request a bit of account info. 32 * Subtype 0x0002 - Request a bit of account info.
33 * 33 *
34 * Info should be one of the following: 34 * Info should be one of the following:
35 * 0x0001 - Screen name formatting 35 * 0x0001 - Screen name formatting
36 * 0x0011 - Email address 36 * 0x0011 - Email address
37 * 0x0013 - Unknown 37 * 0x0013 - Unknown
38 * 38 */
39 */ 39 void
40 int
41 aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info) 40 aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info)
42 { 41 {
43 ByteStream bs; 42 ByteStream bs;
44 aim_snacid_t snacid; 43 aim_snacid_t snacid;
45 44
46 byte_stream_new(&bs, 4); 45 byte_stream_new(&bs, 4);
47 46
48 byte_stream_put16(&bs, info); 47 byte_stream_put16(&bs, info);
49 byte_stream_put16(&bs, 0x0000); 48 byte_stream_put16(&bs, 0x0000);
50 49
51 snacid = aim_cachesnac(od, 0x0007, 0x0002, 0x0000, NULL, 0); 50 snacid = aim_cachesnac(od, 0x0007, 0x0002, 0x0000, NULL, 0);
52 flap_connection_send_snac(od, conn, 0x0007, 0x0002, 0x0000, snacid, &bs); 51 flap_connection_send_snac(od, conn, 0x0007, 0x0002, 0x0000, snacid, &bs);
53 52
54 byte_stream_destroy(&bs); 53 byte_stream_destroy(&bs);
55 54 }
56 return 0; 55
57 } 56 /**
58
59 /*
60 * Subtypes 0x0003 and 0x0005 - Parse account info. 57 * Subtypes 0x0003 and 0x0005 - Parse account info.
61 * 58 *
62 * Called in reply to both an information request (subtype 0x0002) and 59 * Called in reply to both an information request (subtype 0x0002) and
63 * an information change (subtype 0x0004). 60 * an information change (subtype 0x0004).
64 * 61 */
65 */ 62 static void
66 static int
67 infochange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) 63 infochange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
68 { 64 {
69 aim_rxcallback_t userfunc; 65 aim_rxcallback_t userfunc;
70 char *url=NULL, *sn=NULL, *email=NULL; 66 char *url=NULL, *sn=NULL, *email=NULL;
71 guint16 perms, tlvcount, err=0; 67 guint16 perms, tlvcount, err=0;
110 userfunc(od, conn, frame, (snac->subtype == 0x0005) ? 1 : 0, perms, err, url, sn, email); 106 userfunc(od, conn, frame, (snac->subtype == 0x0005) ? 1 : 0, perms, err, url, sn, email);
111 107
112 g_free(sn); 108 g_free(sn);
113 g_free(url); 109 g_free(url);
114 g_free(email); 110 g_free(email);
115 111 }
116 return 1; 112
117 } 113 /**
118
119 /*
120 * Subtype 0x0004 - Set screenname formatting. 114 * Subtype 0x0004 - Set screenname formatting.
121 * 115 */
122 */ 116 void
123 int
124 aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick) 117 aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick)
125 { 118 {
126 ByteStream bs; 119 ByteStream bs;
127 aim_snacid_t snacid; 120 aim_snacid_t snacid;
128 GSList *tlvlist = NULL; 121 GSList *tlvlist = NULL;
136 129
137 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0); 130 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0);
138 flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs); 131 flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs);
139 132
140 byte_stream_destroy(&bs); 133 byte_stream_destroy(&bs);
141 134 }
142 return 0; 135
143 } 136 /**
144
145 /*
146 * Subtype 0x0004 - Change password. 137 * Subtype 0x0004 - Change password.
147 * 138 */
148 */ 139 void
149 int
150 aim_admin_changepasswd(OscarData *od, FlapConnection *conn, const char *newpw, const char *curpw) 140 aim_admin_changepasswd(OscarData *od, FlapConnection *conn, const char *newpw, const char *curpw)
151 { 141 {
152 ByteStream bs; 142 ByteStream bs;
153 GSList *tlvlist = NULL; 143 GSList *tlvlist = NULL;
154 aim_snacid_t snacid; 144 aim_snacid_t snacid;
165 aim_tlvlist_free(tlvlist); 155 aim_tlvlist_free(tlvlist);
166 156
167 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0); 157 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0);
168 flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs); 158 flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs);
169 159
170 return 0; 160 byte_stream_destroy(&bs);
171 } 161 }
172 162
173 /* 163 /**
174 * Subtype 0x0004 - Change email address. 164 * Subtype 0x0004 - Change email address.
175 * 165 */
176 */ 166 void
177 int
178 aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail) 167 aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail)
179 { 168 {
180 ByteStream bs; 169 ByteStream bs;
181 aim_snacid_t snacid; 170 aim_snacid_t snacid;
182 GSList *tlvlist = NULL; 171 GSList *tlvlist = NULL;
190 179
191 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0); 180 snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0);
192 flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs); 181 flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs);
193 182
194 byte_stream_destroy(&bs); 183 byte_stream_destroy(&bs);
195
196 return 0;
197 } 184 }
198 185
199 /* 186 /*
200 * Subtype 0x0006 - Request account confirmation. 187 * Subtype 0x0006 - Request account confirmation.
201 * 188 *
208 aim_admin_reqconfirm(OscarData *od, FlapConnection *conn) 195 aim_admin_reqconfirm(OscarData *od, FlapConnection *conn)
209 { 196 {
210 aim_genericreq_n(od, conn, 0x0007, 0x0006); 197 aim_genericreq_n(od, conn, 0x0007, 0x0006);
211 } 198 }
212 199
213 /* 200 /**
214 * Subtype 0x0007 - Account confirmation request acknowledgement. 201 * Subtype 0x0007 - Account confirmation request acknowledgement.
215 *
216 */ 202 */
217 static int 203 static int
218 accountconfirm(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) 204 accountconfirm(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
219 { 205 {
220 int ret = 0; 206 int ret = 0;
236 } 222 }
237 223
238 static int 224 static int
239 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) 225 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
240 { 226 {
241 if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) 227 if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) {
242 return infochange(od, conn, mod, frame, snac, bs); 228 infochange(od, conn, mod, frame, snac, bs);
243 else if (snac->subtype == 0x0007) 229 return 1;
230 } else if (snac->subtype == 0x0007)
244 return accountconfirm(od, conn, mod, frame, snac, bs); 231 return accountconfirm(od, conn, mod, frame, snac, bs);
245 232
246 return 0; 233 return 0;
247 } 234 }
248 235