Mercurial > pidgin
view plugins/idle.c @ 9798:255596f41014
[gaim-migrate @ 10666]
This is patch number 1002252 by Joe Shaw.
He writes:
If you start a file transfer with a yahoo user and then
unplug the network, wait a couple minutes, and plug it
back in, a minute or so later the gaim UI will
completely freeze, eventually consume all your memory
and crash.
This is because ft.c:transfer_cb() does not correctly
handle the case in which both READ and WRITE conditions
are coming in, and because the yahoo_xfer_read() and
yahoo_xfer_write() functions are incorrectly returning
0 on errors instead of -1.
Since transfer_cb() is getting both conditions, it only
checks READ first and gets back 0 bytes (because the
connection has been hung up). 0 is not explicitly
handled, so nothing is done and we get ourselves into
an infinite loop.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Sat, 21 Aug 2004 02:02:25 +0000 |
parents | 67421e0dc497 |
children | f8e395a054e2 |
line wrap: on
line source
/* a nifty little plugin to set your idle time to whatever you want it to be. * useful for almost nothing. mostly just a demo plugin. but it's fun to have * 40-day idle times. */ #include "internal.h" #include "connection.h" #include "debug.h" #include "plugin.h" #include "request.h" #include "server.h" #define IDLE_PLUGIN_ID "gtk-idle" static void idle_action_ok(void *ignored, GaimRequestFields *fields) { time_t t; int tm; GaimAccount *acct; GaimConnection *gc; tm = gaim_request_fields_get_integer(fields, "mins"); acct = gaim_request_fields_get_account(fields, "acct"); gc = gaim_account_get_connection(acct); gaim_debug(GAIM_DEBUG_INFO, "idle", "setting idle time for %s to %d\n", gaim_account_get_username(acct), tm); time(&t); t -= 60 * tm; gc->last_sent_time = t; serv_set_idle(gc, 60 * tm); gc->is_idle = 0; } static void idle_action(GaimPluginAction *action) { /* Use the super fancy request API */ GaimRequestFields *request; GaimRequestFieldGroup *group; GaimRequestField *field; group = gaim_request_field_group_new(NULL); field = gaim_request_field_account_new("acct", _("Account"), NULL); gaim_request_field_account_set_show_all(field, FALSE); gaim_request_field_group_add_field(group, field); field = gaim_request_field_int_new("mins", _("Minutes"), 10); gaim_request_field_group_add_field(group, field); request = gaim_request_fields_new(); gaim_request_fields_add_group(request, group); gaim_request_fields(action->plugin, N_("I'dle Mak'er"), _("Set Account Idle Time"), NULL, request, _("_Set"), G_CALLBACK(idle_action_ok), _("_Cancel"), NULL, NULL); } static GList * actions(GaimPlugin *plugin, gpointer context) { GList *l = NULL; GaimPluginAction *act = NULL; act = gaim_plugin_action_new(_("Set Account Idle Time"), idle_action); l = g_list_append(l, act); return l; } static GaimPluginInfo info = { GAIM_PLUGIN_API_VERSION, GAIM_PLUGIN_STANDARD, NULL, 0, NULL, GAIM_PRIORITY_DEFAULT, IDLE_PLUGIN_ID, N_("I'dle Mak'er"), VERSION, N_("Allows you to hand-configure how long you've been idle for"), N_("Allows you to hand-configure how long you've been idle for"), "Eric Warmenhoven <eric@warmenhoven.org>", GAIM_WEBSITE, NULL, NULL, NULL, NULL, NULL, NULL, actions }; static void init_plugin(GaimPlugin *plugin) { } GAIM_INIT_PLUGIN(idle, init_plugin, info)