annotate libfaim/aim_chatnav.c @ 1197:ecdba708acc1

[gaim-migrate @ 1207] Im a moron committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Mon, 04 Dec 2000 16:25:14 +0000
parents 189b780c1e07
children 90bb83cafb9e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
68b230f8da5f [gaim-migrate @ 11]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
68b230f8da5f [gaim-migrate @ 11]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 *
68b230f8da5f [gaim-migrate @ 11]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
68b230f8da5f [gaim-migrate @ 11]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 *
68b230f8da5f [gaim-migrate @ 11]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
68b230f8da5f [gaim-migrate @ 11]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 */
68b230f8da5f [gaim-migrate @ 11]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7
283
0f14e6d8a51b [gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
8 #include <faim/aim.h>
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
9
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
10
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
11 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
12 * conn must be a chatnav connection!
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
13 */
840
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 771
diff changeset
14 faim_export unsigned long aim_chatnav_reqrights(struct aim_session_t *sess,
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 771
diff changeset
15 struct aim_conn_t *conn)
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
16 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
17 struct aim_snac_t snac;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
18
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
19 snac.id = aim_genericreq_n(sess, conn, 0x000d, 0x0002);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
20
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
21 snac.family = 0x000d;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
22 snac.type = 0x0002;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
23 snac.flags = 0x0000;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
24 snac.data = NULL;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
25
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
26 aim_newsnac(sess, &snac);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
27
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
28 return (sess->snac_nextid); /* already incremented */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
29 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
30
840
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 771
diff changeset
31 faim_export unsigned long aim_chatnav_clientready(struct aim_session_t *sess,
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 771
diff changeset
32 struct aim_conn_t *conn)
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
33 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
34 struct command_tx_struct *newpacket;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
35 int i;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
36
445
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 283
diff changeset
37 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 0x20)))
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
38 return -1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
39
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
40 newpacket->lock = 1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
41
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
42 i = aim_putsnac(newpacket->data, 0x0001, 0x0002, 0x0000, sess->snac_nextid);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
43
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
44 i+= aimutil_put16(newpacket->data+i, 0x000d);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
45 i+= aimutil_put16(newpacket->data+i, 0x0001);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
46
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
47 i+= aimutil_put16(newpacket->data+i, 0x0004);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
48 i+= aimutil_put16(newpacket->data+i, 0x0001);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
49
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
50 i+= aimutil_put16(newpacket->data+i, 0x0001);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
51 i+= aimutil_put16(newpacket->data+i, 0x0003);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
52
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
53 i+= aimutil_put16(newpacket->data+i, 0x0004);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
54 i+= aimutil_put16(newpacket->data+i, 0x0686);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
55
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
56 aim_tx_enqueue(sess, newpacket);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
57
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
58 return (sess->snac_nextid++);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
59 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
60
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
61 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
62 * Since multiple things can trigger this callback,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
63 * we must lookup the snacid to determine the original
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
64 * snac subtype that was called.
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
65 */
840
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 771
diff changeset
66 faim_internal int aim_chatnav_parse_info(struct aim_session_t *sess, struct command_rx_struct *command)
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
67 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
68 struct aim_snac_t *snac;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
69 u_long snacid;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
70 rxcallback_t userfunc;
715
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
71 int ret=1;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
72
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
73 snacid = aimutil_get32(command->data+6);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
74 snac = aim_remsnac(sess, snacid);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
75
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
76 if (!snac)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
77 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
78 printf("faim: chatnav_parse_info: received response to unknown request! (%08lx)\n", snacid);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
79 return 1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
80 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
81
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
82 if (snac->family != 0x000d)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
83 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
84 printf("faim: chatnav_parse_info: recieved response that maps to corrupt request! (fam=%04x)\n", snac->family);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
85 return 1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
86 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
87
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
88 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
89 * We now know what the original SNAC subtype was.
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
90 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
91 switch(snac->type)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
92 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
93 case 0x0002: /* request chat rights */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
94 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
95 struct aim_tlvlist_t *tlvlist;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
96 struct aim_chat_exchangeinfo *exchanges = NULL;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
97 int curexchange = 0;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
98 struct aim_tlv_t *exchangetlv;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
99 u_char maxrooms = 0;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
100 struct aim_tlvlist_t *innerlist;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
101
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
102 tlvlist = aim_readtlvchain(command->data+10, command->commandlen-10);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
103
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
104 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
105 * Type 0x0002: Maximum concurrent rooms.
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
106 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
107 if (aim_gettlv(tlvlist, 0x0002, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
108 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
109 struct aim_tlv_t *maxroomstlv;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
110 maxroomstlv = aim_gettlv(tlvlist, 0x0002, 1);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
111 maxrooms = aimutil_get8(maxroomstlv->value);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
112 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
113
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
114 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
115 * Type 0x0003: Exchange information
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
116 *
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
117 * There can be any number of these, each one
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
118 * representing another exchange.
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
119 *
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
120 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
121 curexchange = 0;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
122 while ((exchangetlv = aim_gettlv(tlvlist, 0x0003, curexchange+1)))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
123 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
124 curexchange++;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
125 exchanges = realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo));
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
126
722
26e96119d5a5 [gaim-migrate @ 732]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 715
diff changeset
127
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
128 /* exchange number */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
129 exchanges[curexchange-1].number = aimutil_get16(exchangetlv->value);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
130 innerlist = aim_readtlvchain(exchangetlv->value+2, exchangetlv->length-2);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
131
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
132 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
133 * Type 0x000d: Unknown.
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
134 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
135 if (aim_gettlv(innerlist, 0x000d, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
136 ;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
137
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
138 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
139 * Type 0x0004: Unknown
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
140 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
141 if (aim_gettlv(innerlist, 0x0004, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
142 ;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
143
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
144 /*
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
145 * Type 0x0002: Unknown
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
146 */
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
147 if (aim_gettlv(innerlist, 0x0002, 1)) {
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
148 struct aim_tlv_t *tmptlv;
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
149 unsigned short classperms = 0;
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
150
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
151 tmptlv = aim_gettlv(innerlist, 0x0002, 1);
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
152 classperms = aimutil_get16(tmptlv->value);
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
153
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
154 printf("faim: class permissions %x\n", classperms);
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
155 }
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
156
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
157 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
158 * Type 0x00c9: Unknown
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
159 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
160 if (aim_gettlv(innerlist, 0x00c9, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
161 ;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
162
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
163 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
164 * Type 0x00ca: Creation Date
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
165 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
166 if (aim_gettlv(innerlist, 0x00ca, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
167 ;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
168
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
169 /*
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
170 * Type 0x00d0: Mandatory Channels?
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
171 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
172 if (aim_gettlv(innerlist, 0x00d0, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
173 ;
2
68b230f8da5f [gaim-migrate @ 11]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
174
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
175 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
176 * Type 0x00d1: Maximum Message length
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
177 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
178 if (aim_gettlv(innerlist, 0x00d1, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
179 ;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
180
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
181 /*
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
182 * Type 0x00d2: Maximum Occupancy?
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
183 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
184 if (aim_gettlv(innerlist, 0x00d2, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
185 ;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
186
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
187 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
188 * Type 0x00d3: Exchange Name
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
189 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
190 if (aim_gettlv(innerlist, 0x00d3, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
191 exchanges[curexchange-1].name = aim_gettlv_str(innerlist, 0x00d3, 1);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
192 else
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
193 exchanges[curexchange-1].name = NULL;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
194
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
195 /*
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
196 * Type 0x00d5: Creation Permissions
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
197 *
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
198 * 0 Creation not allowed
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
199 * 1 Room creation allowed
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
200 * 2 Exchange creation allowed
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
201 *
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
202 */
771
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
203 if (aim_gettlv(innerlist, 0x00d5, 1)) {
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
204 struct aim_tlv_t *tmptlv;
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
205 unsigned char createperms = 0;
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
206
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
207 tmptlv = aim_gettlv(innerlist, 0x00d5, 1);
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
208 createperms = aimutil_get8(tmptlv->value);
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
209
72e556f6b99d [gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 722
diff changeset
210 }
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
211
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
212 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
213 * Type 0x00d6: Character Set (First Time)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
214 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
215 if (aim_gettlv(innerlist, 0x00d6, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
216 exchanges[curexchange-1].charset1 = aim_gettlv_str(innerlist, 0x00d6, 1);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
217 else
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
218 exchanges[curexchange-1].charset1 = NULL;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
219
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
220 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
221 * Type 0x00d7: Language (First Time)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
222 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
223 if (aim_gettlv(innerlist, 0x00d7, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
224 exchanges[curexchange-1].lang1 = aim_gettlv_str(innerlist, 0x00d7, 1);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
225 else
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
226 exchanges[curexchange-1].lang1 = NULL;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
227
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
228 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
229 * Type 0x00d8: Character Set (Second Time)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
230 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
231 if (aim_gettlv(innerlist, 0x00d8, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
232 exchanges[curexchange-1].charset2 = aim_gettlv_str(innerlist, 0x00d8, 1);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
233 else
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
234 exchanges[curexchange-1].charset2 = NULL;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
235
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
236 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
237 * Type 0x00d9: Language (Second Time)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
238 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
239 if (aim_gettlv(innerlist, 0x00d9, 1))
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
240 exchanges[curexchange-1].lang2 = aim_gettlv_str(innerlist, 0x00d9, 1);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
241 else
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
242 exchanges[curexchange-1].lang2 = NULL;
715
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
243
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
244 aim_freetlvchain(&innerlist);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
245 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
246
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
247 /*
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
248 * Call client.
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
249 */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
250 userfunc = aim_callhandler(command->conn, 0x000d, 0x0009);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
251 if (userfunc)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
252 ret = userfunc(sess,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
253 command,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
254 snac->type,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
255 maxrooms,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
256 curexchange,
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
257 exchanges);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
258 curexchange--;
722
26e96119d5a5 [gaim-migrate @ 732]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 715
diff changeset
259 while(curexchange >= 0)
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
260 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
261 if (exchanges[curexchange].name)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
262 free(exchanges[curexchange].name);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
263 if (exchanges[curexchange].charset1)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
264 free(exchanges[curexchange].charset1);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
265 if (exchanges[curexchange].lang1)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
266 free(exchanges[curexchange].lang1);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
267 if (exchanges[curexchange].charset2)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
268 free(exchanges[curexchange].charset2);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
269 if (exchanges[curexchange].lang2)
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
270 free(exchanges[curexchange].lang2);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
271 curexchange--;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
272 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
273 free(exchanges);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
274 aim_freetlvchain(&tlvlist);
715
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
275
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
276 break;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
277 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
278 case 0x0003: /* request exchange info */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
279 printf("faim: chatnav_parse_info: resposne to exchange info\n");
715
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
280 break;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
281 case 0x0004: /* request room info */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
282 printf("faim: chatnav_parse_info: response to room info\n");
715
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
283 break;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
284 case 0x0005: /* request more room info */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
285 printf("faim: chatnav_parse_info: response to more room info\n");
715
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
286 break;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
287 case 0x0006: /* request occupant list */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
288 printf("faim: chatnav_parse_info: response to occupant info\n");
715
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
289 break;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
290 case 0x0007: /* search for a room */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
291 printf("faim: chatnav_parse_info: search results\n");
715
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
292 break;
903
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
293 case 0x0008: { /* create room */
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
294 /*
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
295 000d 0009 0000 0000 0010
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
296
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
297 0004 0053
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
298 0004 -- exchange
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
299 0c 7a 6f6f 6f6d 7a6f 6f6f 6d34 32 cookie/name
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
300 0000 -- instance
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
301 02 -- detail level
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
302 0007 -- unknown!
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
303 006a 000c 7a 6f 6f6f 6d7a 6f6f 6f6d 3432 -- fully qualified name
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
304 00c9 0002 0011 -- flags
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
305 00ca 0004 39c0 0883 -- create time
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
306 00d1 0002 0200 -- max msg len
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
307 00d2 0002 0018 -- max occupants
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
308 00d3 000c -- name
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
309 7a6f 6f6f 6d7a 6f6f 6f6d 3432
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
310 00d5 0001 02 -- creation permission
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
311 */
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
312 struct aim_tlvlist_t *tlvlist, *innerlist;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
313 char *ck = NULL, *fqcn = NULL, *name = NULL;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
314 unsigned short exchange, instance, unknown, flags, maxmsglen, maxoccupancy;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
315 unsigned long createtime = 0;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
316 unsigned char createperms;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
317 int i, cklen;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
318 struct aim_tlv_t *bigblock, *tmp;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
319
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
320 i = 10;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
321 if (!(tlvlist = aim_readtlvchain(command->data+i, command->commandlen-i))) {
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
322 printf("faim: unable to read top tlv in create room response\n");
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
323 break;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
324 }
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
325
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
326 if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) {
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
327 printf("faim: no bigblock in top tlv in create room response\n");
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
328 aim_freetlvchain(&tlvlist);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
329 break;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
330 }
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
331 i = 0;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
332
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
333 exchange = aimutil_get16(bigblock->value+i);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
334 i += 2;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
335
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
336 cklen = aimutil_get8(bigblock->value+i);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
337 i++;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
338
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
339 ck = malloc(cklen+1);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
340 memcpy(ck, bigblock->value+i, cklen);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
341 ck[cklen] = '\0';
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
342 i += cklen;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
343
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
344 instance = aimutil_get16(bigblock->value+i);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
345 i += 2;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
346
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
347 if (aimutil_get8(bigblock->value+i) != 0x02) {
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
348 printf("faim: unknown detaillevel in create room response (0x%02x)\n", aimutil_get8(bigblock->value+i));
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
349 aim_freetlvchain(&tlvlist);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
350 free(ck);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
351 break;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
352 }
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
353 i += 1;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
354
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
355 unknown = aimutil_get16(bigblock->value+i);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
356 i += 2;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
357
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
358 if (!(innerlist = aim_readtlvchain(bigblock->value+i, bigblock->length-i))) {
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
359 printf("faim: unable to read inner tlv chain in create room response\n");
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
360 aim_freetlvchain(&tlvlist);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
361 free(ck);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
362 break;
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
363 }
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
364
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
365 if (aim_gettlv(innerlist, 0x006a, 1))
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
366 fqcn = aim_gettlv_str(innerlist, 0x006a, 1);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
367
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
368 if ((tmp = aim_gettlv(innerlist, 0x00c9, 1)))
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
369 flags = aimutil_get16(tmp->value);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
370
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
371 if ((tmp = aim_gettlv(innerlist, 0x00ca, 1)))
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
372 createtime = aimutil_get32(tmp->value);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
373
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
374 if ((tmp = aim_gettlv(innerlist, 0x00d1, 1)))
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
375 maxmsglen = aimutil_get16(tmp->value);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
376
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
377 if ((tmp = aim_gettlv(innerlist, 0x00d2, 1)))
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
378 maxoccupancy = aimutil_get16(tmp->value);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
379
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
380 if (aim_gettlv(innerlist, 0x00d3, 1))
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
381 name = aim_gettlv_str(innerlist, 0x00d3, 1);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
382
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
383 if ((tmp = aim_gettlv(innerlist, 0x00d5, 1)))
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
384 createperms = aimutil_get8(tmp->value);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
385
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
386 if ((userfunc = aim_callhandler(command->conn, 0x000d, 0x0009))) {
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
387 ret = userfunc(sess, command, snac->type, fqcn, instance, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
388 }
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
389
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
390 if (ck)
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
391 free(ck);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
392 if (name)
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
393 free(name);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
394 if (fqcn)
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
395 free(fqcn);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
396 aim_freetlvchain(&innerlist);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
397 aim_freetlvchain(&tlvlist);
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
398
715
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
399 break;
903
16492f41410d [gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 840
diff changeset
400 }
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
401 default: /* unknown */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
402 printf("faim: chatnav_parse_info: unknown request subtype (%04x)\n", snac->type);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
403 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
404
715
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
405 if (snac && snac->data)
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
406 free(snac->data);
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
407 if (snac)
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
408 free(snac);
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
409
58106806ac2b [gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 445
diff changeset
410 return ret;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
411 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
412
840
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 771
diff changeset
413 faim_export unsigned long aim_chatnav_createroom(struct aim_session_t *sess,
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 771
diff changeset
414 struct aim_conn_t *conn,
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 771
diff changeset
415 char *name,
595ac7759563 [gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 771
diff changeset
416 u_short exchange)
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
417 {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
418 struct command_tx_struct *newpacket;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
419 int i;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
420 struct aim_snac_t snac;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
421
445
e4c34ca88d9b [gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 283
diff changeset
422 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+12+strlen("invite")+strlen(name))))
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
423 return -1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
424
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
425 newpacket->lock = 1;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
426
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
427 i = aim_putsnac(newpacket->data, 0x000d, 0x0008, 0x0000, sess->snac_nextid);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
428
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
429 /* exchange */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
430 i+= aimutil_put16(newpacket->data+i, exchange);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
431
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
432 /* room cookie */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
433 i+= aimutil_put8(newpacket->data+i, strlen("invite"));
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
434 i+= aimutil_putstr(newpacket->data+i, "invite", strlen("invite"));
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
435
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
436 /* instance */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
437 i+= aimutil_put16(newpacket->data+i, 0xffff);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
438
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
439 /* detail level */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
440 i+= aimutil_put8(newpacket->data+i, 0x01);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
441
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
442 /* tlvcount */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
443 i+= aimutil_put16(newpacket->data+i, 0x0001);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
444
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
445 /* room name */
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
446 i+= aim_puttlv_str(newpacket->data+i, 0x00d3, strlen(name), name);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
447
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
448 snac.id = sess->snac_nextid;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
449 snac.family = 0x000d;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
450 snac.type = 0x0008;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
451 snac.flags = 0x0000;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
452 snac.data = NULL;
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
453
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
454 aim_newsnac(sess, &snac);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
455
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
456 aim_tx_enqueue(sess, newpacket);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
457
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
458 return (sess->snac_nextid++);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2
diff changeset
459 }