# HG changeset patch # User Mark Doliner # Date 1131131705 0 # Node ID aadf61b30056f9f883d96ba167943d281c3df29d # Parent 2ff2965895f3e8372e2e48e0c9302ce32d6b4c2a [gaim-migrate @ 14268] 1. Fix the I'dle Mak'er plugin 2. Show a friendly "none of your accounts are idle" message in the I'dle Mak'er plugin when attempting to unidle your accounts and none of them are idle 3. HIGify the capitalization of the I'dle Mak'er menu items 4. i18n system log "signed on" and "signed off" messages 5. Log when your accounts become idle and unidle 6. Add default saved statuses if the user has no saved statuses 7. Removed serv_set_idle(). Use gaim_presence_set_idle() instead. committer: Tailor Script diff -r 2ff2965895f3 -r aadf61b30056 plugins/idle.c --- a/plugins/idle.c Fri Nov 04 18:01:55 2005 +0000 +++ b/plugins/idle.c Fri Nov 04 19:15:05 2005 +0000 @@ -26,6 +26,7 @@ #include "connection.h" #include "debug.h" +#include "notify.h" #include "plugin.h" #include "request.h" #include "server.h" @@ -134,6 +135,12 @@ GaimRequestFieldGroup *group; GaimRequestField *field; + if (idled_accts == NULL) + { + gaim_notify_info(NULL, NULL, _("None of your accounts are idle."), NULL); + return; + } + group = gaim_request_field_group_new(NULL); field = gaim_request_field_account_new("acct", _("Account"), NULL); @@ -177,16 +184,16 @@ GList *l = NULL; GaimPluginAction *act = NULL; - act = gaim_plugin_action_new(_("Set Account Idle Time"), + act = gaim_plugin_action_new(_("Set account idle time"), idle_action); l = g_list_append(l, act); - act = gaim_plugin_action_new(_("Unset Account Idle Time"), + act = gaim_plugin_action_new(_("Unset account idle time"), unidle_action); l = g_list_append(l, act); act = gaim_plugin_action_new( - _("Unset Idle Time For All Idled Accounts"), unidle_all_action); + _("Unset idle time for all idled accounts"), unidle_all_action); l = g_list_append(l, act); return l; diff -r 2ff2965895f3 -r aadf61b30056 plugins/perl/common/Server.xs --- a/plugins/perl/common/Server.xs Fri Nov 04 18:01:55 2005 +0000 +++ b/plugins/perl/common/Server.xs Fri Nov 04 19:15:05 2005 +0000 @@ -210,11 +210,6 @@ const char *filename void -serv_set_idle(con, a) - Gaim::Connection con - int a - -void serv_set_info(con, a) Gaim::Connection con const char * a diff -r 2ff2965895f3 -r aadf61b30056 src/connection.c --- a/src/connection.c Fri Nov 04 18:01:55 2005 +0000 +++ b/src/connection.c Fri Nov 04 19:15:05 2005 +0000 @@ -195,8 +195,6 @@ if (remove) gaim_blist_remove_account(account); - /* LOG system_log(log_signoff, gc, NULL, - OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); */ gaim_signal_emit(gaim_connections_get_handle(), "signed-off", gc); #if 0 @@ -279,7 +277,7 @@ if (gaim_prefs_get_bool("/core/logging/log_system")) { GaimLog *log = gaim_account_get_log(account); - char *msg = g_strdup_printf("+++ %s signed on", + char *msg = g_strdup_printf(_("+++ %s signed on"), gaim_account_get_username(account)); gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_account_get_username(account), @@ -322,7 +320,7 @@ if (gaim_prefs_get_bool("/core/logging/log_system")) { GaimLog *log = gaim_account_get_log(account); - char *msg = g_strdup_printf("+++ %s signed off", + char *msg = g_strdup_printf(_("+++ %s signed off"), gaim_account_get_username(account)); gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_account_get_username(account), time(NULL), diff -r 2ff2965895f3 -r aadf61b30056 src/gtkidle.c --- a/src/gtkidle.c Fri Nov 04 18:01:55 2005 +0000 +++ b/src/gtkidle.c Fri Nov 04 19:15:05 2005 +0000 @@ -51,6 +51,15 @@ } GaimAutoAwayState; +/** + * This is needed for the I'dle Mak'er plugin to work correctly. We + * use it to determine if we're the ones who set our accounts idle + * or if someone else did it (the I'dle Mak'er plugin, for example). + * If our accounts are marked as idle and have_set_idle is FALSE and + * the user moves the mouse, then we will NOT unidle our accounts. + */ +static gboolean have_set_idle = FALSE; + #ifdef USE_SCREENSAVER /** * Get the number of seconds the user has been idle. In Unix-world @@ -181,18 +190,16 @@ } /* Deal with reporting idleness to the server, if appropriate */ - if (report_idle && idle_time >= IDLEMARK && !gaim_presence_is_idle(presence)) { + if (report_idle && idle_time >= IDLEMARK && !have_set_idle && !gaim_presence_is_idle(presence)) { gaim_debug_info("idle", "Setting %s idle %d seconds\n", gaim_account_get_username(account), idle_time); - serv_set_idle(gc, idle_time); gaim_presence_set_idle(presence, TRUE, time(NULL)); - /* LOG system_log(log_idle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON); */ - } else if ((!report_idle || idle_time < IDLEMARK) && gaim_presence_is_idle(presence)) { + have_set_idle = TRUE; + } else if ((!report_idle || idle_time < IDLEMARK) && have_set_idle && gaim_presence_is_idle(presence)) { gaim_debug_info("idle", "Setting %s unidle\n", gaim_account_get_username(account)); gaim_presence_set_idle(presence, FALSE, time(NULL)); - serv_set_idle(gc, 0); - /* LOG system_log(log_unidle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON); */ + have_set_idle = FALSE; } return TRUE; diff -r 2ff2965895f3 -r aadf61b30056 src/savedstatuses.c --- a/src/savedstatuses.c Fri Nov 04 18:01:55 2005 +0000 +++ b/src/savedstatuses.c Fri Nov 04 19:15:05 2005 +0000 @@ -560,6 +560,21 @@ gaim_savedstatuses_init(void) { load_statuses(); + + if (saved_statuses == NULL) + { + /* + * We don't have any saved statuses! This is probably a new account, + * so we add the "Default" status and the "Default when idle" status. + */ + GaimSavedStatus *saved_status; + + saved_status = gaim_savedstatus_new(_("Default"), GAIM_STATUS_AVAILABLE); + gaim_savedstatus_set_message(saved_status, _("Hello!")); + + saved_status = gaim_savedstatus_new(_("Default when idle"), GAIM_STATUS_AWAY); + gaim_savedstatus_set_message(saved_status, _("I'm not here right now")); + } } void diff -r 2ff2965895f3 -r aadf61b30056 src/server.c --- a/src/server.c Fri Nov 04 18:01:55 2005 +0000 +++ b/src/server.c Fri Nov 04 19:15:05 2005 +0000 @@ -323,19 +323,6 @@ prpl_info->set_permit_deny(g); } - -void serv_set_idle(GaimConnection *g, int time) -{ - GaimPluginProtocolInfo *prpl_info = NULL; - - if (g != NULL && g->prpl != NULL) - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); - - if (prpl_info && g_list_find(gaim_connections_get_all(), g) && prpl_info->set_idle) - prpl_info->set_idle(g, time); -} - - void serv_join_chat(GaimConnection *g, GHashTable *data) { GaimPluginProtocolInfo *prpl_info = NULL; diff -r 2ff2965895f3 -r aadf61b30056 src/server.h --- a/src/server.h Fri Nov 04 18:01:55 2005 +0000 +++ b/src/server.h Fri Nov 04 19:15:05 2005 +0000 @@ -35,7 +35,6 @@ int serv_send_im(GaimConnection *, const char *, const char *, GaimConvImFlags); void serv_get_info(GaimConnection *, const char *); -void serv_set_idle(GaimConnection *, int); void serv_set_info(GaimConnection *, const char *); int serv_send_typing(GaimConnection *, const char *, int); void serv_move_buddy(GaimBuddy *, GaimGroup *, GaimGroup *); diff -r 2ff2965895f3 -r aadf61b30056 src/status.c --- a/src/status.c Fri Nov 04 18:01:55 2005 +0000 +++ b/src/status.c Fri Nov 04 19:15:05 2005 +0000 @@ -1325,10 +1325,26 @@ } else if(gaim_presence_get_context(presence) == GAIM_PRESENCE_CONTEXT_ACCOUNT) { - GaimConnection *gc = - gaim_account_get_connection(gaim_presence_get_account(presence)); + GaimAccount *account; + GaimLog *log; + char *msg; + GaimConnection *gc; GaimPluginProtocolInfo *prpl_info = NULL; + account = gaim_presence_get_account(presence); + log = gaim_account_get_log(account); + + if (idle) + msg = g_strdup_printf(_("+++ %s became idle"), gaim_account_get_username(account)); + else + msg = g_strdup_printf(_("+++ %s became unidle"), gaim_account_get_username(account)); + gaim_log_write(log, GAIM_MESSAGE_SYSTEM, + gaim_account_get_username(account), + idle_time, msg); + g_free(msg); + + gc = gaim_account_get_connection(account); + if (gc != NULL && gc->prpl != NULL) prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); @@ -1657,7 +1673,7 @@ gaim_prefs_add_none("/core/status/scores"); gaim_prefs_add_string("/core/status/current", _("Default")); - gaim_prefs_add_string("/core/status/idleaway", _("Default auto-away")); + gaim_prefs_add_string("/core/status/idleaway", _("Default when idle")); gaim_prefs_add_int("/core/status/scores/offline", primitive_scores[GAIM_STATUS_OFFLINE]);