Mercurial > pidgin.yaz
comparison src/protocols/oscar/icq.c @ 4617:858979ab3867
[gaim-migrate @ 4908]
Big Changes:
-Rewrote some of the perl stuff so perl scripts can change a few of their
parameters
-Receiving a file with AIM over oscar works pretty well
Now, the "nitty gritty":
Very minor change to prefs.c: In the plugins details tab, I changed "URL"
to "Web Site." I was just going to fix the tabbing, but silvestrij
suggested changing it to "Web site," and I thought that sounded good.
I think it fits better, too. I dunno, maybe that's just me.
"Get Capabilities" has stopped working for some reason. I'm just going to
blame AOL. It's really not important anyway, and some people wanted it
taken off. It is now #ifdef 0'ed out. I'll remove it completely if it
continues to no longer function.
I took out a few plugin_event calls from oscar.c and put them in core code.
"event_error" should be, uh, "evented" when there is an error signing on.
Hopefully no one was using this. It's really pretty useless. The parameter
is now the reason for not being able to connect rather than the archaic
toc error code.
I screwed around with how perl functions are called some. There was way the
hell too much malloc'ing going on here. I think all in all it's an
improvement, though I'm still not a big fan of how changes to parameters
propagate to the actual memory.
I really think it would be nice if the perl stuff was made into a C plugin.
It's just so much cleaner. Especially if someone wanted to write, say, a
python or tcl interpreter. That's how xchat2 does it. I just think that
would be really slick. Like butter. Or ice. Very unlike Velcro.
I added a "Change Password" Protocol Action for ICQ over oscar. This was
really pretty easy. I'd like to thank my housemate Andrew for complaining
a lot that having to use Windows ICQ to change his password was a pain.
I rewrote a lot of the oscar file transfer stuff to use Christian's new
xfer interface. This involved moving a few functions from ft.c to im.c,
where they belong. I also removed all the #if 0'ed getfile functions.
I'll be rewritting them soonish. Receiving a file should work perfectly,
aside from maybe a small memleak when stuff is canceled. Sending a file is
currently disabled. No ETA on when I'll have that working.
I renamed pretty much all of the functions in im.c so they have kind of a
scheme now. They should all be aim_im_bleh, since "im" is the family
name. There comes a time when you must break the crap out of any clients
that might be using libfaim in order to make stuff cleaner. Maybe.
I got rid of the snac destructor stuff for now. I'll probably add it back
later. I wasn't entirely comfortable with how it was done.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 26 Feb 2003 05:01:37 +0000 |
parents | b66f960bfe60 |
children | a964972cb361 |
comparison
equal
deleted
inserted
replaced
4616:767093a2ddaf | 4617:858979ab3867 |
---|---|
68 aim_tx_enqueue(sess, fr); | 68 aim_tx_enqueue(sess, fr); |
69 | 69 |
70 return 0; | 70 return 0; |
71 } | 71 } |
72 | 72 |
73 faim_export int aim_icq_changepasswd(aim_session_t *sess, const char *passwd) | |
74 { | |
75 aim_conn_t *conn; | |
76 aim_frame_t *fr; | |
77 aim_snacid_t snacid; | |
78 int bslen; | |
79 | |
80 if (!passwd) | |
81 return -EINVAL; | |
82 | |
83 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) | |
84 return -EINVAL; | |
85 | |
86 bslen = 2+4+2+2+2+2+strlen(passwd)+1; | |
87 | |
88 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) | |
89 return -ENOMEM; | |
90 | |
91 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); | |
92 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); | |
93 | |
94 /* For simplicity, don't bother using a tlvlist */ | |
95 aimbs_put16(&fr->data, 0x0001); | |
96 aimbs_put16(&fr->data, bslen); | |
97 | |
98 aimbs_putle16(&fr->data, bslen - 2); | |
99 aimbs_putle32(&fr->data, atoi(sess->sn)); | |
100 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ | |
101 aimbs_putle16(&fr->data, snacid); /* eh. */ | |
102 aimbs_putle16(&fr->data, 0x042e); /* shrug. */ | |
103 aimbs_putle16(&fr->data, strlen(passwd)+1); | |
104 aimbs_putraw(&fr->data, passwd, strlen(passwd)); | |
105 aimbs_putle8(&fr->data, '\0'); | |
106 | |
107 aim_tx_enqueue(sess, fr); | |
108 | |
109 return 0; | |
110 } | |
111 | |
112 faim_export int aim_icq_getallinfo(aim_session_t *sess, const char *uin) | |
113 { | |
114 aim_conn_t *conn; | |
115 aim_frame_t *fr; | |
116 aim_snacid_t snacid; | |
117 int bslen; | |
118 | |
119 if (!uin || uin[0] < '0' || uin[0] > '9') | |
120 return -EINVAL; | |
121 | |
122 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) | |
123 return -EINVAL; | |
124 | |
125 bslen = 2 + 4 + 2 + 2 + 2 + 4; | |
126 | |
127 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) | |
128 return -ENOMEM; | |
129 | |
130 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); | |
131 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); | |
132 | |
133 /* For simplicity, don't bother using a tlvlist */ | |
134 aimbs_put16(&fr->data, 0x0001); | |
135 aimbs_put16(&fr->data, bslen); | |
136 | |
137 aimbs_putle16(&fr->data, bslen - 2); | |
138 aimbs_putle32(&fr->data, atoi(sess->sn)); | |
139 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ | |
140 aimbs_putle16(&fr->data, snacid); /* eh. */ | |
141 aimbs_putle16(&fr->data, 0x04b2); /* shrug. */ | |
142 aimbs_putle32(&fr->data, atoi(uin)); | |
143 | |
144 aim_tx_enqueue(sess, fr); | |
145 | |
146 return 0; | |
147 } | |
148 | |
149 faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin) | |
150 { | |
151 aim_conn_t *conn; | |
152 aim_frame_t *fr; | |
153 aim_snacid_t snacid; | |
154 int bslen; | |
155 | |
156 if (!uin || uin[0] < '0' || uin[0] > '9') | |
157 return -EINVAL; | |
158 | |
159 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) | |
160 return -EINVAL; | |
161 | |
162 bslen = 2 + 4 + 2 + 2 + 2 + 4; | |
163 | |
164 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) | |
165 return -ENOMEM; | |
166 | |
167 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); | |
168 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); | |
169 | |
170 /* For simplicity, don't bother using a tlvlist */ | |
171 aimbs_put16(&fr->data, 0x0001); | |
172 aimbs_put16(&fr->data, bslen); | |
173 | |
174 aimbs_putle16(&fr->data, bslen - 2); | |
175 aimbs_putle32(&fr->data, atoi(sess->sn)); | |
176 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ | |
177 aimbs_putle16(&fr->data, snacid); /* eh. */ | |
178 aimbs_putle16(&fr->data, 0x051f); /* shrug. */ | |
179 aimbs_putle32(&fr->data, atoi(uin)); | |
180 | |
181 aim_tx_enqueue(sess, fr); | |
182 | |
183 return 0; | |
184 } | |
185 | |
73 faim_export int aim_icq_sendxmlreq(aim_session_t *sess, const char *xml) | 186 faim_export int aim_icq_sendxmlreq(aim_session_t *sess, const char *xml) |
74 { | 187 { |
75 aim_conn_t *conn; | 188 aim_conn_t *conn; |
76 aim_frame_t *fr; | 189 aim_frame_t *fr; |
77 aim_snacid_t snacid; | 190 aim_snacid_t snacid; |
106 aim_tx_enqueue(sess, fr); | 219 aim_tx_enqueue(sess, fr); |
107 | 220 |
108 return 0; | 221 return 0; |
109 } | 222 } |
110 | 223 |
111 faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin) | 224 /** |
112 { | 225 * Subtype 0x0003 - Response to 0x0015/0x002, contains an ICQesque packet. |
113 aim_conn_t *conn; | |
114 aim_frame_t *fr; | |
115 aim_snacid_t snacid; | |
116 int bslen; | |
117 | |
118 if (!uin || uin[0] < '0' || uin[0] > '9') | |
119 return -EINVAL; | |
120 | |
121 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) | |
122 return -EINVAL; | |
123 | |
124 bslen = 2 + 4 + 2 + 2 + 2 + 4; | |
125 | |
126 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) | |
127 return -ENOMEM; | |
128 | |
129 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); | |
130 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); | |
131 | |
132 /* For simplicity, don't bother using a tlvlist */ | |
133 aimbs_put16(&fr->data, 0x0001); | |
134 aimbs_put16(&fr->data, bslen); | |
135 | |
136 aimbs_putle16(&fr->data, bslen - 2); | |
137 aimbs_putle32(&fr->data, atoi(sess->sn)); | |
138 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ | |
139 aimbs_putle16(&fr->data, snacid); /* eh. */ | |
140 aimbs_putle16(&fr->data, 0x051f); /* shrug. */ | |
141 aimbs_putle32(&fr->data, atoi(uin)); | |
142 | |
143 aim_tx_enqueue(sess, fr); | |
144 | |
145 return 0; | |
146 } | |
147 | |
148 faim_export int aim_icq_getallinfo(aim_session_t *sess, const char *uin) | |
149 { | |
150 aim_conn_t *conn; | |
151 aim_frame_t *fr; | |
152 aim_snacid_t snacid; | |
153 int bslen; | |
154 | |
155 if (!uin || uin[0] < '0' || uin[0] > '9') | |
156 return -EINVAL; | |
157 | |
158 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) | |
159 return -EINVAL; | |
160 | |
161 bslen = 2 + 4 + 2 + 2 + 2 + 4; | |
162 | |
163 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) | |
164 return -ENOMEM; | |
165 | |
166 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); | |
167 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); | |
168 | |
169 /* For simplicity, don't bother using a tlvlist */ | |
170 aimbs_put16(&fr->data, 0x0001); | |
171 aimbs_put16(&fr->data, bslen); | |
172 | |
173 aimbs_putle16(&fr->data, bslen - 2); | |
174 aimbs_putle32(&fr->data, atoi(sess->sn)); | |
175 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ | |
176 aimbs_putle16(&fr->data, snacid); /* eh. */ | |
177 aimbs_putle16(&fr->data, 0x04b2); /* shrug. */ | |
178 aimbs_putle32(&fr->data, atoi(uin)); | |
179 | |
180 aim_tx_enqueue(sess, fr); | |
181 | |
182 return 0; | |
183 } | |
184 | |
185 /* | |
186 * Response to 15/2, contains an ICQ packet. | |
187 */ | 226 */ |
188 static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | 227 static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
189 { | 228 { |
190 int ret = 0; | 229 int ret = 0; |
191 aim_tlvlist_t *tl; | 230 aim_tlvlist_t *tl; |
246 info = (struct aim_icq_info *)malloc(sizeof(struct aim_icq_info)); | 285 info = (struct aim_icq_info *)malloc(sizeof(struct aim_icq_info)); |
247 memset(info, 0, sizeof(struct aim_icq_info)); | 286 memset(info, 0, sizeof(struct aim_icq_info)); |
248 aim_bstream_advance(&qbs, 1); /* 0x0a */ | 287 aim_bstream_advance(&qbs, 1); /* 0x0a */ |
249 | 288 |
250 switch (subtype) { | 289 switch (subtype) { |
290 case 0x00aa: { /* password change status */ | |
291 aimbs_getle8(&qbs); /* 0x000a for success */ | |
292 } break; | |
293 | |
251 case 0x00c8: { /* info summary (useful stuff) */ | 294 case 0x00c8: { /* info summary (useful stuff) */ |
252 info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | 295 info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
253 info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | 296 info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
254 info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | 297 info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
255 aim_bstream_advance(&qbs, aimbs_getle16(&qbs)); | 298 aim_bstream_advance(&qbs, aimbs_getle16(&qbs)); |