view plugins/idle.c @ 11015:45ceaa1ccc6e

[gaim-migrate @ 12884] (10:37:16) rizzo: wtf that silc ft patch still not in (10:38:45) LSchiere2: rizzo: what are you talking about (10:39:03) rizzo: gaim silc won't build against silc 1.0 (10:39:16) rizzo: has been an issue since gaim 1.3.0 (10:39:29) LSchiere2: I don't recall the patch (10:39:32) rizzo: http://www.gentoo.org/cgi-bin/viewcvs.cgi/*checkout*/net-im/gaim/files/gaim-1.3.0-silc-ft.patch (10:39:41) rizzo: I thought I got it from you guys (10:39:46) LSchiere2: is it in our tracker? (10:39:51) rizzo: I don't see it (10:40:05) ***rizzo digs up his bug (10:40:57) rizzo: LSchiere2: I think pekka emailed it to -packagers list (10:41:01) rizzo: http://bugs.gentoo.org/show_bug.cgi?id=92251 (10:41:33) rizzo: from his email: (10:41:33) rizzo: Enclosed a small patch that makes the Gaim compile with SILC Toolkit 1.0. (10:41:33) rizzo: We had unfortunate timing when I released 1.0 at the same time you (10:41:33) rizzo: released Gaim 1.3 so I didn't have time to make the patch for 1.3. (10:41:33) rizzo: Anyway, the patch removes code that really isn't supposed to even be (10:41:33) rizzo: there... committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 17 Jun 2005 14:53:38 +0000
parents f8e395a054e2
children 50224ac8184d
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"
#include "version.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_MAGIC,
	GAIM_MAJOR_VERSION,
	GAIM_MINOR_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)