annotate libfaim/info.c @ 1593:ec31e23aadc7

[gaim-migrate @ 1603] libfaim updates and a bug fix for bad password. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 16 Mar 2001 14:29:54 +0000
parents 1e2cc8c8bf3c
children 3fe5799b7823
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * aim_info.c
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * The functions here are responsible for requesting and parsing information-
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 * gathering SNACs.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 #define FAIM_INTERNAL
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 #include <aim.h>
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 struct aim_priv_inforeq {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 char sn[MAXSNLEN+1];
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 unsigned short infotype;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 };
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 faim_export unsigned long aim_getinfo(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 struct aim_conn_t *conn,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 const char *sn,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 unsigned short infotype)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 struct command_tx_struct *newpacket;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 struct aim_priv_inforeq privdata;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 int i = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 if (!sess || !conn || !sn)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 return 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 12+1+strlen(sn))))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 newpacket->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 i = aim_putsnac(newpacket->data, 0x0002, 0x0005, 0x0000, sess->snac_nextid);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 i += aimutil_put16(newpacket->data+i, infotype);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 i += aimutil_put8(newpacket->data+i, strlen(sn));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 i += aimutil_putstr(newpacket->data+i, sn, strlen(sn));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 newpacket->lock = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 aim_tx_enqueue(sess, newpacket);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 strncpy(privdata.sn, sn, sizeof(privdata.sn));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 privdata.infotype = infotype;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, &privdata, sizeof(struct aim_priv_inforeq));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 return sess->snac_nextid;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 faim_internal int aim_parse_locateerr(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 struct command_rx_struct *command)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 u_long snacid = 0x000000000;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 struct aim_snac_t *snac = NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 int ret = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 rxcallback_t userfunc = NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 char *dest;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 unsigned short reason = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 * Get SNAC from packet and look it up
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 * the list of unrepliedto/outstanding
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 * SNACs.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 snacid = aimutil_get32(command->data+6);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 snac = aim_remsnac(sess, snacid);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 if (!snac) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 faimdprintf(sess, 0, "locerr: got an locate-failed error on an unknown SNAC ID! (%08lx)\n", snacid);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 dest = NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 } else
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 dest = snac->data;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 reason = aimutil_get16(command->data+10);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 * Call client.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 userfunc = aim_callhandler(sess, command->conn, 0x0002, 0x0001);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81 if (userfunc)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 ret = userfunc(sess, command, dest, reason);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 else
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84 ret = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 if (snac) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 free(snac->data);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 free(snac);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 return ret;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95 * Capability blocks.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97 u_char aim_caps[8][16] = {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99 /* Buddy icon */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 /* Voice */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 /* IM image */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111 /* Chat */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115 /* Get file */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116 {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119 /* Send file */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123 /* Saves stock portfolios */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
124 {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
125 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127 /* Games */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 };
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132 faim_internal unsigned short aim_getcap(struct aim_session_t *sess, unsigned char *capblock, int buflen)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134 u_short ret = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135 int y;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 int offset = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 int identified;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 while (offset < buflen) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 identified = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 for(y=0; y < (sizeof(aim_caps)/0x10); y++) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 if (memcmp(&aim_caps[y], capblock+offset, 0x10) == 0) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 switch(y) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144 case 0: ret |= AIM_CAPS_BUDDYICON; identified++; break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 case 1: ret |= AIM_CAPS_VOICE; identified++; break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 case 2: ret |= AIM_CAPS_IMIMAGE; identified++; break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 case 3: ret |= AIM_CAPS_CHAT; identified++; break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 case 4: ret |= AIM_CAPS_GETFILE; identified++; break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 case 5: ret |= AIM_CAPS_SENDFILE; identified++; break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 case 6: ret |= AIM_CAPS_GAMES; identified++; break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 case 7: ret |= AIM_CAPS_SAVESTOCKS; identified++; break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155 if (!identified) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156 faimdprintf(sess, 0, "unknown capability!\n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157 ret |= 0xff00;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 offset += 0x10;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 return ret;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 faim_internal int aim_putcap(unsigned char *capblock, int buflen, u_short caps)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167 int offset = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169 if (!capblock)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
172 if ((caps & AIM_CAPS_BUDDYICON) && (offset < buflen)) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
173 memcpy(capblock+offset, aim_caps[0], sizeof(aim_caps[0]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174 offset += sizeof(aim_caps[1]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176 if ((caps & AIM_CAPS_VOICE) && (offset < buflen)) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 memcpy(capblock+offset, aim_caps[1], sizeof(aim_caps[1]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 offset += sizeof(aim_caps[1]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180 if ((caps & AIM_CAPS_IMIMAGE) && (offset < buflen)) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 memcpy(capblock+offset, aim_caps[2], sizeof(aim_caps[2]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 offset += sizeof(aim_caps[2]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 if ((caps & AIM_CAPS_CHAT) && (offset < buflen)) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185 memcpy(capblock+offset, aim_caps[3], sizeof(aim_caps[3]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 offset += sizeof(aim_caps[3]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 if ((caps & AIM_CAPS_GETFILE) && (offset < buflen)) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 memcpy(capblock+offset, aim_caps[4], sizeof(aim_caps[4]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 offset += sizeof(aim_caps[4]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 if ((caps & AIM_CAPS_SENDFILE) && (offset < buflen)) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 memcpy(capblock+offset, aim_caps[5], sizeof(aim_caps[5]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 offset += sizeof(aim_caps[5]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 if ((caps & AIM_CAPS_GAMES) && (offset < buflen)) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197 memcpy(capblock+offset, aim_caps[6], sizeof(aim_caps[6]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 offset += sizeof(aim_caps[6]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 if ((caps & AIM_CAPS_SAVESTOCKS) && (offset < buflen)) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 memcpy(capblock+offset, aim_caps[7], sizeof(aim_caps[7]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 offset += sizeof(aim_caps[7]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 return offset;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 * AIM is fairly regular about providing user info. This
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 * is a generic routine to extract it in its standard form.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 faim_internal int aim_extractuserinfo(struct aim_session_t *sess, unsigned char *buf, struct aim_userinfo_s *outinfo)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 int i = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 int tlvcnt = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 int curtlv = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217 int tlv1 = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 u_short curtype;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 int lastvalid;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222 if (!buf || !outinfo)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 /* Clear out old data first */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 memset(outinfo, 0x00, sizeof(struct aim_userinfo_s));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
229 * Screen name. Stored as an unterminated string prepended
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 * with an unsigned byte containing its length.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232 if (buf[i] < MAXSNLEN) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
233 memcpy(outinfo->sn, &(buf[i+1]), buf[i]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234 outinfo->sn[(int)buf[i]] = '\0';
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 } else {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 memcpy(outinfo->sn, &(buf[i+1]), MAXSNLEN-1);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237 outinfo->sn[MAXSNLEN] = '\0';
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
239 i = 1 + (int)buf[i];
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242 * Warning Level. Stored as an unsigned short.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 outinfo->warnlevel = aimutil_get16(&buf[i]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245 i += 2;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 * TLV Count. Unsigned short representing the number of
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249 * Type-Length-Value triples that follow.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 tlvcnt = aimutil_get16(&buf[i]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252 i += 2;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255 * Parse out the Type-Length-Value triples as they're found.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 while (curtlv < tlvcnt) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 lastvalid = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 curtype = aimutil_get16(&buf[i]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 switch (curtype) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 * Type = 0x0000: Invalid
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 * AOL has been trying to throw these in just to break us.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265 * They're real nice guys over there at AOL.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 * Just skip the two zero bytes and continue on. (This doesn't
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 * count towards tlvcnt!)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 case 0x0000:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 lastvalid = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 i += 2;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 * Type = 0x0001: User flags
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 * Specified as any of the following bitwise ORed together:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 * 0x0001 Trial (user less than 60days)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 * 0x0002 Unknown bit 2
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 * 0x0004 AOL Main Service user
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 * 0x0008 Unknown bit 4
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 * 0x0010 Free (AIM) user
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 * 0x0020 Away
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286 * In some odd cases, we can end up with more
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 * than one of these. We only want the first,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 * as the others may not be something we want.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291 case 0x0001:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 if (tlv1) /* use only the first */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 outinfo->flags = aimutil_get16(&buf[i+4]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 tlv1++;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 * Type = 0x0002: Member-Since date.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301 * The time/date that the user originally
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
302 * registered for the service, stored in
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 * time_t format
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305 case 0x0002:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 outinfo->membersince = aimutil_get32(&buf[i+4]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
308
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310 * Type = 0x0003: On-Since date.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
311 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312 * The time/date that the user started
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313 * their current session, stored in time_t
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 * format.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 case 0x0003:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 outinfo->onlinesince = aimutil_get32(&buf[i+4]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 * Type = 0x0004: Idle time.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323 * Number of seconds since the user
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 * actively used the service.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
326 case 0x0004:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327 outinfo->idletime = aimutil_get16(&buf[i+4]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
329
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 * Type = 0x0006: ICQ Online Status
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333 * ICQ's Away/DND/etc "enriched" status
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
334 * Some decoding of values done by Scott <darkagl@pcnet.com>
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336 case 0x0006:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337 outinfo->icqinfo.status = aimutil_get16(buf+i+2+2+2);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342 * Type = 0x000a
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 * ICQ User IP Address.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345 * Ahh, the joy of ICQ security.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347 case 0x000a:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
348 outinfo->icqinfo.ipaddr = aimutil_get32(&buf[i+4]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
349 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
350
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351 /* Type = 0x000c
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353 * random crap containing the IP address,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354 * apparently a port number, and some Other Stuff.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 case 0x000c:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358 memcpy(outinfo->icqinfo.crap, &buf[i+4], 0x25);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 * Type = 0x000d
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364 * Capability information. Not real sure of
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365 * actual decoding. See comment on aim_bos_setprofile()
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 * in aim_misc.c about the capability block, its the same.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 case 0x000d:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371 int len;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372 len = aimutil_get16(buf+i+2);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 if (!len)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 outinfo->capabilities = aim_getcap(sess, buf+i+4, len);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381 * Type = 0x000e
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 * Unknown. Always of zero length, and always only
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384 * on AOL users.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 * Ignore.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
389 case 0x000e:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
390 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393 * Type = 0x000f: Session Length. (AIM)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 * Type = 0x0010: Session Length. (AOL)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
395 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396 * The duration, in seconds, of the user's
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
397 * current session.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
398 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399 * Which TLV type this comes in depends
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400 * on the service the user is using (AIM or AOL).
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
403 case 0x000f:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
404 case 0x0010:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
405 outinfo->sessionlen = aimutil_get32(&buf[i+4]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
406 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
408 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
409 * Reaching here indicates that either AOL has
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
410 * added yet another TLV for us to deal with,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
411 * or the parsing has gone Terribly Wrong.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
412 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413 * Either way, inform the owner and attempt
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
414 * recovery.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417 default:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
419 int len,z = 0, y = 0, x = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420 char tmpstr[160];
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422 faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV:\n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
423 faimdprintf(sess, 0, "userinfo: sn =%s\n", outinfo->sn);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
424 faimdprintf(sess, 0, "userinfo: curtlv=0x%04x\n", curtlv);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
425 faimdprintf(sess, 0, "userinfo: type =0x%04x\n",aimutil_get16(&buf[i]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
426 faimdprintf(sess, 0, "userinfo: length=0x%04x\n", len = aimutil_get16(&buf[i+2]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
427 faimdprintf(sess, 0, "userinfo: data: \n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428 while (z<len)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
429 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430 x = snprintf(tmpstr, sizeof(tmpstr), "userinfo: ");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
431 for (y = 0; y < 8; y++)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
433 if (z<len)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435 snprintf(tmpstr+x, sizeof(tmpstr)-x, "%02x ", buf[i+4+z]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
436 z++;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
437 x += 3;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
438 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
439 else
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
441 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
442 faimdprintf(sess, 0, "%s\n", tmpstr);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
443 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
444 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
445 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
446 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
447 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
448 * No matter what, TLV triplets should always look like this:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
449 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
450 * u_short type;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
451 * u_short length;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
452 * u_char data[length];
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
453 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
454 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
455 if (lastvalid) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
456 i += (2 + 2 + aimutil_get16(&buf[i+2]));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
457 curtlv++;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
458 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
459 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
460
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
461 return i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
462 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
463
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
464 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
465 * Oncoming Buddy notifications contain a subset of the
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
466 * user information structure. Its close enough to run
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
467 * through aim_extractuserinfo() however.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
468 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
469 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
470 faim_internal int aim_parse_oncoming_middle(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
471 struct command_rx_struct *command)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
472 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
473 struct aim_userinfo_s userinfo;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
474 u_int i = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
475 rxcallback_t userfunc=NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
476
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
477 i = 10;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
478 i += aim_extractuserinfo(sess, command->data+i, &userinfo);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
479
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
480 userfunc = aim_callhandler(sess, command->conn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481 if (userfunc)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
482 i = userfunc(sess, command, &userinfo);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
483
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
484 return 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
485 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
486
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
487 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
488 * Offgoing Buddy notifications contain no useful
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
489 * information other than the name it applies to.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
490 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
491 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
492 faim_internal int aim_parse_offgoing_middle(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
493 struct command_rx_struct *command)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
494 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
495 char sn[MAXSNLEN+1];
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
496 u_int i = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
497 rxcallback_t userfunc=NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
498
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
499 strncpy(sn, (char *)command->data+11, (int)command->data[10]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
500 sn[(int)command->data[10]] = '\0';
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
501
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
502 userfunc = aim_callhandler(sess, command->conn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
503 if (userfunc)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
504 i = userfunc(sess, command, sn);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
505
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506 return 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
507 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
508
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
509 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510 * This parses the user info stuff out all nice and pretty then calls
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
511 * the higher-level callback (in the user app).
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
512 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
513 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
514 faim_internal int aim_parse_userinfo_middle(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
515 struct command_rx_struct *command)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
516 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
517 struct aim_userinfo_s userinfo;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
518 char *text_encoding = NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
519 char *text = NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
520 u_int i = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521 rxcallback_t userfunc=NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
522 struct aim_tlvlist_t *tlvlist;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
523 struct aim_snac_t *origsnac = NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
524 u_long snacid;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
525 struct aim_priv_inforeq *inforeq;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
526
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
527 snacid = aimutil_get32(&command->data[6]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528 origsnac = aim_remsnac(sess, snacid);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
529
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
530 if (!origsnac || !origsnac->data) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
531 faimdprintf(sess, 0, "parse_userinfo_middle: major problem: no snac stored!\n");
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
532 return 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
533 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
534
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
535 inforeq = (struct aim_priv_inforeq *)origsnac->data;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
536
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
537 switch (inforeq->infotype) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
538 case AIM_GETINFO_GENERALINFO:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539 case AIM_GETINFO_AWAYMESSAGE:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
540 i = 10;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 * extractuserinfo will give us the basic metaTLV information
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
544 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
545 i += aim_extractuserinfo(sess, command->data+i, &userinfo);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
546
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
547 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
548 * However, in this command, there's usually more TLVs following...
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
549 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
550 tlvlist = aim_readtlvchain(command->data+i, command->commandlen-i);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
551
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
552 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
553 * Depending on what informational text was requested, different
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
554 * TLVs will appear here.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
555 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
556 * Profile will be 1 and 2, away message will be 3 and 4.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
558 if (aim_gettlv(tlvlist, 0x0001, 1)) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
559 text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
560 text = aim_gettlv_str(tlvlist, 0x0002, 1);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561 } else if (aim_gettlv(tlvlist, 0x0003, 1)) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562 text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
563 text = aim_gettlv_str(tlvlist, 0x0004, 1);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
564 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
565
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
566 userfunc = aim_callhandler(sess, command->conn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
567 if (userfunc) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
568 i = userfunc(sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
569 command,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
570 &userinfo,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
571 text_encoding,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
572 text,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
573 inforeq->infotype);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
574 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
575
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
576 free(text_encoding);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
577 free(text);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
578 aim_freetlvchain(&tlvlist);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
579 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
580 default:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581 faimdprintf(sess, 0, "parse_userinfo_middle: unknown infotype in request! (0x%04x)\n", inforeq->infotype);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
582 break;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
585 if (origsnac) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
586 if (origsnac->data)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
587 free(origsnac->data);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
588 free(origsnac);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
589 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
590
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
591 return 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
592 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
593
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
594 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
595 * Inverse of aim_extractuserinfo()
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
596 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597 faim_internal int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
598 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
599 int i = 0, numtlv = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
600 struct aim_tlvlist_t *tlvlist = NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
601
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
602 if (!buf || !info)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
603 return 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
604
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
605 i += aimutil_put8(buf+i, strlen(info->sn));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
606 i += aimutil_putstr(buf+i, info->sn, strlen(info->sn));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
607
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
608 i += aimutil_put16(buf+i, info->warnlevel);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
609
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
610
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611 aim_addtlvtochain16(&tlvlist, 0x0001, info->flags);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
612 numtlv++;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
613
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
614 aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
615 numtlv++;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
616
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
617 aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
618 numtlv++;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
620 aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
621 numtlv++;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
622
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
623 #if ICQ_OSCAR_SUPPORT
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
624 if(atoi(info->sn) != 0) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
625 aim_addtlvtochain16(&tlvlist, 0x0006, info->icqinfo.status);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626 aim_addtlvtochain32(&tlvlist, 0x000a, info->icqinfo.ipaddr);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
627 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628 #endif
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
629
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
630 aim_addtlvtochain_caps(&tlvlist, 0x000d, info->capabilities);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
631 numtlv++;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
632
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
633 aim_addtlvtochain32(&tlvlist, (unsigned short)((info->flags)&AIM_FLAG_AOL?0x0010:0x000f), info->sessionlen);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
634 numtlv++;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
635
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
636 i += aimutil_put16(buf+i, numtlv); /* tlvcount */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
637 i += aim_writetlvchain(buf+i, buflen-i, &tlvlist); /* tlvs */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
638 aim_freetlvchain(&tlvlist);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
639
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640 return i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
641 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
642
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
643 faim_export int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
645 struct command_tx_struct *tx;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 int i = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
647
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648 if (!sess || !conn || !info)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649 return 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
650
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
651 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 1152)))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
654 tx->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
655
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
656 i += aimutil_put16(tx->data+i, 0x0003);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
657 i += aimutil_put16(tx->data+i, 0x000b);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
658 i += aimutil_put16(tx->data+i, 0x0000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
659 i += aimutil_put16(tx->data+i, 0x0000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
660 i += aimutil_put16(tx->data+i, 0x0000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
662 i += aim_putuserinfo(tx->data+i, tx->commandlen-i, info);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
664 tx->commandlen = i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
665 tx->lock = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
666 aim_tx_enqueue(sess, tx);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
667
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
668 return 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
669 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
670
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
671 faim_export int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
672 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
673 struct command_tx_struct *tx;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
674 int i = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
675
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
676 if (!sess || !conn || !sn)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
677 return 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
678
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
679 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10+1+strlen(sn))))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
680 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
681
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
682 tx->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
683
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
684 i += aimutil_put16(tx->data+i, 0x0003);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
685 i += aimutil_put16(tx->data+i, 0x000c);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
686 i += aimutil_put16(tx->data+i, 0x0000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
687 i += aimutil_put16(tx->data+i, 0x0000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
688 i += aimutil_put16(tx->data+i, 0x0000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
689
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
690 i += aimutil_put8(tx->data+i, strlen(sn));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
691 i += aimutil_putstr(tx->data+i, sn, strlen(sn));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
692
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
693 tx->lock = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
694 aim_tx_enqueue(sess, tx);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
695
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
696 return 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
697 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
698