Changeset 5ebff60 for protocols/oscar/misc.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/misc.c
raf359b4 r5ebff60 7 7 * Other things... 8 8 * 9 * - Idle setting 10 * 11 * 12 */ 13 14 #include <aim.h> 15 16 /* 9 * - Idle setting 10 * 11 * 12 */ 13 14 #include <aim.h> 15 16 /* 17 17 * aim_bos_setprofile(profile) 18 18 * 19 19 * Gives BOS your profile. 20 * 20 * 21 21 */ 22 22 int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, const char *profile, const char *awaymsg, guint32 caps) 23 23 { 24 static const char defencoding[] = { "text/aolrtf; charset=\"utf-8\""};24 static const char defencoding[] = { "text/aolrtf; charset=\"utf-8\"" }; 25 25 aim_frame_t *fr; 26 26 aim_tlvlist_t *tl = NULL; … … 29 29 /* Build to packet first to get real length */ 30 30 if (profile) { 31 aim_addtlvtochain_raw(&tl, 0x0001, strlen(defencoding), (guint8 *) defencoding);32 aim_addtlvtochain_raw(&tl, 0x0002, strlen(profile), (guint8 *) profile);31 aim_addtlvtochain_raw(&tl, 0x0001, strlen(defencoding), (guint8 *) defencoding); 32 aim_addtlvtochain_raw(&tl, 0x0002, strlen(profile), (guint8 *) profile); 33 33 } 34 34 … … 43 43 if (awaymsg) { 44 44 if (strlen(awaymsg)) { 45 aim_addtlvtochain_raw(&tl, 0x0003, strlen(defencoding), (guint8 *) defencoding);46 aim_addtlvtochain_raw(&tl, 0x0004, strlen(awaymsg), (guint8 *) awaymsg);47 } else 45 aim_addtlvtochain_raw(&tl, 0x0003, strlen(defencoding), (guint8 *) defencoding); 46 aim_addtlvtochain_raw(&tl, 0x0004, strlen(awaymsg), (guint8 *) awaymsg); 47 } else { 48 48 aim_addtlvtochain_noval(&tl, 0x0004); 49 } 49 50 } 50 51 51 52 aim_addtlvtochain_caps(&tl, 0x0005, caps); 52 53 53 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_sizetlvchain(&tl)))) 54 return -ENOMEM; 54 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_sizetlvchain(&tl)))) { 55 return -ENOMEM; 56 } 55 57 56 58 snacid = aim_cachesnac(sess, 0x0002, 0x0004, 0x0000, NULL, 0); 57 59 58 60 aim_putsnac(&fr->data, 0x0002, 0x004, 0x0000, snacid); 59 61 aim_writetlvchain(&fr->data, &tl); … … 93 95 aim_snacid_t snacid = 0x00000000; 94 96 95 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10))) 96 return -ENOMEM; 97 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10))) { 98 return -ENOMEM; 99 } 97 100 98 101 aim_putsnac(&fr->data, family, subtype, 0x0000, snacid); … … 108 111 aim_snacid_t snacid; 109 112 110 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10))) 111 return -ENOMEM; 113 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10))) { 114 return -ENOMEM; 115 } 112 116 113 117 snacid = aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0); … … 124 128 aim_snacid_t snacid; 125 129 126 if (!longdata) 130 if (!longdata) { 127 131 return aim_genericreq_n(sess, conn, family, subtype); 128 129 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4))) 130 return -ENOMEM; 132 } 133 134 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4))) { 135 return -ENOMEM; 136 } 131 137 132 138 snacid = aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0); … … 145 151 aim_snacid_t snacid; 146 152 147 if (!shortdata) 153 if (!shortdata) { 148 154 return aim_genericreq_n(sess, conn, family, subtype); 149 150 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2))) 151 return -ENOMEM; 155 } 156 157 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2))) { 158 return -ENOMEM; 159 } 152 160 153 161 snacid = aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0); … … 185 193 snac2 = aim_remsnac(sess, snac->id); 186 194 187 if (aim_bstream_empty(bs)) 195 if (aim_bstream_empty(bs)) { 188 196 error = aimbs_get16(bs); 189 190 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 197 } 198 199 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { 191 200 ret = userfunc(sess, rx, error, snac2 ? snac2->data : NULL); 192 193 if (snac2) 201 } 202 203 if (snac2) { 194 204 g_free(snac2->data); 205 } 195 206 g_free(snac2); 196 207 … … 201 212 { 202 213 203 if (snac->subtype == 0x0001) 214 if (snac->subtype == 0x0001) { 204 215 return generror(sess, mod, rx, snac, bs); 205 else if ((snac->family == 0xffff) && (snac->subtype == 0xffff)) {216 } else if ((snac->family == 0xffff) && (snac->subtype == 0xffff)) { 206 217 aim_rxcallback_t userfunc; 207 218 208 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 219 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { 209 220 return userfunc(sess, rx); 221 } 210 222 } 211 223
Note: See TracChangeset
for help on using the changeset viewer.