Mercurial > pidgin
annotate plugins/idle.c @ 4243:eae97ca4bbea
[gaim-migrate @ 4493]
Guess what?
Another SSI patch!
This one fixes the automatic deletion of empty groups upon signin.
The problem was that apparently WinICQ handles empty groups slightly
differently than WinAIM. It's all good now.
Uh, I fixed some comments.
Oh, and moving a buddy that you've requested authorization from to
a different group. I don't know if that used to give you the dialog
that prompted if you wanted to send another auth request, but it
shouldn't anymore (as long as you have sent 1 auth request).
I also changed the button title for ICQ's receive contacts. I changed
it from "Deny" to "Decline." Thanks to Nathan for pointing that out.
I am to Time Warner as spiders are to the bottom of my shoe.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Wed, 08 Jan 2003 04:06:20 +0000 |
| parents | 3efda23b7540 |
| children | a533999c8a6c |
| rev | line source |
|---|---|
| 4103 | 1 /* a nifty little plugin to set your idle time to whatever you want it to be. |
| 2 * useful for almost nothing. mostly just a demo plugin. but it's fun to have | |
| 3 * 40-day idle times. | |
| 4 */ | |
| 5 | |
|
4202
59751fe608c5
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
6 #include "config.h" |
|
59751fe608c5
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
7 |
|
59751fe608c5
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
8 #ifndef GAIM_PLUGINS |
| 4103 | 9 #define GAIM_PLUGINS |
|
4202
59751fe608c5
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
10 #endif |
|
59751fe608c5
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
11 |
| 4103 | 12 #include "multi.h" |
| 13 #include "gaim.h" | |
| 14 #include <sys/time.h> | |
| 15 #include "pixmaps/ok.xpm" | |
| 16 | |
| 17 static struct gaim_connection *gc = NULL; | |
| 18 | |
| 19 char *name() { | |
| 4224 | 20 return "Idle Maker"; |
| 4103 | 21 } |
| 22 | |
| 23 char *description() { | |
| 24 return "Allows you to hand-configure how long you've been idle for"; | |
| 25 } | |
| 26 | |
| 27 char *gaim_plugin_init(GModule *module) { | |
| 28 return NULL; | |
| 29 } | |
| 30 | |
| 31 static void set_idle(GtkWidget *button, GtkWidget *spinner) { | |
| 32 time_t t; | |
| 33 int tm = CLAMP(gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner)), 0, G_MAXINT); | |
| 34 if (!gc) { | |
| 35 return; | |
| 36 } | |
| 37 debug_printf("setting idle time for %s to %d\n", gc->username, tm); | |
| 38 time(&t); | |
| 39 t -= 60 * tm; | |
| 40 gc->lastsent = t; | |
| 41 serv_set_idle(gc, 60 * tm); | |
| 42 gc->is_idle = 0; | |
| 43 } | |
| 44 | |
| 45 static void sel_gc(GtkWidget *opt, struct gaim_connection *g) { | |
| 46 gc = g; | |
| 47 } | |
| 48 | |
| 49 static void make_connect_menu(GtkWidget *box) { | |
| 50 GtkWidget *optmenu, *menu, *opt; | |
| 51 GSList *c = connections; | |
| 52 struct gaim_connection *g; | |
| 53 | |
| 54 optmenu = gtk_option_menu_new(); | |
| 55 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5); | |
| 56 | |
| 57 menu = gtk_menu_new(); | |
| 58 | |
| 59 while (c) { | |
| 60 g = (struct gaim_connection *)c->data; | |
| 61 opt = gtk_menu_item_new_with_label(g->username); | |
|
4165
07a3d1fae88f
[gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents:
4103
diff
changeset
|
62 g_signal_connect(GTK_OBJECT(opt), "activate", |
|
07a3d1fae88f
[gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents:
4103
diff
changeset
|
63 G_CALLBACK(sel_gc), g); |
| 4103 | 64 gtk_menu_append(GTK_MENU(menu), opt); |
| 65 gtk_widget_show(opt); | |
| 66 c = g_slist_next(c); | |
| 67 } | |
| 68 | |
| 69 gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu)); | |
| 70 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
| 71 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0); | |
| 72 | |
| 73 if (connections) | |
| 74 gc = connections->data; | |
| 75 else | |
| 76 gc = NULL; | |
| 77 } | |
| 78 | |
| 79 struct gaim_plugin_description desc; | |
| 80 struct gaim_plugin_description *gaim_plugin_desc() { | |
| 81 desc.api_version = PLUGIN_API_VERSION; | |
| 4224 | 82 desc.name = g_strdup("Idle Maker"); |
| 4103 | 83 desc.version = g_strdup(VERSION); |
| 84 desc.description = g_strdup("Allows you to hand-configure how long you've been idle for"); | |
| 85 desc.authors = g_strdup("Eric Warmenhoven <eric@warmenhoven.org>"); | |
| 86 desc.url = g_strdup(WEBSITE); | |
| 87 return &desc; | |
| 88 } | |
| 89 | |
| 90 GtkWidget *gaim_plugin_config_gtk() { | |
| 91 GtkWidget *ret; | |
| 92 GtkWidget *frame, *label; | |
| 93 GtkWidget *vbox, *hbox; | |
| 94 GtkAdjustment *adj; | |
| 95 GtkWidget *spinner, *button; | |
| 96 | |
| 97 ret = gtk_vbox_new(FALSE, 18); | |
| 98 gtk_container_set_border_width(GTK_CONTAINER(ret), 12); | |
| 99 | |
| 100 frame = make_frame(ret, _("Idle Time")); | |
| 101 | |
| 102 vbox = gtk_vbox_new(FALSE, 5); | |
| 103 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 104 | |
| 105 hbox = gtk_hbox_new(FALSE, 5); | |
| 106 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
| 107 | |
| 108 label = gtk_label_new("Set"); | |
| 109 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
| 110 | |
| 111 make_connect_menu(hbox); | |
| 112 | |
| 113 label = gtk_label_new("idle for"); | |
| 114 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
| 115 | |
| 116 adj = (GtkAdjustment *)gtk_adjustment_new(10, 0, G_MAXINT, 1, 0, 0); | |
| 117 spinner = gtk_spin_button_new(adj, 0, 0); | |
| 118 gtk_box_pack_start(GTK_BOX(hbox), spinner, TRUE, TRUE, 0); | |
| 119 | |
| 120 label = gtk_label_new("minutes."); | |
| 121 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
| 122 | |
| 123 hbox = gtk_hbox_new(TRUE, 5); | |
| 124 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
| 125 | |
| 126 button = gtk_button_new_with_mnemonic(_("_Set")); | |
| 127 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
|
4165
07a3d1fae88f
[gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents:
4103
diff
changeset
|
128 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(set_idle), spinner); |
| 4103 | 129 |
| 130 gtk_widget_show_all(ret); | |
| 131 | |
| 132 return ret; | |
| 133 } |
