2
|
1
|
|
2 /*
|
|
3 * aim_search.c
|
|
4 *
|
|
5 * TODO: Add aim_usersearch_name()
|
|
6 *
|
|
7 */
|
|
8
|
|
9 #include <aim.h>
|
|
10
|
|
11 u_long aim_usersearch_address(struct aim_conn_t *conn, char *address)
|
|
12 {
|
|
13 struct command_tx_struct newpacket;
|
|
14
|
|
15 if (!address)
|
|
16 return -1;
|
|
17
|
|
18 newpacket.lock = 1;
|
|
19
|
|
20 if (conn)
|
|
21 newpacket.conn = conn;
|
|
22 else
|
|
23 newpacket.conn = aim_getconn_type(AIM_CONN_TYPE_BOS);
|
|
24
|
|
25 newpacket.type = 0x0002;
|
|
26
|
|
27 newpacket.commandlen = 10 + strlen(address);
|
|
28 newpacket.data = (char *) malloc(newpacket.commandlen);
|
|
29
|
|
30 newpacket.data[0] = 0x00;
|
|
31 newpacket.data[1] = 0x0a;
|
|
32 newpacket.data[2] = 0x00;
|
|
33 newpacket.data[3] = 0x02;
|
|
34 newpacket.data[4] = 0x00;
|
|
35 newpacket.data[5] = 0x00;
|
|
36
|
|
37 /* SNAC reqid */
|
|
38 newpacket.data[6] = (aim_snac_nextid >> 24) & 0xFF;
|
|
39 newpacket.data[7] = (aim_snac_nextid >> 16) & 0xFF;
|
|
40 newpacket.data[8] = (aim_snac_nextid >> 8) & 0xFF;
|
|
41 newpacket.data[9] = (aim_snac_nextid) & 0xFF;
|
|
42
|
|
43 memcpy(&(newpacket.data[10]), address, strlen(address));
|
|
44
|
|
45 aim_tx_enqueue(&newpacket);
|
|
46
|
|
47 {
|
|
48 struct aim_snac_t snac;
|
|
49
|
|
50 snac.id = aim_snac_nextid;
|
|
51 snac.family = 0x000a;
|
|
52 snac.type = 0x0002;
|
|
53 snac.flags = 0x0000;
|
|
54
|
|
55 snac.data = malloc(strlen(address)+1);
|
|
56 memcpy(snac.data, address, strlen(address)+1);
|
|
57
|
|
58 aim_newsnac(&snac);
|
|
59 }
|
|
60
|
|
61 return (aim_snac_nextid++);
|
|
62 }
|
|
63
|