Mercurial > pidgin
comparison src/protocols/oscar/oscar.c @ 5892:da8939ad60b6
[gaim-migrate @ 6324]
Fixes a spelling mistake.
Fixes a rare possible-crash in oscar.
Shuffled some code around. I tend to do this a lot.
Attemped to fix the buddy icon infi-loop thing.
Sean, search for "81" in oscar.c
I commented that out. I'm pretty sure it will stop the
looping, but do you know why that's there? I don't really
understand when the server would send 0x81 as "flags," or
what it means.
Good night, moon.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 15 Jun 2003 09:28:57 +0000 |
parents | 059d95c67cda |
children | 718c1e8d5728 |
comparison
equal
deleted
inserted
replaced
5891:58ea0597a856 | 5892:da8939ad60b6 |
---|---|
3519 struct oscar_data *od = gc->proto_data; | 3519 struct oscar_data *od = gc->proto_data; |
3520 struct buddyinfo *bi; | 3520 struct buddyinfo *bi; |
3521 aim_conn_t *conn; | 3521 aim_conn_t *conn; |
3522 | 3522 |
3523 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); | 3523 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); |
3524 if (!conn && !od->iconconnecting) { | 3524 if (!conn) { |
3525 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | 3525 if (!od->iconconnecting) { |
3526 od->iconconnecting = TRUE; | 3526 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); |
3527 od->iconconnecting = TRUE; | |
3528 } | |
3527 return FALSE; | 3529 return FALSE; |
3528 } | 3530 } |
3529 | 3531 |
3530 if (od->set_icon) { | 3532 if (od->set_icon) { |
3531 const char *iconfile; | 3533 const char *iconfile; |
4713 va_end(ap); | 4715 va_end(ap); |
4714 | 4716 |
4715 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); | 4717 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); |
4716 | 4718 |
4717 if (reason == 0x0005) { | 4719 if (reason == 0x0005) { |
4718 gaim_notify_error(gc, NULL, _("Unable To Retrive Buddy List"), | 4720 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), |
4719 _("Gaim was temporarily unable to retrieve your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours.")); | 4721 _("Gaim was temporarily unable to retrieve your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours.")); |
4720 } | 4722 } |
4721 | 4723 |
4722 /* Activate SSI */ | 4724 /* Activate SSI */ |
4723 /* Sending the enable causes other people to be able to see you, and you to see them */ | 4725 /* Sending the enable causes other people to be able to see you, and you to see them */ |
5440 | 5442 |
5441 | 5443 |
5442 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { | 5444 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { |
5443 GaimConnection *gc = sess->aux_data; | 5445 GaimConnection *gc = sess->aux_data; |
5444 struct oscar_data *od = gc->proto_data; | 5446 struct oscar_data *od = gc->proto_data; |
5445 | 5447 va_list ap; |
5448 fu16_t type; | |
5449 fu8_t flags = 0, length = 0; | |
5446 char *md5 = NULL; | 5450 char *md5 = NULL; |
5447 fu16_t type; | 5451 |
5448 fu8_t length = 0, cached = 0; | |
5449 va_list ap; | |
5450 va_start(ap, fr); | 5452 va_start(ap, fr); |
5451 type = va_arg(ap, int); | 5453 type = va_arg(ap, int); |
5452 switch (type) { | 5454 |
5453 case 0x0001: | 5455 gaim_debug(GAIM_DEBUG_ERROR, "XXX", "got self icon info, type is 0x%04hx, flags is 0x%02hhx\n", type, flags); |
5454 case 0x0000: | 5456 switch(type) { |
5455 cached = va_arg(ap, int); | 5457 case 0x0000: |
5456 length = va_arg(ap, int); | 5458 case 0x0001: { |
5457 md5 = va_arg(ap, char*); | 5459 flags = va_arg(ap, int); |
5458 break; | 5460 length = va_arg(ap, int); |
5459 } | 5461 md5 = va_arg(ap, char *); |
5462 | |
5463 if (flags == 0x41) { | |
5464 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { | |
5465 od->iconconnecting = TRUE; | |
5466 od->set_icon = TRUE; | |
5467 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
5468 } else { | |
5469 const char *iconfile; | |
5470 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)))) { | |
5471 FILE *file; | |
5472 struct stat st; | |
5473 | |
5474 if (!stat(iconfile, &st)) { | |
5475 char *buf = g_malloc(st.st_size); | |
5476 file = fopen(iconfile, "rb"); | |
5477 if (file) { | |
5478 fread(buf, 1, st.st_size, file); | |
5479 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5480 "Uploading icon to icon server\n"); | |
5481 aim_icon_upload(od->sess, buf, st.st_size); | |
5482 fclose(file); | |
5483 } else | |
5484 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5485 "Can't open buddy icon file!\n"); | |
5486 g_free(buf); | |
5487 } else | |
5488 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5489 "Can't stat buddy icon file!\n"); | |
5490 } | |
5491 } | |
5492 } /* else if (flags == 0x81) | |
5493 aim_ssi_seticon(od->sess, md5, length); */ | |
5494 } break; | |
5495 | |
5496 case 0x0002: { /* We just set an "available" message? */ | |
5497 } break; | |
5498 } | |
5499 | |
5460 va_end(ap); | 5500 va_end(ap); |
5461 if (cached == 0x41) { | |
5462 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { | |
5463 od->iconconnecting = TRUE; | |
5464 od->set_icon = TRUE; | |
5465 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
5466 } else { | |
5467 const char *iconfile; | |
5468 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)))) { | |
5469 FILE *file; | |
5470 struct stat st; | |
5471 | |
5472 if (!stat(iconfile, &st)) { | |
5473 char *buf = g_malloc(st.st_size); | |
5474 file = fopen(iconfile, "rb"); | |
5475 if (file) { | |
5476 fread(buf, 1, st.st_size, file); | |
5477 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5478 "Uploading icon to icon server\n"); | |
5479 aim_icon_upload(od->sess, buf, st.st_size); | |
5480 fclose(file); | |
5481 } else | |
5482 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5483 "Can't open buddy icon file!\n"); | |
5484 g_free(buf); | |
5485 } else | |
5486 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5487 "Can't stat buddy icon file!\n"); | |
5488 } | |
5489 } | |
5490 } else if (cached == 0x81) | |
5491 aim_ssi_seticon(od->sess, md5, length); | |
5492 | 5501 |
5493 return 0; | 5502 return 0; |
5494 } | 5503 } |
5495 | 5504 |
5496 | |
5497 /* | 5505 /* |
5498 * We have just established a socket with the other dude, so set up some handlers. | 5506 * We have just established a socket with the other dude, so set up some handlers. |
5499 */ | 5507 */ |
5500 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { | 5508 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
5501 GaimConnection *gc = sess->aux_data; | 5509 GaimConnection *gc = sess->aux_data; |