Mercurial > pidgin
changeset 1235:a9cf2f61a7b1
[gaim-migrate @ 1245]
1. added protocol names to menus in conversation/join chat dialog. helpful if you're signed on as warmenhoven in both irc and yahoo.
2. made "no sounds when away" mean absolutely no sounds when away.
3. fixed buddy pounces and made it so you can save them.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 12 Dec 2000 09:09:24 +0000 |
parents | cedf7047081e |
children | dcf9242241ee |
files | src/buddy.c src/buddy_chat.c src/conversation.c src/dialogs.c src/gaim.h src/gaimrc.c src/server.c src/sound.c |
diffstat | 8 files changed, 71 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buddy.c Mon Dec 11 13:06:03 2000 +0000 +++ b/src/buddy.c Tue Dec 12 09:09:24 2000 +0000 @@ -1295,7 +1295,7 @@ save_prefs(); } -void do_pounce(char *name) +void do_pounce(char *name, int when) { char *who; @@ -1311,6 +1311,8 @@ b = (struct buddy_pounce *)bp->data; bp = bp->next; /* increment the list here because rem_bp can make our handle bad */ + if (!(b->options & when)) continue; + u = find_user(b->pouncer, b->protocol); /* find our user */ if (u == NULL) continue; @@ -1318,13 +1320,13 @@ if (u->gc == NULL) continue; if (!strcasecmp(who, normalize(b->name))) { /* find someone to pounce */ - if (b->popup == 1) + if (b->options & OPT_POUNCE_POPUP) { c = find_conversation(name); if (c == NULL) c = new_conversation(name); } - if (b->sendim == 1) + if (b->options & OPT_POUNCE_SEND_IM) { c = find_conversation(name); if (c == NULL) @@ -1333,7 +1335,7 @@ write_to_conv(c, b->message, WFLAG_SEND, NULL); serv_send_im(u->gc, name, b->message, 0); } - if (b->cmd == 1) + if (b->options & OPT_POUNCE_COMMAND) { int pid = fork(); @@ -1350,7 +1352,8 @@ } } - rem_bp(NULL, b); + if (!(b->options & OPT_POUNCE_SAVE)) + rem_bp(NULL, b); } }
--- a/src/buddy_chat.c Mon Dec 11 13:06:03 2000 +0000 +++ b/src/buddy_chat.c Tue Dec 12 09:09:24 2000 +0000 @@ -33,6 +33,7 @@ #include <gdk/gdkkeysyms.h> #include "convo.h" +#include "prpl.h" #include "pixmaps/tb_forward.xpm" #include "pixmaps/join.xpm" @@ -88,6 +89,7 @@ GtkWidget *opt; GSList *c = connections; struct gaim_connection *g; + char buf[2048]; optmenu = gtk_option_menu_new(); gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 0); @@ -96,7 +98,8 @@ while (c) { g = (struct gaim_connection *)c->data; - opt = gtk_menu_item_new_with_label(g->username); + g_snprintf(buf, sizeof buf, "%s (%s)", g->username, (*g->prpl->name)()); + opt = gtk_menu_item_new_with_label(buf); gtk_object_set_user_data(GTK_OBJECT(opt), g); gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(joinchat_choose), g); gtk_menu_append(GTK_MENU(menu), opt);
--- a/src/conversation.c Mon Dec 11 13:06:03 2000 +0000 +++ b/src/conversation.c Tue Dec 12 09:09:24 2000 +0000 @@ -35,6 +35,7 @@ #include <gdk/gdkkeysyms.h> #include "convo.h" #include "gtkspell.h" +#include "prpl.h" #include "pixmaps/underline.xpm" #include "pixmaps/bold.xpm" @@ -1646,6 +1647,7 @@ GtkWidget *menu, *opt; GSList *g = connections; struct gaim_connection *c; + char buf[2048]; if (g_slist_length(g) < 2) gtk_widget_hide(cnv->menu->parent); @@ -1654,7 +1656,8 @@ while (g) { c = (struct gaim_connection *)g->data; - opt = gtk_menu_item_new_with_label(c->username); + g_snprintf(buf, sizeof buf, "%s (%s)", c->username, (*c->prpl->name)()); + opt = gtk_menu_item_new_with_label(buf); gtk_object_set_user_data(GTK_OBJECT(opt), cnv); gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(convo_sel_send), c);
--- a/src/dialogs.c Mon Dec 11 13:06:03 2000 +0000 +++ b/src/dialogs.c Tue Dec 12 09:09:24 2000 +0000 @@ -122,6 +122,7 @@ GtkWidget *p_signon; GtkWidget *p_unaway; GtkWidget *p_unidle; + GtkWidget *save; GtkWidget *menu; struct aim_user *user; @@ -1009,35 +1010,28 @@ bp->protocol = b->user->protocol; + bp->options = 0; + if (GTK_TOGGLE_BUTTON(b->openwindow)->active) - bp->popup = 1; - else - bp->popup = 0; + bp->options |= OPT_POUNCE_POPUP; if (GTK_TOGGLE_BUTTON(b->sendim)->active) - bp->sendim = 1; - else - bp->sendim = 0; + bp->options |= OPT_POUNCE_SEND_IM; if (GTK_TOGGLE_BUTTON(b->command)->active) - bp->cmd = 1; - else - bp->cmd = 0; + bp->options |= OPT_POUNCE_COMMAND; if (GTK_TOGGLE_BUTTON(b->p_signon)->active) - bp->signon = 1; - else - bp->signon = 0; + bp->options |= OPT_POUNCE_SIGNON; if (GTK_TOGGLE_BUTTON(b->p_unaway)->active) - bp->unaway = 1; - else - bp->unaway = 0; + bp->options |= OPT_POUNCE_UNAWAY; if (GTK_TOGGLE_BUTTON(b->p_unidle)->active) - bp->unidle = 1; - else - bp->unidle = 0; + bp->options |= OPT_POUNCE_UNIDLE; + + if (GTK_TOGGLE_BUTTON(b->save)->active) + bp->options |= OPT_POUNCE_SAVE; buddy_pounces = g_list_append(buddy_pounces, bp); @@ -1215,6 +1209,15 @@ gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); gtk_widget_show(sep); + b->save = gtk_check_button_new_with_label(_("Save this pounce after activation")); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->save), FALSE); + gtk_box_pack_start(GTK_BOX(vbox), b->save, FALSE, FALSE, 0); + gtk_widget_show(b->save); + + sep = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); + gtk_widget_show(sep); + bbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); gtk_widget_show(bbox);
--- a/src/gaim.h Mon Dec 11 13:06:03 2000 +0000 +++ b/src/gaim.h Tue Dec 12 09:09:24 2000 +0000 @@ -240,20 +240,25 @@ struct log_conversation *next; }; +#define OPT_POUNCE_POPUP 0x001 +#define OPT_POUNCE_SEND_IM 0x002 +#define OPT_POUNCE_COMMAND 0x004 + +#define OPT_POUNCE_SIGNON 0x010 +#define OPT_POUNCE_UNAWAY 0x020 +#define OPT_POUNCE_UNIDLE 0x040 + +#define OPT_POUNCE_SAVE 0x100 + struct buddy_pounce { char name[80]; char message[2048]; char command[2048]; - int popup; - int sendim; - int cmd; char pouncer[80]; int protocol; - int signon; - int unaway; - int unidle; + int options; }; struct away_message { @@ -648,7 +653,7 @@ extern void build_edit_tree(); extern void remove_person(struct group *, struct buddy *); extern void remove_category(struct group *); -extern void do_pounce(char *); +extern void do_pounce(char *, int); extern void do_bp_menu(); extern struct buddy *find_buddy(struct gaim_connection *, char *); extern struct group *find_group(struct gaim_connection *, char *);
--- a/src/gaimrc.c Mon Dec 11 13:06:03 2000 +0000 +++ b/src/gaimrc.c Tue Dec 12 09:09:24 2000 +0000 @@ -283,27 +283,10 @@ g_snprintf(b->message, sizeof(b->message), "%s", p->value[1]); g_snprintf(b->command, sizeof(b->command), "%s", p->value[2]); - b->popup = atoi(p->value[2]); - b->sendim = atoi(p->value[3]); + b->options = atoi(p->value[3]); - /* Let's check our version and see what's going on here */ - if ((p->value[4]) && (strlen(p->value[4]) > 0)) - { - /* If we have data, lets use it */ - g_snprintf(b->pouncer, sizeof(b->pouncer), "%s", p->value[4]); - b->protocol = atoi(p->value[5]); - b->signon = atoi(p->value[6]); - b->unaway = atoi(p->value[7]); - b->unidle = atoi(p->value[8]); - b->cmd = atoi(p->value[9]); - } - else - { - /* Otherwise, we have old info. Let's adjust */ - b->signon = 1; - b->unaway = 0; - b->unidle = 0; - } + g_snprintf(b->pouncer, sizeof(b->pouncer), "%s", p->value[4]); + b->protocol = atoi(p->value[5]); filter_break(b->message); buddy_pounces = g_list_append(buddy_pounces, b); @@ -319,7 +302,7 @@ fprintf(f, "pounce {\n"); while (pnc) { - char *str1, *str2; + char *str1, *str2, *str3; b = (struct buddy_pounce *)pnc->data; @@ -330,12 +313,22 @@ str2 = malloc(1); str2[0] = 0; } + if (strlen(b->command)) + str3 = escape_text2(b->command); + else { + str3 = malloc(1); + str3[0] = 0; + } - fprintf(f, "\tentry { %s } { %s } { %d } { %d } { %s } { %d } { %d } { %d } { %d } { %d }\n", str1, str2, b->popup, b->sendim, b->pouncer, b->protocol, b->signon, b->unaway, b->unidle, b->cmd); + fprintf(f, "\tentry { %s } { %s } { %s } { %d } { %s } { %d }\n", + str1, str2, str3, + b->options, + b->pouncer, b->protocol); /* escape_text2 uses malloc(), so we don't want to g_free these */ free(str1); free(str2); + free(str3); pnc = pnc->next; }
--- a/src/server.c Mon Dec 11 13:06:03 2000 +0000 +++ b/src/server.c Tue Dec 12 09:09:24 2000 +0000 @@ -336,8 +336,7 @@ } } if (cnv != NULL) { - if (sound_options & OPT_SOUND_WHEN_AWAY) - play_sound(RECEIVE); + play_sound(RECEIVE); write_to_conv(cnv, message, away | WFLAG_RECV, NULL); } @@ -454,7 +453,7 @@ if (!b->idle && idle) plugin_event(event_buddy_idle, gc, b->name, 0, 0); if (b->idle && !idle) { - do_pounce(b->name); + do_pounce(b->name, OPT_POUNCE_UNIDLE); plugin_event(event_buddy_unidle, gc, b->name, 0, 0); } @@ -462,7 +461,7 @@ b->evil = evil; if ((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) { - do_pounce(b->name); + do_pounce(b->name, OPT_POUNCE_UNAWAY); plugin_event(event_buddy_back, gc, b->name, 0, 0); } else if (!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE)) { plugin_event(event_buddy_away, gc, b->name, 0, 0); @@ -476,7 +475,7 @@ if (loggedin) { if (!b->present) { b->present = 1; - do_pounce(b->name); + do_pounce(b->name, OPT_POUNCE_SIGNON); plugin_event(event_buddy_signon, gc, b->name, 0, 0); } } else {
--- a/src/sound.c Mon Dec 11 13:06:03 2000 +0000 +++ b/src/sound.c Tue Dec 12 09:09:24 2000 +0000 @@ -406,6 +406,9 @@ void play_sound(int sound) { + if (awaymessage && !(sound_options & OPT_SOUND_WHEN_AWAY)) + return; + switch(sound) { case BUDDY_ARRIVE: if ((sound_options & OPT_SOUND_LOGIN) && logins_not_muted) {