| 57 |
57 |
| 58 #define OSCAR_CONNECT_STEPS 6 |
58 #define OSCAR_CONNECT_STEPS 6 |
| 59 |
59 |
| 60 static GaimPlugin *my_protocol = NULL; |
60 static GaimPlugin *my_protocol = NULL; |
| 61 |
61 |
| 62 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE; |
62 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; |
| 63 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE; |
63 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; |
| 64 |
64 |
| 65 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
65 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
| 66 static fu8_t features_icq[] = {0x01, 0x06}; |
66 static fu8_t features_icq[] = {0x01, 0x06}; |
| 67 |
67 |
| 68 typedef struct _OscarData OscarData; |
68 typedef struct _OscarData OscarData; |
| 3676 GaimConnection *gc = sess->aux_data; |
3676 GaimConnection *gc = sess->aux_data; |
| 3677 |
3677 |
| 3678 aim_reqpersonalinfo(sess, fr->conn); |
3678 aim_reqpersonalinfo(sess, fr->conn); |
| 3679 |
3679 |
| 3680 #ifndef NOSSI |
3680 #ifndef NOSSI |
| 3681 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting ssi list\n"); |
3681 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting rights and list\n"); |
| 3682 aim_ssi_reqrights(sess); |
3682 aim_ssi_reqrights(sess); |
| 3683 aim_ssi_reqdata(sess); |
3683 aim_ssi_reqdata(sess); |
| 3684 #endif |
3684 #endif |
| 3685 |
3685 |
| 3686 aim_locate_reqrights(sess); |
3686 aim_locate_reqrights(sess); |
| 3687 aim_buddylist_reqrights(sess, fr->conn); |
3687 aim_buddylist_reqrights(sess, fr->conn); |
| 3688 aim_im_reqparams(sess); |
3688 aim_im_reqparams(sess); |
| 3689 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi? */ |
3689 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi */ |
| 3690 |
3690 |
| 3691 #ifdef NOSSI |
3691 #ifdef NOSSI |
| |
3692 gaim_debug(GAIM_DEBUG_INFO, "oscar", "bos: requesting rights\n"); |
| |
3693 aim_bos_reqrights(sess, fr->conn); |
| 3692 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
3694 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
| 3693 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); |
3695 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); |
| 3694 #endif |
3696 #endif |
| 3695 |
3697 |
| 3696 gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); |
3698 gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); |
| 4413 _("You have probably requested to set your " |
4416 _("You have probably requested to set your " |
| 4414 "profile before the login procedure completed. " |
4417 "profile before the login procedure completed. " |
| 4415 "Your profile remains unset; try setting it " |
4418 "Your profile remains unset; try setting it " |
| 4416 "again when you are fully connected.")); |
4419 "again when you are fully connected.")); |
| 4417 |
4420 |
| 4418 if (od->icq) |
4421 if (!text) { |
| 4419 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, NULL, 0, caps_icq); |
4422 aim_locate_setprofile(od->sess, NULL, "", 0, NULL, NULL, 0); |
| 4420 else { |
4423 return; |
| 4421 if (!text) { |
4424 } |
| 4422 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, NULL, 0, caps_aim); |
|
| 4423 return; |
|
| 4424 } |
|
| 4425 |
4425 |
| 4426 text_html = gaim_strdup_withhtml(text); |
4426 text_html = gaim_strdup_withhtml(text); |
| 4427 flags = oscar_encoding_check(text_html); |
4427 flags = oscar_encoding_check(text_html); |
| 4428 if (flags & AIM_IMFLAGS_UNICODE) { |
4428 if (flags & AIM_IMFLAGS_UNICODE) { |
| 4429 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
4429 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
| 4430 aim_locate_setprofile(od->sess, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); |
4430 aim_locate_setprofile(od->sess, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); |
| 4431 g_free(msg); |
4431 g_free(msg); |
| 4432 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { |
4432 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { |
| 4433 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
4433 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
| 4434 aim_locate_setprofile(od->sess, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); |
4434 aim_locate_setprofile(od->sess, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); |
| 4435 g_free(msg); |
4435 g_free(msg); |
| 4436 } else { |
4436 } else { |
| 4437 msglen = strlen(text_html); |
4437 msglen = strlen(text_html); |
| 4438 aim_locate_setprofile(od->sess, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); |
4438 aim_locate_setprofile(od->sess, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); |
| 4439 } |
4439 } |
| 4440 |
4440 |
| 4441 if (msglen > od->rights.maxsiglen) { |
4441 if (msglen > od->rights.maxsiglen) { |
| 4442 gchar *errstr; |
4442 gchar *errstr; |
| 4443 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " |
4443 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " |
| 4444 "has been exceeded. Gaim has truncated it for you.", |
4444 "has been exceeded. Gaim has truncated it for you.", |
| 4445 "The maximum profile length of %d bytes " |
4445 "The maximum profile length of %d bytes " |
| 4446 "has been exceeded. Gaim has truncated it for you.", |
4446 "has been exceeded. Gaim has truncated it for you.", |
| 4447 od->rights.maxsiglen), od->rights.maxsiglen); |
4447 od->rights.maxsiglen), od->rights.maxsiglen); |
| 4448 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); |
4448 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); |
| 4449 g_free(errstr); |
4449 g_free(errstr); |
| 4450 } |
4450 } |
| 4451 |
4451 |
| 4452 g_free(text_html); |
4452 g_free(text_html); |
| 4453 |
|
| 4454 } |
|
| 4455 |
4453 |
| 4456 return; |
4454 return; |
| 4457 } |
4455 } |
| 4458 |
4456 |
| 4459 static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *text) |
4457 static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *text) |
| 4475 g_free(gc->away); |
4473 g_free(gc->away); |
| 4476 gc->away = NULL; |
4474 gc->away = NULL; |
| 4477 } |
4475 } |
| 4478 |
4476 |
| 4479 if (!text) { |
4477 if (!text) { |
| 4480 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0, caps_aim); |
4478 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
| 4481 return; |
4479 return; |
| 4482 } |
4480 } |
| 4483 |
4481 |
| 4484 text_html = gaim_strdup_withhtml(text); |
4482 text_html = gaim_strdup_withhtml(text); |
| 4485 flags = oscar_encoding_check(text_html); |
4483 flags = oscar_encoding_check(text_html); |
| 4486 if (flags & AIM_IMFLAGS_UNICODE) { |
4484 if (flags & AIM_IMFLAGS_UNICODE) { |
| 4487 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
4485 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
| 4488 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg, |
4486 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg, |
| 4489 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); |
4487 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
| 4490 g_free(msg); |
4488 g_free(msg); |
| 4491 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); |
4489 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); |
| 4492 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { |
4490 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { |
| 4493 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
4491 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
| 4494 aim_locate_setprofile(od->sess, NULL, NULL, 0, "iso-8859-1", msg, |
4492 aim_locate_setprofile(od->sess, NULL, NULL, 0, "iso-8859-1", msg, |
| 4495 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); |
4493 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
| 4496 g_free(msg); |
4494 g_free(msg); |
| 4497 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
4495 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
| 4498 } else { |
4496 } else { |
| 4499 msglen = strlen(text_html); |
4497 msglen = strlen(text_html); |
| 4500 aim_locate_setprofile(od->sess, NULL, NULL, 0, "us-ascii", text_html, |
4498 aim_locate_setprofile(od->sess, NULL, NULL, 0, "us-ascii", text_html, |
| 4501 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); |
4499 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
| 4502 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
4500 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
| 4503 } |
4501 } |
| 4504 |
4502 |
| 4505 if (msglen > od->rights.maxawaymsglen) { |
4503 if (msglen > od->rights.maxawaymsglen) { |
| 4506 gchar *errstr; |
4504 gchar *errstr; |
| 4626 } |
4624 } |
| 4627 aim_buddylist_set(od->sess, od->conn, buf); |
4625 aim_buddylist_set(od->sess, od->conn, buf); |
| 4628 #else |
4626 #else |
| 4629 if (od->sess->ssi.received_data) { |
4627 if (od->sess->ssi.received_data) { |
| 4630 while (buddies) { |
4628 while (buddies) { |
| 4631 GaimBuddy *buddy = gaim_find_buddy(gc->account, (const char *)buddies->data); |
4629 oscar_add_buddy(gc, (const char *)buddies->data, NULL); |
| 4632 GaimGroup *group = gaim_find_buddys_group(buddy); |
|
| 4633 if (buddy && group) { |
|
| 4634 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
|
| 4635 "ssi: adding buddy %s to group %s\n", (const char *)buddies->data, group->name); |
|
| 4636 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
|
| 4637 } |
|
| 4638 buddies = buddies->next; |
4630 buddies = buddies->next; |
| 4639 } |
4631 } |
| 4640 } |
4632 } |
| 4641 #endif |
4633 #endif |
| 4642 } |
4634 } |
| 5321 return "aim"; |
5313 return "aim"; |
| 5322 } |
5314 } |
| 5323 |
5315 |
| 5324 static void oscar_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) |
5316 static void oscar_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) |
| 5325 { |
5317 { |
| |
5318 GaimAccount *account = NULL; |
| |
5319 GaimConnection *gc = NULL; |
| |
5320 OscarData *od = NULL; |
| 5326 char *emblems[4] = {NULL,NULL,NULL,NULL}; |
5321 char *emblems[4] = {NULL,NULL,NULL,NULL}; |
| 5327 int i = 0; |
5322 int i = 0; |
| |
5323 aim_userinfo_t *userinfo = NULL; |
| |
5324 |
| |
5325 if (b != NULL) |
| |
5326 account = b->account; |
| |
5327 if (account != NULL) |
| |
5328 gc = account->gc; |
| |
5329 if (gc != NULL) |
| |
5330 od = gc->proto_data; |
| 5328 |
5331 |
| 5329 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5332 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
| 5330 GaimAccount *account; |
|
| 5331 GaimConnection *gc; |
|
| 5332 OscarData *od; |
|
| 5333 char *gname; |
5333 char *gname; |
| 5334 if ((b->name) && (account = b->account) && (gc = account->gc) && |
5334 if ((b->name) && (od) && (od->sess->ssi.received_data) && |
| 5335 (od = gc->proto_data) && (od->sess->ssi.received_data) && |
|
| 5336 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && |
5335 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && |
| 5337 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { |
5336 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { |
| 5338 emblems[i++] = "notauthorized"; |
5337 emblems[i++] = "notauthorized"; |
| 5339 } else { |
5338 } else { |
| 5340 emblems[i++] = "offline"; |
5339 emblems[i++] = "offline"; |