Mercurial > pidgin
comparison src/protocols/oscar/oscar.c @ 4870:773135edda4a
[gaim-migrate @ 5200]
Added 3-stage typing notification for oscar direct connect
(incoming and outgoing). Previously Gaim only had "typing"
and "no text entered." I added support for "text typed."
Made Gaim correctly recognize and send the auto-response
flag for direct connections. So messages will probably show
up as "AUTO-REPLY" for you and your amigo.
Have gaim save your blist after recieving someone's icon,
which is a bugfix from my code from last night, I think.
Fixed a memleak in icon.c thanks to Nathan Walp.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 23 Mar 2003 07:38:55 +0000 |
parents | fbfdacf7c611 |
children | f7150929332b |
comparison
equal
deleted
inserted
replaced
4869:e6c7d67c1f3a | 4870:773135edda4a |
---|---|
3388 struct buddy *b; | 3388 struct buddy *b; |
3389 set_icon_data(gc, sn, icon, iconlen); | 3389 set_icon_data(gc, sn, icon, iconlen); |
3390 b16 = tobase16(iconcsum, iconcsumlen); | 3390 b16 = tobase16(iconcsum, iconcsumlen); |
3391 b = gaim_find_buddy(gc->account, sn); | 3391 b = gaim_find_buddy(gc->account, sn); |
3392 gaim_buddy_set_setting(b, "icon_checksum", b16); | 3392 gaim_buddy_set_setting(b, "icon_checksum", b16); |
3393 gaim_blist_save(); | |
3393 free(b16); | 3394 free(b16); |
3394 } | 3395 } |
3395 | 3396 |
3396 cur = od->requesticon; | 3397 cur = od->requesticon; |
3397 while (cur) { | 3398 while (cur) { |
4079 | 4080 |
4080 static int oscar_send_typing(struct gaim_connection *gc, char *name, int typing) { | 4081 static int oscar_send_typing(struct gaim_connection *gc, char *name, int typing) { |
4081 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | 4082 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4082 struct direct_im *dim = find_direct_im(od, name); | 4083 struct direct_im *dim = find_direct_im(od, name); |
4083 if (dim) | 4084 if (dim) |
4084 aim_odc_send_typing(od->sess, dim->conn, typing); | 4085 if (typing == TYPING) |
4086 aim_odc_send_typing(od->sess, dim->conn, 0x0002); | |
4087 else if (typing == TYPED) | |
4088 aim_odc_send_typing(od->sess, dim->conn, 0x0001); | |
4089 else | |
4090 aim_odc_send_typing(od->sess, dim->conn, 0x0000); | |
4085 else { | 4091 else { |
4086 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(name)); | 4092 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(name)); |
4087 if (bi && bi->typingnot) { | 4093 if (bi && bi->typingnot) { |
4088 if (typing == TYPING) | 4094 if (typing == TYPING) |
4089 aim_im_sendmtn(od->sess, 0x0001, name, 0x0002); | 4095 aim_im_sendmtn(od->sess, 0x0001, name, 0x0002); |
4104 GError *err = NULL; | 4110 GError *err = NULL; |
4105 | 4111 |
4106 if (dim && dim->connected) { | 4112 if (dim && dim->connected) { |
4107 /* If we're directly connected, send a direct IM */ | 4113 /* If we're directly connected, send a direct IM */ |
4108 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ | 4114 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ |
4109 ret = aim_odc_send_im(od->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0); | 4115 if (imflags & IM_FLAG_AWAY) |
4116 ret = aim_odc_send_im(od->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0, 1); | |
4117 else | |
4118 ret = aim_odc_send_im(od->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0, 0); | |
4110 } else if (len != -1) { | 4119 } else if (len != -1) { |
4111 /* Trying to send an IM image outside of a direct connection. */ | 4120 /* Trying to send an IM image outside of a direct connection. */ |
4112 oscar_ask_direct_im(gc, name); | 4121 oscar_ask_direct_im(gc, name); |
4113 ret = -ENOTCONN; | 4122 ret = -ENOTCONN; |
4114 } else { | 4123 } else { |
5230 | 5239 |
5231 return 1; | 5240 return 1; |
5232 } | 5241 } |
5233 | 5242 |
5234 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { | 5243 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5244 struct gaim_connection *gc = sess->aux_data; | |
5245 int imflags = 0; | |
5235 va_list ap; | 5246 va_list ap; |
5236 char *msg, *sn; | 5247 char *sn, *msg; |
5237 int len, encoding; | 5248 int len, encoding, isawaymsg; |
5238 struct gaim_connection *gc = sess->aux_data; | |
5239 | 5249 |
5240 va_start(ap, fr); | 5250 va_start(ap, fr); |
5241 sn = va_arg(ap, char *); | 5251 sn = va_arg(ap, char *); |
5242 msg = va_arg(ap, char *); | 5252 msg = va_arg(ap, char *); |
5243 len = va_arg(ap, int); | 5253 len = va_arg(ap, int); |
5244 encoding = va_arg(ap, int); | 5254 encoding = va_arg(ap, int); |
5255 isawaymsg = va_arg(ap, int); | |
5245 va_end(ap); | 5256 va_end(ap); |
5246 | 5257 |
5247 debug_printf("Got DirectIM message from %s\n", sn); | 5258 debug_printf("Got DirectIM message from %s\n", sn); |
5248 | 5259 |
5260 if (isawaymsg) | |
5261 imflags |= IM_FLAG_AWAY; | |
5262 | |
5249 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ | 5263 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ |
5250 serv_got_im(gc, sn, msg, 0, time(NULL), len); | 5264 serv_got_im(gc, sn, msg, imflags, time(NULL), len); |
5251 | 5265 |
5252 return 1; | 5266 return 1; |
5253 } | 5267 } |
5254 | 5268 |
5255 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { | 5269 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
5261 va_start(ap, fr); | 5275 va_start(ap, fr); |
5262 sn = va_arg(ap, char *); | 5276 sn = va_arg(ap, char *); |
5263 typing = va_arg(ap, int); | 5277 typing = va_arg(ap, int); |
5264 va_end(ap); | 5278 va_end(ap); |
5265 | 5279 |
5266 if (typing) { | 5280 if (typing == 0x0002) { |
5267 /* I had to leave this. It's just too funny. It reminds me of my sister. */ | 5281 /* I had to leave this. It's just too funny. It reminds me of my sister. */ |
5268 debug_printf("ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn); | 5282 debug_printf("ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn); |
5269 serv_got_typing(gc, sn, 0, TYPING); | 5283 serv_got_typing(gc, sn, 0, TYPING); |
5270 } else | 5284 } else if (typing == 0x0001) |
5285 serv_got_typing(gc, sn, 0, TYPED); | |
5286 else | |
5271 serv_got_typing_stopped(gc, sn); | 5287 serv_got_typing_stopped(gc, sn); |
5272 return 1; | 5288 return 1; |
5273 } | 5289 } |
5274 | 5290 |
5275 struct ask_do_dir_im { | 5291 struct ask_do_dir_im { |