annotate src/protocols/oscar/admin.c @ 4871:0b64f386a7b8

[gaim-migrate @ 5201] Nathan is SO the man. He pointed out that oscar was leaking about 500k per IM. No, just kidding. But this should help Gaim leak a little less. It was all Nathan. He is so S-M-R-T. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 23 Mar 2003 07:59:17 +0000
parents 2532f1192da3
children 6d3d8f11e765
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
1 /*
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
2 * Family 0x0007 - Account Administration.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
3 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
4 * Used for stuff like changing the formating of your screen name, changing your
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
5 * email address, requesting an account confirmation email, getting account info,
4071
2532f1192da3 [gaim-migrate @ 4283]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
6 *
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
7 */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 #define FAIM_INTERNAL
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 #include <aim.h>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
12 /*
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
13 * Subtype 0x0002 - Request a bit of account info.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
14 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
15 * Info should be one of the following:
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
16 * 0x0001 - Screen name formatting
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
17 * 0x0011 - Email address
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
18 * 0x0013 - Unknown
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
19 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
20 */
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
21 faim_export int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, fu16_t info)
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
22 {
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
23 aim_frame_t *fr;
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
24 aim_snacid_t snacid;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
25
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
26 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 14)))
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
27 return -ENOMEM;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
28
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
29 snacid = aim_cachesnac(sess, 0x0007, 0x0002, 0x0000, NULL, 0);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
30 aim_putsnac(&fr->data, 0x0007, 0x0002, 0x0000, snacid);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
31
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
32 aimbs_put16(&fr->data, info);
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
33 aimbs_put16(&fr->data, 0x0000);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
34
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
35 aim_tx_enqueue(sess, fr);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
36
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
37 return 0;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
38 }
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
39
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
40 /*
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
41 * Subtypes 0x0003 and 0x0005 - Parse account info.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
42 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
43 * Called in reply to both an information request (subtype 0x0002) and
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
44 * an information change (subtype 0x0004).
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
45 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
46 */
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
47 static int infochange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 {
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
49 aim_rxcallback_t userfunc;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
50 char *url=NULL, *sn=NULL, *email=NULL;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
51 fu16_t perms, tlvcount, err=0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
53 perms = aimbs_get16(bs);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
54 tlvcount = aimbs_get16(bs);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
55
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
56 while (tlvcount && aim_bstream_empty(bs)) {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
57 fu16_t type, length;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
58
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
59 type = aimbs_get16(bs);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
60 length = aimbs_get16(bs);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
62 switch (type) {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
63 case 0x0001: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
64 sn = aimbs_getstr(bs, length);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
65 } break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
67 case 0x0004: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
68 url = aimbs_getstr(bs, length);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
69 } break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
71 case 0x0008: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
72 err = aimbs_get16(bs);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
73 } break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
75 case 0x0011: {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
76 if (length == 0) {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
77 email = (char*)malloc(13*sizeof(char));
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
78 strcpy(email, "*suppressed*");
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
79 } else
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
80 email = aimbs_getstr(bs, length);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
81 } break;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
82 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
84 tlvcount--;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
85 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
86
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
87 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
88 userfunc(sess, rx, (snac->subtype == 0x0005) ? 1 : 0, perms, err, url, sn, email);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
90 if (sn) free(sn);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
91 if (url) free(url);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
92 if (email) free(email);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
94 return 1;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
97 /*
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
98 * Subtype 0x0004 - Set screenname formatting.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
99 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
100 */
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
101 faim_export int aim_admin_setnick(aim_session_t *sess, aim_conn_t *conn, const char *newnick)
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
102 {
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
103 aim_frame_t *fr;
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
104 aim_snacid_t snacid;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
105 aim_tlvlist_t *tl = NULL;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
106
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
107 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newnick))))
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
108 return -ENOMEM;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
109
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
110 snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
111 aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
112
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
113 aim_addtlvtochain_raw(&tl, 0x0001, strlen(newnick), newnick);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
114
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
115 aim_writetlvchain(&fr->data, &tl);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
116 aim_freetlvchain(&tl);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
117
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
118 aim_tx_enqueue(sess, fr);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
119
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
120
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
121 return 0;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
122 }
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
123
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
124 /*
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
125 * Subtype 0x0004 - Change password.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
126 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
127 */
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
128 faim_export int aim_admin_changepasswd(aim_session_t *sess, aim_conn_t *conn, const char *newpw, const char *curpw)
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
129 {
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
130 aim_frame_t *fr;
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
131 aim_tlvlist_t *tl = NULL;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
132 aim_snacid_t snacid;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
133
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
134 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+strlen(curpw)+4+strlen(newpw))))
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
135 return -ENOMEM;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
136
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
137 snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
138 aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
139
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
140 /* new password TLV t(0002) */
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
141 aim_addtlvtochain_raw(&tl, 0x0002, strlen(newpw), newpw);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
142
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
143 /* current password TLV t(0012) */
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
144 aim_addtlvtochain_raw(&tl, 0x0012, strlen(curpw), curpw);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
145
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
146 aim_writetlvchain(&fr->data, &tl);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
147 aim_freetlvchain(&tl);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
148
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
149 aim_tx_enqueue(sess, fr);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
150
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
151 return 0;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
152 }
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
153
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
154 /*
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
155 * Subtype 0x0004 - Change email address.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
156 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
157 */
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
158 faim_export int aim_admin_setemail(aim_session_t *sess, aim_conn_t *conn, const char *newemail)
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
159 {
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
160 aim_frame_t *fr;
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
161 aim_snacid_t snacid;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
162 aim_tlvlist_t *tl = NULL;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
163
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
164 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newemail))))
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
165 return -ENOMEM;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
166
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
167 snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0);
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
168 aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
169
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
170 aim_addtlvtochain_raw(&tl, 0x0011, strlen(newemail), newemail);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
171
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
172 aim_writetlvchain(&fr->data, &tl);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
173 aim_freetlvchain(&tl);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
174
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3912
diff changeset
175 aim_tx_enqueue(sess, fr);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
176
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
177 return 0;
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
178 }
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
179
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
180 /*
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
181 * Subtype 0x0006 - Request account confirmation.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
182 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
183 * This will cause an email to be sent to the address associated with
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
184 * the account. By following the instructions in the mail, you can
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
185 * get the TRIAL flag removed from your account.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
186 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
187 */
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
188 faim_export int aim_admin_reqconfirm(aim_session_t *sess, aim_conn_t *conn)
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
189 {
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
190 return aim_genericreq_n(sess, conn, 0x0007, 0x0006);
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
191 }
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
192
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
193 /*
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
194 * Subtype 0x0007 - Account confirmation request acknowledgement.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
195 *
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
196 */
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
197 static int accountconfirm(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 {
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4071
diff changeset
199 int ret = 0;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
200 aim_rxcallback_t userfunc;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
201 fu16_t status;
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
202 aim_tlvlist_t *tl;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
204 status = aimbs_get16(bs);
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
205 /* This is 0x0013 if unable to confirm at this time */
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
206
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 2979
diff changeset
207 tl = aim_readtlvchain(bs);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
209 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4071
diff changeset
210 ret = userfunc(sess, rx, status);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4071
diff changeset
212 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
215 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
218 if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
219 return infochange(sess, mod, rx, snac, bs);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
220 else if (snac->subtype == 0x0007)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
221 return accountconfirm(sess, mod, rx, snac, bs);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
223 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
226 faim_internal int admin_modfirst(aim_session_t *sess, aim_module_t *mod)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
229 mod->family = 0x0007;
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2246
diff changeset
230 mod->version = 0x0001;
4071
2532f1192da3 [gaim-migrate @ 4283]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
231 mod->toolid = 0x0010;
2532f1192da3 [gaim-migrate @ 4283]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
232 mod->toolversion = 0x0629;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
233 mod->flags = 0;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
234 strncpy(mod->name, "admin", sizeof(mod->name));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
235 mod->snachandler = snachandler;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
237 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238 }