Changeset 5ebff60 for protocols/oscar/admin.c
- Timestamp:
- 2015-02-20T22:50:54Z (9 years ago)
- Branches:
- master
- Children:
- 0b9daac, 3d45471, 7733b8c
- Parents:
- af359b4
- git-author:
- Indent <please@…> (19-02-15 05:47:20)
- git-committer:
- dequis <dx@…> (20-02-15 22:50:54)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/oscar/admin.c
raf359b4 r5ebff60 28 28 len = aimbs_get16(bs); 29 29 30 if ((type == 0x0011) || (type == 0x0004)) 30 if ((type == 0x0011) || (type == 0x0004)) { 31 31 str = 1; 32 33 if (str) 34 val = (guint8 *)aimbs_getstr(bs, len); 35 else 32 } 33 34 if (str) { 35 val = (guint8 *) aimbs_getstr(bs, len); 36 } else { 36 37 val = aimbs_getraw(bs, len); 38 } 37 39 38 40 /* XXX fix so its only called once for the entire packet */ 39 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 41 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { 40 42 userfunc(sess, rx, (snac->subtype == 0x0005) ? 1 : 0, perms, type, len, val, str); 43 } 41 44 42 45 g_free(val); … … 49 52 } 50 53 51 static int accountconfirm(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 54 static int accountconfirm(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, 55 aim_bstream_t *bs) 52 56 { 53 57 aim_rxcallback_t userfunc; … … 56 60 status = aimbs_get16(bs); 57 61 58 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 62 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { 59 63 return userfunc(sess, rx, status); 64 } 60 65 61 66 return 0; … … 65 70 { 66 71 67 if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) 72 if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) { 68 73 return infochange(sess, mod, rx, snac, bs); 69 else if (snac->subtype == 0x0007)74 } else if (snac->subtype == 0x0007) { 70 75 return accountconfirm(sess, mod, rx, snac, bs); 76 } 71 77 72 78 return 0; … … 79 85 mod->version = 0x0001; 80 86 mod->toolid = AIM_TOOL_NEWWIN; 81 mod->toolversion = 0x0629; 87 mod->toolversion = 0x0629; 82 88 mod->flags = 0; 83 89 strncpy(mod->name, "admin", sizeof(mod->name)); … … 93 99 aim_snacid_t snacid; 94 100 95 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+strlen(curpw)+4+strlen(newpw)))) 96 return -ENOMEM; 101 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + strlen(curpw) + 4 + strlen(newpw)))) { 102 return -ENOMEM; 103 } 97 104 98 105 snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); … … 100 107 101 108 /* new password TLV t(0002) */ 102 aim_addtlvtochain_raw(&tl, 0x0002, strlen(newpw), (guint8 *) newpw);109 aim_addtlvtochain_raw(&tl, 0x0002, strlen(newpw), (guint8 *) newpw); 103 110 104 111 /* current password TLV t(0012) */ 105 aim_addtlvtochain_raw(&tl, 0x0012, strlen(curpw), (guint8 *) curpw);112 aim_addtlvtochain_raw(&tl, 0x0012, strlen(curpw), (guint8 *) curpw); 106 113 107 114 aim_writetlvchain(&tx->data, &tl); … … 114 121 115 122 /* 116 * Request account confirmation. 123 * Request account confirmation. 117 124 * 118 125 * This will cause an email to be sent to the address associated with … … 131 138 * The only known valid tag is 0x0011 (email address). 132 139 * 133 */ 140 */ 134 141 int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, guint16 info) 135 142 { … … 137 144 aim_snacid_t snacid; 138 145 139 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 14))) 140 return -ENOMEM; 146 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 14))) { 147 return -ENOMEM; 148 } 141 149 142 150 snacid = aim_cachesnac(sess, 0x0002, 0x0002, 0x0000, NULL, 0); … … 157 165 aim_tlvlist_t *tl = NULL; 158 166 159 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newemail)))) 160 return -ENOMEM; 167 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2 + 2 + strlen(newemail)))) { 168 return -ENOMEM; 169 } 161 170 162 171 snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); 163 172 aim_putsnac(&tx->data, 0x0007, 0x0004, 0x0000, snacid); 164 173 165 aim_addtlvtochain_raw(&tl, 0x0011, strlen(newemail), (guint8 *) newemail);166 174 aim_addtlvtochain_raw(&tl, 0x0011, strlen(newemail), (guint8 *) newemail); 175 167 176 aim_writetlvchain(&tx->data, &tl); 168 177 aim_freetlvchain(&tl); 169 178 170 179 aim_tx_enqueue(sess, tx); 171 180 … … 179 188 aim_tlvlist_t *tl = NULL; 180 189 181 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newnick)))) 182 return -ENOMEM; 190 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2 + 2 + strlen(newnick)))) { 191 return -ENOMEM; 192 } 183 193 184 194 snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); 185 195 aim_putsnac(&tx->data, 0x0007, 0x0004, 0x0000, snacid); 186 196 187 aim_addtlvtochain_raw(&tl, 0x0001, strlen(newnick), (guint8 *) newnick);188 197 aim_addtlvtochain_raw(&tl, 0x0001, strlen(newnick), (guint8 *) newnick); 198 189 199 aim_writetlvchain(&tx->data, &tl); 190 200 aim_freetlvchain(&tl); 191 192 aim_tx_enqueue(sess, tx); 193 194 195 return 0; 196 } 201 202 aim_tx_enqueue(sess, tx); 203 204 205 return 0; 206 }
Note: See TracChangeset
for help on using the changeset viewer.