comparison src/protocols/oscar/oscar.c @ 11510:25699eed3c37

[gaim-migrate @ 13755] Add support for displaying some more ICQ statuses for buddies. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 11 Sep 2005 16:05:47 +0000
parents d5e4a3af7934
children a26eb48d1953
comparison
equal deleted inserted replaced
11509:fca94aa83486 11510:25699eed3c37
755 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn)); 755 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn));
756 756
757 if (b != NULL) { 757 if (b != NULL) {
758 if (gaim_presence_is_online(presence)) { 758 if (gaim_presence_is_online(presence)) {
759 if (aim_sn_is_icq(b->name)) { 759 if (aim_sn_is_icq(b->name)) {
760 tmp = oscar_icqstatus((b->uc & 0xffff0000) >> 16); 760 GaimStatus *status = gaim_presence_get_active_status(presence);
761 oscar_string_append(str, newline, _("Status"), tmp); 761 oscar_string_append(str, newline, _("Status"), gaim_status_get_name(status));
762 g_free(tmp);
763 } 762 }
764 } else { 763 } else {
765 tmp = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); 764 tmp = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name);
766 if (aim_ssi_waitingforauth(od->sess->ssi.local, tmp, b->name)) 765 if (aim_ssi_waitingforauth(od->sess->ssi.local, tmp, b->name))
767 oscar_string_append(str, newline, _("Status"), _("Not Authorized")); 766 oscar_string_append(str, newline, _("Status"), _("Not Authorized"));
3487 int type = 0; 3486 int type = 0;
3488 int caps = 0; 3487 int caps = 0;
3489 va_list ap; 3488 va_list ap;
3490 aim_userinfo_t *info; 3489 aim_userinfo_t *info;
3491 gboolean buddy_is_away = FALSE; 3490 gboolean buddy_is_away = FALSE;
3491 const char *status_id;
3492 3492
3493 gc = sess->aux_data; 3493 gc = sess->aux_data;
3494 account = gaim_connection_get_account(gc); 3494 account = gaim_connection_get_account(gc);
3495 od = gc->proto_data; 3495 od = gc->proto_data;
3496 3496
3507 if (info->present & AIM_USERINFO_PRESENT_FLAGS) { 3507 if (info->present & AIM_USERINFO_PRESENT_FLAGS) {
3508 if (info->flags & AIM_FLAG_AWAY) 3508 if (info->flags & AIM_FLAG_AWAY)
3509 buddy_is_away = TRUE; 3509 buddy_is_away = TRUE;
3510 } 3510 }
3511 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { 3511 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) {
3512 type = (info->icqinfo.status << 16); 3512 type = info->icqinfo.status;
3513 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && 3513 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) &&
3514 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { 3514 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) {
3515 buddy_is_away = TRUE; 3515 buddy_is_away = TRUE;
3516 } 3516 }
3517 } 3517 }
3598 } 3598 }
3599 } 3599 }
3600 g_free(b16); 3600 g_free(b16);
3601 } 3601 }
3602 3602
3603 /* XXX - Represent other ICQ statuses */ 3603 if (aim_sn_is_icq(info->sn)) {
3604 if (buddy_is_away == TRUE) 3604 if (type & AIM_ICQ_STATE_CHAT)
3605 gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_AWAY, NULL); 3605 status_id = OSCAR_STATUS_ID_FREE4CHAT;
3606 else 3606 else if (type & AIM_ICQ_STATE_DND)
3607 gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_AVAILABLE, NULL); 3607 status_id = OSCAR_STATUS_ID_DND;
3608 else if (type & AIM_ICQ_STATE_OUT)
3609 status_id = OSCAR_STATUS_ID_NA;
3610 else if (type & AIM_ICQ_STATE_BUSY)
3611 status_id = OSCAR_STATUS_ID_OCCUPIED;
3612 else if (type & AIM_ICQ_STATE_AWAY)
3613 status_id = OSCAR_STATUS_ID_AWAY;
3614 else if (type & AIM_ICQ_STATE_INVISIBLE)
3615 status_id = OSCAR_STATUS_ID_INVISIBLE;
3616 else
3617 status_id = OSCAR_STATUS_ID_AVAILABLE;
3618 } else {
3619 if (buddy_is_away == TRUE)
3620 status_id = OSCAR_STATUS_ID_AWAY;
3621 else
3622 status_id = OSCAR_STATUS_ID_AVAILABLE;
3623 }
3624 gaim_prpl_got_user_status(account, info->sn, status_id, NULL);
3608 gaim_prpl_got_user_login_time(account, info->sn, signon - od->timeoffset); 3625 gaim_prpl_got_user_login_time(account, info->sn, signon - od->timeoffset);
3609 // gaim_prpl_got_user_warning_level(account, info->sn, info->warnlevel/10.0 + 0.5); 3626 // gaim_prpl_got_user_warning_level(account, info->sn, info->warnlevel/10.0 + 0.5);
3610 3627
3611 if (time_idle > 0) 3628 if (time_idle > 0)
3612 gaim_prpl_got_user_idle(account, info->sn, TRUE, time_idle); 3629 gaim_prpl_got_user_idle(account, info->sn, TRUE, time_idle);
7587 { 7604 {
7588 struct buddyinfo *bi; 7605 struct buddyinfo *bi;
7589 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); 7606 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name));
7590 if ((bi != NULL) && (bi->availmsg != NULL)) 7607 if ((bi != NULL) && (bi->availmsg != NULL))
7591 ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); 7608 ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg));
7609 else if (aim_sn_is_icq(b->name)) {
7610 GaimStatus *status = gaim_presence_get_active_status(presence);
7611 ret = g_strdup(gaim_status_get_name(status));
7612 }
7592 } 7613 }
7593 else 7614 else
7594 { 7615 {
7595 if (aim_sn_is_icq(b->name)) 7616 if (aim_sn_is_icq(b->name)) {
7596 ret = oscar_icqstatus((b->uc & 0xffff0000) >> 16); 7617 GaimStatus *status = gaim_presence_get_active_status(presence);
7597 else 7618 ret = g_strdup(gaim_status_get_name(status));
7619 } else
7598 ret = g_strdup(_("Away")); 7620 ret = g_strdup(_("Away"));
7599 } 7621 }
7600 7622
7601 return ret; 7623 return ret;
7602 } 7624 }