| 2907 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
2907 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
| 2908 signon = info->onlinesince; |
2908 signon = info->onlinesince; |
| 2909 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) |
2909 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) |
| 2910 signon = time(NULL) - info->sessionlen; |
2910 signon = time(NULL) - info->sessionlen; |
| 2911 |
2911 |
| 2912 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn)) |
2912 if (!aim_sncmp(gaim_account_get_username(account), info->sn)) |
| 2913 gaim_connection_set_display_name(gc, info->sn); |
2913 gaim_connection_set_display_name(gc, info->sn); |
| 2914 |
2914 |
| 2915 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
2915 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, info->sn)); |
| 2916 if (!bi) { |
2916 if (!bi) { |
| 2917 bi = g_new0(struct buddyinfo, 1); |
2917 bi = g_new0(struct buddyinfo, 1); |
| 2918 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, info->sn)), bi); |
2918 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, info->sn)), bi); |
| 2919 } |
2919 } |
| 2920 bi->typingnot = FALSE; |
2920 bi->typingnot = FALSE; |
| 2921 bi->ico_informed = FALSE; |
2921 bi->ico_informed = FALSE; |
| 2922 bi->ipaddr = info->icqinfo.ipaddr; |
2922 bi->ipaddr = info->icqinfo.ipaddr; |
| 2923 |
2923 |
| 2933 const char *filename = NULL, *saved_b16 = NULL; |
2933 const char *filename = NULL, *saved_b16 = NULL; |
| 2934 char *b16 = NULL, *filepath = NULL; |
2934 char *b16 = NULL, *filepath = NULL; |
| 2935 GaimBuddy *b = NULL; |
2935 GaimBuddy *b = NULL; |
| 2936 |
2936 |
| 2937 b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen); |
2937 b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen); |
| 2938 b = gaim_find_buddy(gc->account, info->sn); |
2938 b = gaim_find_buddy(account, info->sn); |
| 2939 /* |
2939 /* |
| 2940 * If for some reason the checksum is valid, but cached file is not.. |
2940 * If for some reason the checksum is valid, but cached file is not.. |
| 2941 * we want to know. |
2941 * we want to know. |
| 2942 */ |
2942 */ |
| 2943 filename = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon"); |
2943 filename = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon"); |
| 2959 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { |
2959 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { |
| 2960 GSList *cur = od->requesticon; |
2960 GSList *cur = od->requesticon; |
| 2961 while (cur && aim_sncmp((char *)cur->data, info->sn)) |
2961 while (cur && aim_sncmp((char *)cur->data, info->sn)) |
| 2962 cur = cur->next; |
2962 cur = cur->next; |
| 2963 if (!cur) { |
2963 if (!cur) { |
| 2964 od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(gc->account, info->sn))); |
2964 od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(account, info->sn))); |
| 2965 if (od->icontimer) |
2965 if (od->icontimer) |
| 2966 gaim_timeout_remove(od->icontimer); |
2966 gaim_timeout_remove(od->icontimer); |
| 2967 od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc); |
2967 od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc); |
| 2968 } |
2968 } |
| 2969 } |
2969 } |
| 2970 g_free(b16); |
2970 g_free(b16); |
| 2971 } |
2971 } |
| 2972 |
2972 |
| 2973 /* |
2973 gaim_debug_info("oscar", "Signaling got online status for buddy '%s'\n", info->sn); |
| 2974 * If we have info for ourselves, then update our local warning |
2974 |
| 2975 * level and set our official time of login. Is this necessary? |
2975 gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_ONLINE, NULL); |
| 2976 * XXX - This needs to be changed some how. evil should not be |
2976 gaim_prpl_got_user_login_time(account, info->sn, signon); |
| 2977 * handled by the core at all? |
2977 gaim_prpl_got_user_warning_level(account, info->sn, info->warnlevel/10.0 + 0.5); |
| 2978 */ |
2978 |
| 2979 if (!aim_sncmp(info->sn, gaim_account_get_username(account))) { |
2979 if (time_idle > 0) |
| 2980 gc->evil = (info->warnlevel/10.0); |
2980 gaim_prpl_got_user_idle(account, info->sn, TRUE, time_idle); |
| 2981 gc->login_time_official = signon; |
|
| 2982 } |
|
| 2983 |
|
| 2984 /* STATUS - time_idle is idle time, type is type, info->warnlevel/10.0 is warning level */ |
|
| 2985 serv_got_update(gc, info->sn, TRUE, signon); |
|
| 2986 |
2981 |
| 2987 return 1; |
2982 return 1; |
| 2988 } |
2983 } |
| 2989 |
2984 |
| 2990 static void gaim_check_comment(OscarData *od, const char *str) { |
2985 static void gaim_check_comment(OscarData *od, const char *str) { |
| 2995 } |
2990 } |
| 2996 |
2991 |
| 2997 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2992 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 2998 GaimConnection *gc = sess->aux_data; |
2993 GaimConnection *gc = sess->aux_data; |
| 2999 OscarData *od = gc->proto_data; |
2994 OscarData *od = gc->proto_data; |
| |
2995 GaimAccount *account = gaim_connection_get_account(gc); |
| 3000 va_list ap; |
2996 va_list ap; |
| 3001 aim_userinfo_t *info; |
2997 aim_userinfo_t *info; |
| 3002 |
2998 |
| 3003 va_start(ap, fr); |
2999 va_start(ap, fr); |
| 3004 info = va_arg(ap, aim_userinfo_t *); |
3000 info = va_arg(ap, aim_userinfo_t *); |
| 3005 va_end(ap); |
3001 va_end(ap); |
| 3006 |
3002 |
| 3007 serv_got_update(gc, info->sn, FALSE, 0); |
3003 gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_OFFLINE, NULL); |
| 3008 |
3004 |
| 3009 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
3005 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
| 3010 |
3006 |
| 3011 return 1; |
3007 return 1; |
| 3012 } |
3008 } |
| 4677 |
4673 |
| 4678 return 1; |
4674 return 1; |
| 4679 } |
4675 } |
| 4680 |
4676 |
| 4681 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
4677 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
| |
4678 GaimConnection *gc = sess->aux_data; |
| |
4679 GaimAccount *account = gaim_connection_get_account(gc); |
| 4682 va_list ap; |
4680 va_list ap; |
| 4683 fu16_t newevil; |
4681 fu16_t newevil; |
| 4684 aim_userinfo_t *userinfo; |
4682 aim_userinfo_t *userinfo; |
| 4685 GaimConnection *gc = sess->aux_data; |
|
| 4686 |
4683 |
| 4687 va_start(ap, fr); |
4684 va_start(ap, fr); |
| 4688 newevil = (fu16_t) va_arg(ap, unsigned int); |
4685 newevil = (fu16_t) va_arg(ap, unsigned int); |
| 4689 userinfo = va_arg(ap, aim_userinfo_t *); |
4686 userinfo = va_arg(ap, aim_userinfo_t *); |
| 4690 va_end(ap); |
4687 va_end(ap); |
| 4691 |
4688 |
| 4692 serv_got_eviled(gc, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5); |
4689 /* XXX - What's with the + 0.5? */ |
| |
4690 gaim_prpl_got_account_warning_level(account, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5); |
| 4693 |
4691 |
| 4694 return 1; |
4692 return 1; |
| 4695 } |
4693 } |
| 4696 |
4694 |
| 4697 static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
4695 static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
| |
4696 GaimConnection *gc = sess->aux_data; |
| |
4697 GaimAccount *account = gaim_connection_get_account(gc); |
| |
4698 int warning_level; |
| 4698 va_list ap; |
4699 va_list ap; |
| 4699 aim_userinfo_t *info; |
4700 aim_userinfo_t *info; |
| 4700 GaimConnection *gc = sess->aux_data; |
|
| 4701 |
4701 |
| 4702 va_start(ap, fr); |
4702 va_start(ap, fr); |
| 4703 info = va_arg(ap, aim_userinfo_t *); |
4703 info = va_arg(ap, aim_userinfo_t *); |
| 4704 va_end(ap); |
4704 va_end(ap); |
| 4705 |
4705 |
| 4706 gc->evil = (info->warnlevel/10.0) + 0.5; |
4706 warning_level = info->warnlevel/10.0 + 0.5; |
| 4707 |
4707 |
| 4708 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
4708 /* |
| 4709 gc->login_time_official = info->onlinesince; |
4709 * XXX - Calling this is probably not good. We just want to set the |
| 4710 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) |
4710 * warning level for our account, not tell the user that we were just |
| 4711 gc->login_time_official = time(NULL) - info->sessionlen; |
4711 * warned. |
| |
4712 */ |
| |
4713 gaim_prpl_got_account_warning_level(account, NULL, warning_level); |
| 4712 |
4714 |
| 4713 return 1; |
4715 return 1; |
| 4714 } |
4716 } |
| 4715 |
4717 |
| 4716 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4718 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
| 6088 /* We don't want to change Gaim's setting because it applies to all accounts */ |
6093 /* We don't want to change Gaim's setting because it applies to all accounts */ |
| 6089 } break; |
6094 } break; |
| 6090 } /* End of switch on curitem->type */ |
6095 } /* End of switch on curitem->type */ |
| 6091 } /* End of for loop */ |
6096 } /* End of for loop */ |
| 6092 |
6097 |
| 6093 /* Set our ICQ status */ |
6098 /* XXX - STATUS - Set our ICQ status */ |
| 6094 if (!gc->away) { |
6099 status = gaim_presence_get_active_status(account->presence); |
| |
6100 if (gaim_status_is_available(status)) |
| 6095 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); |
6101 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); |
| 6096 } |
|
| 6097 |
6102 |
| 6098 /* Activate SSI */ |
6103 /* Activate SSI */ |
| 6099 /* Sending the enable causes other people to be able to see you, and you to see them */ |
6104 /* Sending the enable causes other people to be able to see you, and you to see them */ |
| 6100 /* Make sure your privacy setting/invisibility is set how you want it before this! */ |
6105 /* Make sure your privacy setting/invisibility is set how you want it before this! */ |
| 6101 gaim_debug_info("oscar", |
6106 gaim_debug_info("oscar", |
| 6818 |
6823 |
| 6819 g_return_val_if_fail(account != NULL, NULL); |
6824 g_return_val_if_fail(account != NULL, NULL); |
| 6820 |
6825 |
| 6821 is_icq = aim_sn_is_icq(gaim_account_get_username(account)); |
6826 is_icq = aim_sn_is_icq(gaim_account_get_username(account)); |
| 6822 |
6827 |
| 6823 type = gaim_status_type_new_full(GAIM_STATUS_HIDDEN, OSCAR_STATUS_ID_INVISIBLE, _("Invisible"), FALSE, TRUE, FALSE); |
|
| 6824 status_types = g_list_append(status_types, type); |
|
| 6825 |
|
| 6826 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, OSCAR_STATUS_ID_OFFLINE, _("Offline"), FALSE, FALSE, FALSE); |
6828 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, OSCAR_STATUS_ID_OFFLINE, _("Offline"), FALSE, FALSE, FALSE); |
| 6827 status_types = g_list_append(status_types, type); |
6829 status_types = g_list_append(status_types, type); |
| 6828 |
6830 |
| 6829 type = gaim_status_type_new_full(GAIM_STATUS_ONLINE, OSCAR_STATUS_ID_ONLINE, _("Online"), FALSE, FALSE, FALSE); |
6831 type = gaim_status_type_new_full(GAIM_STATUS_ONLINE, OSCAR_STATUS_ID_ONLINE, _("Online"), FALSE, FALSE, FALSE); |
| 6830 status_types = g_list_append(status_types, type); |
6832 status_types = g_list_append(status_types, type); |
| 6831 |
6833 |
| 6832 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, OSCAR_STATUS_ID_AWAY, _("Away"), FALSE, TRUE, FALSE); |
6834 type = gaim_status_type_new_full(GAIM_STATUS_HIDDEN, OSCAR_STATUS_ID_INVISIBLE, _("Invisible"), TRUE, TRUE, TRUE); |
| 6833 status_types = g_list_append(status_types, type); |
6835 status_types = g_list_append(status_types, type); |
| 6834 |
6836 |
| 6835 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, OSCAR_STATUS_ID_DND, _("Do Not Disturb"), FALSE, TRUE, FALSE); |
6837 type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, OSCAR_STATUS_ID_AVAILABLE, _("Available"), TRUE, TRUE, FALSE); |
| 6836 status_types = g_list_append(status_types, type); |
6838 status_types = g_list_append(status_types, type); |
| 6837 |
6839 |
| 6838 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, OSCAR_STATUS_ID_NA, _("Not Available"), FALSE, TRUE, FALSE); |
6840 type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, OSCAR_STATUS_ID_FREE4CHAT, _("Free For Chat"), TRUE, TRUE, FALSE); |
| 6839 status_types = g_list_append(status_types, type); |
6841 status_types = g_list_append(status_types, type); |
| 6840 |
6842 |
| 6841 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, OSCAR_STATUS_ID_OCCUPIED, _("Occupied"), FALSE, TRUE, FALSE); |
6843 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, OSCAR_STATUS_ID_AWAY, _("Away"), TRUE, TRUE, FALSE); |
| 6842 status_types = g_list_append(status_types, type); |
6844 status_types = g_list_append(status_types, type); |
| 6843 |
6845 |
| 6844 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, OSCAR_STATUS_ID_FREE4CHAT, _("Free For Chat"), FALSE, TRUE, FALSE); |
6846 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, OSCAR_STATUS_ID_OCCUPIED, _("Occupied"), TRUE, TRUE, FALSE); |
| |
6847 status_types = g_list_append(status_types, type); |
| |
6848 |
| |
6849 type = gaim_status_type_new_full(GAIM_STATUS_EXTENDED_AWAY, OSCAR_STATUS_ID_DND, _("Do Not Disturb"), TRUE, TRUE, FALSE); |
| |
6850 status_types = g_list_append(status_types, type); |
| |
6851 |
| |
6852 type = gaim_status_type_new_full(GAIM_STATUS_EXTENDED_AWAY, OSCAR_STATUS_ID_NA, _("Not Available"), TRUE, TRUE, FALSE); |
| 6845 status_types = g_list_append(status_types, type); |
6853 status_types = g_list_append(status_types, type); |
| 6846 |
6854 |
| 6847 return status_types; |
6855 return status_types; |
| 6848 |
6856 |
| 6849 /* |
6857 /* |