annotate src/protocols/oscar/email.c @ 9985:8cc2866678f3

[gaim-migrate @ 10896] Are the novell guys going to fix this for us? I just #if 0'd some stuff out so it compiles. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Wed, 08 Sep 2004 06:38:10 +0000
parents 92cbf9713795
children acbd980d6179
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /*
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 * Family 0x0018 - Email notification
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 *
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 * Used for being alerted when the email address(es) associated with
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5 * your screen name get new electronic-m. For normal AIM accounts, you
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 * get the email address screenname@netscape.net. AOL accounts have
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 * screenname@aol.com, and can also activate a netscape.net account.
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 *
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 #define FAIM_INTERNAL
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 #include <aim.h>
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
14 /**
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 * Subtype 0x0006 - Request information about your email account
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
16 *
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
17 * @param sess The oscar session.
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
18 * @param conn The email connection for this session.
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
19 * @return Return 0 if no errors, otherwise return the error number.
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 */
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
21 faim_export int aim_email_sendcookies(aim_session_t *sess)
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 {
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
23 aim_conn_t *conn;
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 aim_frame_t *fr;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 aim_snacid_t snacid;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
27 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_EML)))
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 return -EINVAL;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+16+16)))
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 return -ENOMEM;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 snacid = aim_cachesnac(sess, 0x0018, 0x0006, 0x0000, NULL, 0);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 aim_putsnac(&fr->data, 0x0018, 0x0006, 0x0000, snacid);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35 /* Number of cookies to follow */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 aimbs_put16(&fr->data, 0x0002);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 /* Cookie */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 aimbs_put16(&fr->data, 0x5d5e);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 aimbs_put16(&fr->data, 0x1708);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41 aimbs_put16(&fr->data, 0x55aa);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42 aimbs_put16(&fr->data, 0x11d3);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43 aimbs_put16(&fr->data, 0xb143);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44 aimbs_put16(&fr->data, 0x0060);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
45 aimbs_put16(&fr->data, 0xb0fb);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
46 aimbs_put16(&fr->data, 0x1ecb);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
47
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
48 /* Cookie */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
49 aimbs_put16(&fr->data, 0xb380);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
50 aimbs_put16(&fr->data, 0x9ad8);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
51 aimbs_put16(&fr->data, 0x0dba);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
52 aimbs_put16(&fr->data, 0x11d5);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
53 aimbs_put16(&fr->data, 0x9f8a);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
54 aimbs_put16(&fr->data, 0x0060);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
55 aimbs_put16(&fr->data, 0xb0ee);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
56 aimbs_put16(&fr->data, 0x0631);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
57
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
58 aim_tx_enqueue(sess, fr);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
59
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
60 return 0;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
61 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
62
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
63
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
64 /**
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
65 * Subtype 0x0007 - Receive information about your email account
4804
9810ce8e7a96 [gaim-migrate @ 5124]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
66 *
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
67 * So I don't even know if you can have multiple 16 byte keys,
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
68 * but this is coded so it will handle that, and handle it well.
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
69 * This tells you if you have unread mail or not, the URL you
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
70 * should use to access that mail, and the domain name for the
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
71 * email account (screenname@domainname.com). If this is the
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
72 * first 0x0007 SNAC you've received since you signed on, or if
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
73 * this is just a periodic status update, this will also contain
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
74 * the number of unread emails that you have.
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
75 */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
76 static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
77 {
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4804
diff changeset
78 int ret = 0;
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
79 aim_rxcallback_t userfunc;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
80 struct aim_emailinfo *new;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
81 aim_tlvlist_t *tlvlist;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
82 fu8_t *cookie8, *cookie16;
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
83 int tmp, havenewmail = 0; /* Used to tell the client we have _new_ mail */
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
84
7297
ceda503e55a6 [gaim-migrate @ 7881]
Sean Egan <seanegan@gmail.com>
parents: 7282
diff changeset
85 char *alertitle = NULL, *alerturl = NULL;
ceda503e55a6 [gaim-migrate @ 7881]
Sean Egan <seanegan@gmail.com>
parents: 7282
diff changeset
86
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
87 cookie8 = aimbs_getraw(bs, 8); /* Possibly the code used to log you in to mail? */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
88 cookie16 = aimbs_getraw(bs, 16); /* Mail cookie sent above */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
89
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
90 /* See if we already have some info associated with this cookie */
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
91 for (new=sess->emailinfo; (new && strncmp(cookie16, new->cookie16, 16)); new=new->next);
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
92 if (new) {
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 7313
diff changeset
93 /* Free some of the old info, if it exists */
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3725
diff changeset
94 free(new->cookie8);
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3725
diff changeset
95 free(new->cookie16);
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3725
diff changeset
96 free(new->url);
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3725
diff changeset
97 free(new->domain);
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
98 } else {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
99 /* We don't already have info, so create a new struct for it */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
100 if (!(new = malloc(sizeof(struct aim_emailinfo))))
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
101 return -ENOMEM;
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
102 memset(new, 0, sizeof(struct aim_emailinfo));
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
103 new->next = sess->emailinfo;
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
104 sess->emailinfo = new;
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
105 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
106
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
107 new->cookie8 = cookie8;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
108 new->cookie16 = cookie16;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
109
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
110 tlvlist = aim_tlvlist_readnum(bs, aimbs_get16(bs));
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
111
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
112 tmp = aim_tlv_get16(tlvlist, 0x0080, 1);
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
113 if (tmp) {
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
114 if (new->nummsgs < tmp)
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
115 havenewmail = 1;
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
116 new->nummsgs = tmp;
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
117 } else {
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 7313
diff changeset
118 /* If they don't send a 0x0080 TLV, it means we definitely have new mail */
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
119 /* (ie. this is not just another status update) */
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
120 havenewmail = 1;
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
121 new->nummsgs++; /* We know we have at least 1 new email */
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
122 }
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
123 new->url = aim_tlv_getstr(tlvlist, 0x0007, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
124 if (!(new->unread = aim_tlv_get8(tlvlist, 0x0081, 1))) {
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
125 havenewmail = 0;
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
126 new->nummsgs = 0;
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
127 }
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
128 new->domain = aim_tlv_getstr(tlvlist, 0x0082, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
129 new->flag = aim_tlv_get16(tlvlist, 0x0084, 1);
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
130
7297
ceda503e55a6 [gaim-migrate @ 7881]
Sean Egan <seanegan@gmail.com>
parents: 7282
diff changeset
131 alertitle = aim_tlv_getstr(tlvlist, 0x0005, 1);
ceda503e55a6 [gaim-migrate @ 7881]
Sean Egan <seanegan@gmail.com>
parents: 7282
diff changeset
132 alerturl = aim_tlv_getstr(tlvlist, 0x000d, 1);
ceda503e55a6 [gaim-migrate @ 7881]
Sean Egan <seanegan@gmail.com>
parents: 7282
diff changeset
133
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
134 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
7313
be7c1468c6a7 [gaim-migrate @ 7897]
Mark Doliner <mark@kingant.net>
parents: 7297
diff changeset
135 ret = userfunc(sess, rx, new, havenewmail, alertitle, (alerturl ? alerturl + 2 : NULL));
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
136
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
137 aim_tlvlist_free(&tlvlist);
4875
26837f462a66 [gaim-migrate @ 5205]
Mark Doliner <mark@kingant.net>
parents: 4871
diff changeset
138
7313
be7c1468c6a7 [gaim-migrate @ 7897]
Mark Doliner <mark@kingant.net>
parents: 7297
diff changeset
139 free(alertitle);
be7c1468c6a7 [gaim-migrate @ 7897]
Mark Doliner <mark@kingant.net>
parents: 7297
diff changeset
140 free(alerturl);
be7c1468c6a7 [gaim-migrate @ 7897]
Mark Doliner <mark@kingant.net>
parents: 7297
diff changeset
141
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4804
diff changeset
142 return ret;
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
143 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
144
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
145 /**
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
146 * Subtype 0x0016 - Send something or other
3725
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
147 *
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
148 * @param sess The oscar session.
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
149 * @param conn The email connection for this session.
dd48b1ac5bd8 [gaim-migrate @ 3861]
Mark Doliner <mark@kingant.net>
parents: 3694
diff changeset
150 * @return Return 0 if no errors, otherwise return the error number.
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
151 */
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
152 faim_export int aim_email_activate(aim_session_t *sess)
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
153 {
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
154 aim_conn_t *conn;
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
155 aim_frame_t *fr;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
156 aim_snacid_t snacid;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
157
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
158 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_EML)))
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
159 return -EINVAL;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
160
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
161 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+16)))
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
162 return -ENOMEM;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
163 snacid = aim_cachesnac(sess, 0x0018, 0x0016, 0x0000, NULL, 0);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
164 aim_putsnac(&fr->data, 0x0018, 0x0016, 0x0000, snacid);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
165
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
166 /* I would guess this tells AIM that you want updates for your mail accounts */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
167 /* ...but I really have no idea */
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
168 aimbs_put8(&fr->data, 0x02);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
169 aimbs_put32(&fr->data, 0x04000000);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
170 aimbs_put32(&fr->data, 0x04000000);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
171 aimbs_put32(&fr->data, 0x04000000);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
172 aimbs_put32(&fr->data, 0x00000000);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
173
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
174 aim_tx_enqueue(sess, fr);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
175
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
176 return 0;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
177 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
178
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
179 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
180 {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
181
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
182 if (snac->subtype == 0x0007)
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
183 return parseinfo(sess, mod, rx, snac, bs);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
184
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
185 return 0;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
186 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
187
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
188 static void email_shutdown(aim_session_t *sess, aim_module_t *mod)
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
189 {
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
190 while (sess->emailinfo) {
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
191 struct aim_emailinfo *tmp = sess->emailinfo;
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
192 sess->emailinfo = sess->emailinfo->next;
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3725
diff changeset
193 free(tmp->cookie16);
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3725
diff changeset
194 free(tmp->cookie8);
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3725
diff changeset
195 free(tmp->url);
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 3725
diff changeset
196 free(tmp->domain);
3694
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
197 free(tmp);
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
198 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
199
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
200 return;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
201 }
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
202
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
203 faim_internal int email_modfirst(aim_session_t *sess, aim_module_t *mod)
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
204 {
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
205
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
206 mod->family = 0x0018;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
207 mod->version = 0x0001;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
208 mod->toolid = 0x0010;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
209 mod->toolversion = 0x0629;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
210 mod->flags = 0;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
211 strncpy(mod->name, "email", sizeof(mod->name));
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
212 mod->snachandler = snachandler;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
213 mod->shutdown = email_shutdown;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
214
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
215 return 0;
e941bfbacf7c [gaim-migrate @ 3824]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
216 }