Mercurial > pidgin.yaz
comparison libfaim/aim_buddylist.c @ 2:68b230f8da5f
[gaim-migrate @ 11]
A few more commits :)
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Thu, 23 Mar 2000 03:16:06 +0000 |
parents | |
children | 6ced2f1c8b24 |
comparison
equal
deleted
inserted
replaced
1:2846a03bda67 | 2:68b230f8da5f |
---|---|
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 */ | |
10 u_long aim_add_buddy(struct aim_conn_t *conn, char *sn ) | |
11 { | |
12 struct command_tx_struct newpacket; | |
13 | |
14 if( !sn ) | |
15 return -1; | |
16 | |
17 if (conn) | |
18 newpacket.conn = conn; | |
19 else | |
20 newpacket.conn = aim_getconn_type(AIM_CONN_TYPE_BOS); | |
21 | |
22 newpacket.lock = 1; | |
23 newpacket.type = 0x0002; | |
24 newpacket.commandlen = 11 + strlen( sn ); | |
25 newpacket.data = (char *)malloc( newpacket.commandlen ); | |
26 | |
27 newpacket.data[0] = 0x00; | |
28 newpacket.data[1] = 0x03; | |
29 newpacket.data[2] = 0x00; | |
30 newpacket.data[3] = 0x04; | |
31 newpacket.data[4] = 0x00; | |
32 newpacket.data[5] = 0x00; | |
33 | |
34 /* SNAC reqid */ | |
35 newpacket.data[6] = (aim_snac_nextid >> 24) & 0xFF; | |
36 newpacket.data[7] = (aim_snac_nextid >> 16) & 0xFF; | |
37 newpacket.data[8] = (aim_snac_nextid >> 8) & 0xFF; | |
38 newpacket.data[9] = (aim_snac_nextid) & 0xFF; | |
39 | |
40 /* length of screenname */ | |
41 newpacket.data[10] = strlen( sn ); | |
42 | |
43 memcpy( &(newpacket.data[11]), sn, strlen( sn ) ); | |
44 | |
45 aim_tx_enqueue( &newpacket ); | |
46 | |
47 { | |
48 struct aim_snac_t snac; | |
49 | |
50 snac.id = aim_snac_nextid; | |
51 snac.family = 0x0003; | |
52 snac.type = 0x0004; | |
53 snac.flags = 0x0000; | |
54 | |
55 snac.data = malloc( strlen( sn ) + 1 ); | |
56 memcpy( snac.data, sn, strlen( sn ) + 1 ); | |
57 | |
58 aim_newsnac( &snac ); | |
59 } | |
60 | |
61 return( aim_snac_nextid++ ); | |
62 } | |
63 | |
64 u_long aim_remove_buddy(struct aim_conn_t *conn, char *sn ) | |
65 { | |
66 struct command_tx_struct newpacket; | |
67 | |
68 if( !sn ) | |
69 return -1; | |
70 | |
71 if (conn) | |
72 newpacket.conn = conn; | |
73 else | |
74 newpacket.conn = aim_getconn_type(AIM_CONN_TYPE_BOS); | |
75 | |
76 newpacket.lock = 1; | |
77 newpacket.type = 0x0002; | |
78 newpacket.commandlen = 11 + strlen(sn); | |
79 newpacket.data = (char *)malloc( newpacket.commandlen ); | |
80 | |
81 newpacket.data[0] = 0x00; | |
82 newpacket.data[1] = 0x03; | |
83 newpacket.data[2] = 0x00; | |
84 newpacket.data[3] = 0x05; | |
85 newpacket.data[4] = 0x00; | |
86 newpacket.data[5] = 0x00; | |
87 | |
88 /* SNAC reqid */ | |
89 newpacket.data[6] = (aim_snac_nextid >> 24) & 0xFF; | |
90 newpacket.data[7] = (aim_snac_nextid >> 16) & 0xFF; | |
91 newpacket.data[8] = (aim_snac_nextid >> 8) & 0xFF; | |
92 newpacket.data[9] = (aim_snac_nextid) & 0xFF; | |
93 | |
94 /* length of screenname */ | |
95 newpacket.data[10] = strlen( sn ); | |
96 | |
97 memcpy( &(newpacket.data[11]), sn, strlen( sn ) ); | |
98 | |
99 aim_tx_enqueue( &newpacket ); | |
100 | |
101 { | |
102 struct aim_snac_t snac; | |
103 | |
104 snac.id = aim_snac_nextid; | |
105 snac.family = 0x0003; | |
106 snac.type = 0x0005; | |
107 snac.flags = 0x0000; | |
108 | |
109 snac.data = malloc( strlen( sn ) + 1 ); | |
110 memcpy( snac.data, sn, strlen( sn ) + 1 ); | |
111 | |
112 aim_newsnac( &snac ); | |
113 } | |
114 | |
115 return( aim_snac_nextid++ ); | |
116 } | |
117 |