2
|
1 /*
|
|
2 * aim_chat.c
|
|
3 *
|
|
4 * Routines for the Chat service. Nothing works (yet).
|
|
5 *
|
|
6 */
|
|
7
|
|
8 #include "aim.h"
|
|
9
|
|
10 /*
|
|
11 * FIXME: Doesn't work.
|
|
12 *
|
|
13 */
|
|
14 u_long aim_chat_join(struct aim_conn_t *conn, const char *roomname)
|
|
15 {
|
|
16 struct command_tx_struct newpacket;
|
|
17
|
|
18 newpacket.lock = 1;
|
|
19 if (conn)
|
|
20 newpacket.conn = conn;
|
|
21 else
|
|
22 newpacket.conn = aim_getconn_type(AIM_CONN_TYPE_BOS);
|
|
23 newpacket.type = 0x0002;
|
|
24
|
|
25 newpacket.commandlen = 12+7+strlen(roomname)+6;
|
|
26 newpacket.data = (char *) malloc(newpacket.commandlen);
|
|
27 memset(newpacket.data, 0x00, newpacket.commandlen);
|
|
28
|
|
29 newpacket.data[0] = 0x00;
|
|
30 newpacket.data[1] = 0x01;
|
|
31
|
|
32 newpacket.data[2] = 0x00;
|
|
33 newpacket.data[3] = 0x04;
|
|
34
|
|
35 newpacket.data[4] = 0x00;
|
|
36 newpacket.data[5] = 0x00;
|
|
37
|
|
38 /* SNAC reqid */
|
|
39 newpacket.data[6] = (aim_snac_nextid >> 24) & 0xFF;
|
|
40 newpacket.data[7] = (aim_snac_nextid >> 16) & 0xFF;
|
|
41 newpacket.data[8] = (aim_snac_nextid >> 8) & 0xFF;
|
|
42 newpacket.data[9] = (aim_snac_nextid) & 0xFF;
|
|
43
|
|
44 newpacket.data[10] = 0x00;
|
|
45 newpacket.data[11] = 0x0e;
|
|
46 newpacket.data[12] = 0x00;
|
|
47 newpacket.data[13] = 0x01;
|
|
48 newpacket.data[14] = 0x00;
|
|
49 newpacket.data[15] = 0x0c;
|
|
50 newpacket.data[16] = 0x00;
|
|
51 newpacket.data[17] = 0x04;
|
|
52 newpacket.data[18] = strlen(roomname) & 0x00ff;
|
|
53 memcpy(&(newpacket.data[19]), roomname, strlen(roomname));
|
|
54
|
|
55 {
|
|
56 int i = 0;
|
|
57 printf("\n\n\n");
|
|
58 for (i = 0;i < newpacket.commandlen; i++)
|
|
59 printf("0x%02x ", newpacket.data[i]);
|
|
60 printf("\n\n\n");
|
|
61 }
|
|
62
|
|
63 aim_tx_enqueue(&newpacket);
|
|
64
|
|
65 {
|
|
66 struct aim_snac_t snac;
|
|
67
|
|
68 snac.id = aim_snac_nextid;
|
|
69 snac.family = 0x0001;
|
|
70 snac.type = 0x0004;
|
|
71 snac.flags = 0x0000;
|
|
72
|
|
73 snac.data = malloc(strlen(roomname));
|
|
74 memcpy(snac.data, roomname, strlen(roomname));
|
|
75
|
|
76 aim_newsnac(&snac);
|
|
77 }
|
|
78
|
|
79 return (aim_snac_nextid++);
|
|
80 }
|