Mercurial > pidgin.yaz
changeset 133:e277d5f0c1dd
[gaim-migrate @ 143]
Let's see if I can remember everything I did:
- Fixed a bug I let slip. If you choose the new option to not play
login sounds when you log in, and then quit before the timeout is
up, it would save that you didn't want login sounds at all.
- Added two new plugin events: event_away and event_buddy_away.
- Made GtkWidget *imaway in away.c and void play(uchar *, int) in
sound.c not static any more (though not referenced in gaim.h).
This is so plugins can use those (and not have to worry about
writing their own sound code).
- Wrote a quick plugin to auto-iconify windows when you go away. I
had just been locally patching my own copy, since I figured it wasn't
worth including as an option. It also demonstrates some of the issues
of deciding between USE_APPLET and not. Perhaps plugins are the way
to go with some things that would otherwise have been options (for
example, the Lag-O-Meter is one of those things that could possibly
have been a plugin instead of hard-coded in).
I think that's everything.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 19 Apr 2000 02:04:30 +0000 |
parents | f12425e6660d |
children | 00c1ee609648 |
files | plugins/Makefile plugins/SIGNALS plugins/iconaway.c src/aim.c src/away.c src/buddy.c src/gaim.h src/sound.c |
diffstat | 8 files changed, 92 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/Makefile Tue Apr 18 09:05:55 2000 +0000 +++ b/plugins/Makefile Wed Apr 19 02:04:30 2000 +0000 @@ -2,7 +2,8 @@ CFLAGS = -Wall `gnome-config --cflags gtk` -I../src -g LDFLAGS = -ggdb `gnome-config --libs gtk` -shared -lpthread -all: simple.so gaiminc.so autorecon.so spellchk.so chkmail.so filectl.so +all: simple.so gaiminc.so autorecon.so spellchk.so chkmail.so \ + filectl.so iconaway.so .SUFFIXES: .c .so
--- a/plugins/SIGNALS Tue Apr 18 09:05:55 2000 +0000 +++ b/plugins/SIGNALS Wed Apr 19 02:04:30 2000 +0000 @@ -1,10 +1,12 @@ enum gaim_event { event_signon = 0, event_signoff, + event_away, event_im_recv, event_im_send, event_buddy_signon, event_buddy_signoff, + event_buddy_away, event_blist_update }; @@ -44,6 +46,9 @@ event_signoff: (none) +event_away: + (none) + event_im_recv: char **who, char **text @@ -75,6 +80,11 @@ 'who' is who signed off. +event_buddy_away: + char *who + + 'who' is who went away. + event_blist_update: (none)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/iconaway.c Wed Apr 19 02:04:30 2000 +0000 @@ -0,0 +1,40 @@ +#define GAIM_PLUGINS +#include "gaim.h" + +#include <gdk/gdkx.h> +#include <X11/Xlib.h> + +void *handle; + +extern GtkWidget *imaway; +extern GtkWidget *blist; + +extern void set_applet_draw_closed(); + +void iconify_windows(void *data) { + XIconifyWindow(GDK_DISPLAY(), + GDK_WINDOW_XWINDOW(imaway->window), + ((_XPrivDisplay)GDK_DISPLAY())->default_screen); +#ifdef USE_APPLET + gnome_buddy_hide(); + set_applet_draw_closed(); +#else + XIconifyWindow(GDK_DISPLAY(), + GDK_WINDOW_XWINDOW(blist->window), + ((_XPrivDisplay)GDK_DISPLAY())->default_screen); +#endif +} + +void gaim_plugin_init(void *h) { + handle = h; + + gaim_signal_connect(handle, event_away, iconify_windows, NULL); +} + +char *name() { + return "Iconify On Away"; +} + +char *description() { + return "Iconifies the away box and the buddy list when you go away."; +}
--- a/src/aim.c Tue Apr 18 09:05:55 2000 +0000 +++ b/src/aim.c Wed Apr 19 02:04:30 2000 +0000 @@ -110,8 +110,9 @@ } static int snd_tmout; +int logins_not_muted = 1; static void sound_timeout() { - sound_options += OPT_SOUND_LOGIN; + logins_not_muted = 1; gtk_timeout_remove(snd_tmout); } @@ -148,7 +149,7 @@ if (sound_options & OPT_SOUND_LOGIN && sound_options & OPT_SOUND_SILENT_SIGNON) { - sound_options -= OPT_SOUND_LOGIN; + logins_not_muted = 0; snd_tmout = gtk_timeout_add(10000, (GtkFunction)sound_timeout, NULL); }
--- a/src/away.c Tue Apr 18 09:05:55 2000 +0000 +++ b/src/away.c Wed Apr 19 02:04:30 2000 +0000 @@ -32,7 +32,7 @@ #include <gtk/gtk.h> #include "gaim.h" -static GtkWidget *imaway=NULL; +GtkWidget *imaway=NULL; #ifdef USE_APPLET extern enum gaim_user_states MRI_user_status; #endif @@ -165,6 +165,21 @@ serv_set_away(buf2); g_free(buf2); gtk_widget_show(imaway); +#ifdef GAIM_PLUGINS + { + GList *c = callbacks; + struct gaim_callback *g; + void (*function)(void *); + while (c) { + g = (struct gaim_callback *)c->data; + if (g->event == event_away && g->function != NULL) { + function = g->function; + (*function)(g->data); + } + c = c->next; + } + } +#endif } void rem_away_mess(GtkWidget *w, struct away_message *a)
--- a/src/buddy.c Tue Apr 18 09:05:55 2000 +0000 +++ b/src/buddy.c Wed Apr 19 02:04:30 2000 +0000 @@ -1450,6 +1450,20 @@ if (!b->log_timer) { gtk_widget_hide(b->pix); if (b->uc & UC_UNAVAILABLE) { +#ifdef GAIM_PLUGINS + GList *c = callbacks; + struct gaim_callback *g; + void (*function)(char *, void *); + while (c) { + g = (struct gaim_callback *)c->data; + if (g->event == event_buddy_away && + g->function != NULL) { + function = g->function; + (*function)(b->name, g->data); + } + c = c->next; + } +#endif pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, (gchar **)away_icon_xpm); gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm);
--- a/src/gaim.h Tue Apr 18 09:05:55 2000 +0000 +++ b/src/gaim.h Wed Apr 19 02:04:30 2000 +0000 @@ -131,10 +131,12 @@ enum gaim_event { event_signon = 0, event_signoff, + event_away, event_im_recv, event_im_send, event_buddy_signon, event_buddy_signoff, + event_buddy_away, event_blist_update, /* any others? it's easy to add... */ }; @@ -291,7 +293,7 @@ #define TYPE_SIGNOFF 4 #define TYPE_KEEPALIVE 5 -#define REVISION "gaim:$Revision: 125 $" +#define REVISION "gaim:$Revision: 143 $" #define FLAPON "FLAPON\r\n\r\n" #define ROAST "Tic/Toc"
--- a/src/sound.c Tue Apr 18 09:05:55 2000 +0000 +++ b/src/sound.c Wed Apr 19 02:04:30 2000 +0000 @@ -220,7 +220,7 @@ #endif -static void play(unsigned char *data, int size) +void play(unsigned char *data, int size) { int pid; @@ -260,7 +260,7 @@ } } - +extern int logins_not_muted; #ifndef USE_APPLET void play_sound(int sound) @@ -268,7 +268,7 @@ switch(sound) { case BUDDY_ARRIVE: - if (sound_options & OPT_SOUND_LOGIN) + if ((sound_options & OPT_SOUND_LOGIN) && logins_not_muted) play(BuddyArrive, sizeof(BuddyArrive)); break; case BUDDY_LEAVE: @@ -302,7 +302,7 @@ switch(sound) { case BUDDY_ARRIVE: - if (sound_options & OPT_SOUND_LOGIN) + if ((sound_options & OPT_SOUND_LOGIN) && logins_not_muted) gnome_triggers_do("", "program", "gaim_applet", "login", NULL); break; case BUDDY_LEAVE: