2
|
1
|
|
2 #include <aim.h>
|
|
3
|
|
4 /*
|
|
5 * aim_add_buddy()
|
|
6 *
|
|
7 * Adds a single buddy to your buddy list after login.
|
|
8 *
|
|
9 */
|
237
|
10 u_long aim_add_buddy(struct aim_session_t *sess,
|
|
11 struct aim_conn_t *conn,
|
|
12 char *sn )
|
2
|
13 {
|
237
|
14 struct command_tx_struct *newpacket;
|
|
15 int i;
|
2
|
16
|
237
|
17 if(!sn)
|
|
18 return -1;
|
2
|
19
|
237
|
20 if (!(newpacket = aim_tx_new(0x0002, conn, 10+1+strlen(sn))))
|
|
21 return -1;
|
|
22
|
|
23 newpacket->lock = 1;
|
2
|
24
|
237
|
25 i = aim_putsnac(newpacket->data, 0x0003, 0x0004, 0x0000, sess->snac_nextid);
|
|
26 i += aimutil_put8(newpacket->data+i, strlen(sn));
|
|
27 i += aimutil_putstr(newpacket->data+i, sn, strlen(sn));
|
2
|
28
|
237
|
29 aim_tx_enqueue(sess, newpacket );
|
2
|
30
|
|
31 {
|
|
32 struct aim_snac_t snac;
|
|
33
|
237
|
34 snac.id = sess->snac_nextid;
|
2
|
35 snac.family = 0x0003;
|
|
36 snac.type = 0x0004;
|
|
37 snac.flags = 0x0000;
|
|
38
|
|
39 snac.data = malloc( strlen( sn ) + 1 );
|
|
40 memcpy( snac.data, sn, strlen( sn ) + 1 );
|
|
41
|
237
|
42 aim_newsnac(sess, &snac);
|
2
|
43 }
|
|
44
|
237
|
45 return( sess->snac_nextid++ );
|
2
|
46 }
|
|
47
|
237
|
48 u_long aim_remove_buddy(struct aim_session_t *sess,
|
|
49 struct aim_conn_t *conn,
|
|
50 char *sn )
|
2
|
51 {
|
237
|
52 struct command_tx_struct *newpacket;
|
|
53 int i;
|
2
|
54
|
237
|
55 if(!sn)
|
|
56 return -1;
|
2
|
57
|
237
|
58 if (!(newpacket = aim_tx_new(0x0002, conn, 10+1+strlen(sn))))
|
|
59 return -1;
|
|
60
|
|
61 newpacket->lock = 1;
|
2
|
62
|
237
|
63 i = aim_putsnac(newpacket->data, 0x0003, 0x0005, 0x0000, sess->snac_nextid);
|
2
|
64
|
237
|
65 i += aimutil_put8(newpacket->data+i, strlen(sn));
|
|
66 i += aimutil_putstr(newpacket->data+i, sn, strlen(sn));
|
2
|
67
|
237
|
68 aim_tx_enqueue(sess, newpacket);
|
2
|
69
|
|
70 {
|
|
71 struct aim_snac_t snac;
|
|
72
|
237
|
73 snac.id = sess->snac_nextid;
|
2
|
74 snac.family = 0x0003;
|
|
75 snac.type = 0x0005;
|
|
76 snac.flags = 0x0000;
|
|
77
|
|
78 snac.data = malloc( strlen( sn ) + 1 );
|
|
79 memcpy( snac.data, sn, strlen( sn ) + 1 );
|
|
80
|
237
|
81 aim_newsnac(sess, &snac );
|
2
|
82 }
|
|
83
|
237
|
84 return( sess->snac_nextid++ );
|
2
|
85 }
|
|
86
|