Mercurial > pidgin.yaz
changeset 1229:229bf438c591
[gaim-migrate @ 1239]
not sure if this works yet
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 11 Dec 2000 07:42:19 +0000 |
parents | 6773043cf9f6 |
children | 5395053cdee1 |
files | TODO src/buddy.c src/dialogs.c src/gaim.h src/gaimrc.c |
diffstat | 5 files changed, 141 insertions(+), 124 deletions(-) [+] |
line wrap: on
line diff
--- a/TODO Mon Dec 11 05:39:15 2000 +0000 +++ b/TODO Mon Dec 11 07:42:19 2000 +0000 @@ -1,7 +1,5 @@ --- STUFF FOR 0.11.1 RELEASE --- - Execute Command on Buddy Pounce - Syd is cool and gave all of these ideas: Have multiple tickers in the same window, one for buddies like it is now, one for who just came online/offline
--- a/src/buddy.c Mon Dec 11 05:39:15 2000 +0000 +++ b/src/buddy.c Mon Dec 11 07:42:19 2000 +0000 @@ -1333,6 +1333,22 @@ write_to_conv(c, b->message, WFLAG_SEND, NULL); serv_send_im(u->gc, name, b->message, 0); } + if (b->cmd == 1) + { + int pid = fork(); + + if (pid == 0) { + char *args[4]; + args[0] = "sh"; + args[1] = "-c"; + args[2] = b->command; + args[3] = NULL; + execvp(args[0], args); + _exit(0); + } else if (pid > 0) { + gtk_timeout_add(100, (GtkFunction)clean_pid, NULL); + } + } rem_bp(NULL, b);
--- a/src/dialogs.c Mon Dec 11 05:39:15 2000 +0000 +++ b/src/dialogs.c Mon Dec 11 07:42:19 2000 +0000 @@ -115,6 +115,8 @@ GtkWidget *window; GtkWidget *nameentry; GtkWidget *messentry; + GtkWidget *commentry; + GtkWidget *command; GtkWidget *sendim; GtkWidget *openwindow; GtkWidget *p_signon; @@ -1009,6 +1011,7 @@ g_snprintf(bp->name, 80, "%s", gtk_entry_get_text(GTK_ENTRY(b->nameentry))); g_snprintf(bp->message, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->messentry))); + g_snprintf(bp->command, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->commentry))); g_snprintf(bp->pouncer, 80, "%s", b->user->username); bp->protocol = b->user->protocol; @@ -1023,6 +1026,11 @@ else bp->sendim = 0; + if (GTK_TOGGLE_BUTTON(b->command)->active) + bp->cmd = 1; + else + bp->cmd = 0; + if (GTK_TOGGLE_BUTTON(b->p_signon)->active) bp->signon = 1; else @@ -1114,17 +1122,108 @@ struct addbp *b = g_new0(struct addbp, 1); b->window = gtk_window_new(GTK_WINDOW_DIALOG); + dialogwindows = g_list_prepend(dialogwindows, b->window); gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, TRUE, TRUE); gtk_window_set_wmclass(GTK_WINDOW(b->window), "new_bp", "Gaim"); + gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - New Buddy Pounce")); + gtk_signal_connect(GTK_OBJECT(b->window), "destroy", + GTK_SIGNAL_FUNC(destroy_dialog), b->window); gtk_widget_realize(b->window); - dialogwindows = g_list_prepend(dialogwindows, b->window); - bbox = gtk_hbox_new(FALSE, 5); + aol_icon(b->window->window); + vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + gtk_container_add(GTK_CONTAINER(b->window), vbox); + gtk_widget_show(vbox); + + pounce_user_menu(b, vbox); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); + gtk_widget_show(hbox); + + label = gtk_label_new(_("Buddy:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + b->nameentry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(hbox), b->nameentry, TRUE, TRUE, 0); + if (name != NULL) + gtk_entry_set_text(GTK_ENTRY(b->nameentry), name); + gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry); + gtk_widget_show(b->nameentry); + + sep = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); + gtk_widget_show(sep); + + b->p_signon = gtk_check_button_new_with_label(_("Pounce on sign on")); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_signon), TRUE); + gtk_box_pack_start(GTK_BOX(vbox), b->p_signon, FALSE, FALSE, 0); + gtk_widget_show(b->p_signon); + + b->p_unaway = gtk_check_button_new_with_label(_("Pounce on return from away")); + gtk_box_pack_start(GTK_BOX(vbox), b->p_unaway, FALSE, FALSE, 0); + gtk_widget_show(b->p_unaway); + + b->p_unidle = gtk_check_button_new_with_label(_("Pounce on return from idle")); + gtk_box_pack_start(GTK_BOX(vbox), b->p_unidle, FALSE, FALSE, 0); + gtk_widget_show(b->p_unidle); + + sep = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); + gtk_widget_show(sep); + + b->openwindow = gtk_check_button_new_with_label(_("Open IM window on pounce")); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), FALSE); + gtk_box_pack_start(GTK_BOX(vbox), b->openwindow, FALSE, FALSE, 0); + gtk_widget_show(b->openwindow); + + b->sendim = gtk_check_button_new_with_label(_("Send IM on pounce")); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), TRUE); + gtk_box_pack_start(GTK_BOX(vbox), b->sendim, FALSE, FALSE, 0); + gtk_widget_show(b->sendim); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); + gtk_widget_show(hbox); + + label = gtk_label_new(_("Message:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + b->messentry = gtk_entry_new(); - - /* Build OK Button */ + gtk_box_pack_start(GTK_BOX(hbox), b->messentry, TRUE, TRUE, 0); + gtk_signal_connect(GTK_OBJECT(b->messentry), "activate", + GTK_SIGNAL_FUNC(do_new_bp), b); + gtk_widget_show(b->messentry); + + b->command = gtk_check_button_new_with_label(_("Execute command on pounce")); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->command), FALSE); + gtk_box_pack_start(GTK_BOX(vbox), b->command, FALSE, FALSE, 0); + gtk_widget_show(b->command); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); + gtk_widget_show(hbox); + + label = gtk_label_new(_("Command:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + b->commentry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(hbox), b->commentry, TRUE, TRUE, 0); + gtk_signal_connect(GTK_OBJECT(b->commentry), "activate", + GTK_SIGNAL_FUNC(do_new_bp), b); + gtk_widget_show(b->commentry); + + 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); button = picture_button(b->window, _("Cancel"), cancel_xpm); gtk_signal_connect(GTK_OBJECT(button), "clicked", @@ -1136,100 +1235,6 @@ GTK_SIGNAL_FUNC(do_new_bp), b); gtk_box_pack_end(GTK_BOX(bbox), button, FALSE, FALSE, 0); - /* Pounce as menu */ - pounce_user_menu(b, vbox); - - hbox = gtk_hbox_new(FALSE, 5); - label = gtk_label_new(_("Buddy:")); - gtk_widget_show(label); - gtk_widget_show(hbox); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), b->nameentry, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); - - hbox = gtk_hbox_new(FALSE, 5); - label = gtk_label_new(_("Message:")); - gtk_widget_show(label); - gtk_widget_show(hbox); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), b->messentry, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); - - // label = gtk_label_new(_("Events")); - // gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - // I was left aligning these but I dunno if Like it -- Rob - - /* Set up the different options */ - b->p_signon = gtk_check_button_new_with_label(_("Pounce on sign on")); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_signon), TRUE); - b->p_unaway = gtk_check_button_new_with_label(_("Pounce on return from away")); - b->p_unidle = gtk_check_button_new_with_label(_("Pounce on return from idle")); - - /* Show them */ -// gtk_widget_show(label); - gtk_widget_show(b->p_signon); - gtk_widget_show(b->p_unaway); - gtk_widget_show(b->p_unidle); - - sep = gtk_hseparator_new(); - gtk_widget_show(sep); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); - - //gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), b->p_signon, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), b->p_unaway, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), b->p_unidle, FALSE, FALSE, 0); - - sep = gtk_hseparator_new(); - gtk_widget_show(sep); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); - - - //label = gtk_label_new(_("Actions")); - // gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - // I was left aligning these but I dunno if Like it -- Rob - - /* And now the other stuff */ - b->openwindow = gtk_check_button_new_with_label(_("Open IM window on pounce")); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), FALSE); - - b->sendim = gtk_check_button_new_with_label(_("Send IM on pounce")); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), TRUE); - - //gtk_widget_show(label); - gtk_widget_show(b->openwindow); - gtk_widget_show(b->sendim); - - //gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), b->openwindow, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), b->sendim, FALSE, FALSE, 0); - - sep = gtk_hseparator_new(); - gtk_widget_show(sep); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); - - /* And the boxes in the box */ - gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); - - /* Handle closes right */ - gtk_signal_connect(GTK_OBJECT(b->window), "destroy", - GTK_SIGNAL_FUNC(destroy_dialog), b->window); - gtk_signal_connect(GTK_OBJECT(b->messentry), "activate", - GTK_SIGNAL_FUNC(do_new_bp), b); - - /* Finish up */ - gtk_widget_show(b->nameentry); - gtk_widget_show(b->messentry); - gtk_widget_show(bbox); - gtk_widget_show(vbox); - gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - New Buddy Pounce")); - if (name != NULL) { - gtk_entry_set_text(GTK_ENTRY(b->nameentry), name); - gtk_window_set_focus(GTK_WINDOW(b->window), b->messentry); - } else - gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry); - gtk_container_add(GTK_CONTAINER(b->window), vbox); - aol_icon(b->window->window); gtk_widget_show(b->window); }
--- a/src/gaim.h Mon Dec 11 05:39:15 2000 +0000 +++ b/src/gaim.h Mon Dec 11 07:42:19 2000 +0000 @@ -243,8 +243,10 @@ struct buddy_pounce { char name[80]; char message[2048]; + char command[2048]; int popup; int sendim; + int cmd; char pouncer[80]; int protocol;
--- a/src/gaimrc.c Mon Dec 11 05:39:15 2000 +0000 +++ b/src/gaimrc.c Mon Dec 11 07:42:19 2000 +0000 @@ -47,7 +47,6 @@ int report_idle, web_browser; struct save_pos blist_pos; char web_command[2048]; -char latest_ver[25]; char *sound_file[NUM_SOUNDS]; char sound_cmd[2048]; @@ -282,6 +281,7 @@ g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]); 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]); @@ -295,6 +295,7 @@ 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 { @@ -317,29 +318,26 @@ fprintf(f, "pounce {\n"); - if (pnc) - { - while (pnc) { - char *str1, *str2; + while (pnc) { + char *str1, *str2; - b = (struct buddy_pounce *)pnc->data; + b = (struct buddy_pounce *)pnc->data; - str1 = escape_text2(b->name); - if (strlen(b->message)) - str2 = escape_text2(b->message); - else { - str2 = malloc(1); - str2[0] = 0; - } + str1 = escape_text2(b->name); + if (strlen(b->message)) + str2 = escape_text2(b->message); + else { + str2 = malloc(1); + str2[0] = 0; + } - fprintf(f, "\tentry { %s } { %s } { %d } { %d } { %s } { %d } { %d } { %d } { %d }\n", str1, str2, b->popup, b->sendim, b->pouncer, b->protocol, b->signon, b->unaway, b->unidle); + 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); - /* escape_text2 uses malloc(), so we don't want to g_free these */ - free(str1); - free(str2); - - pnc = pnc->next; - } + /* escape_text2 uses malloc(), so we don't want to g_free these */ + free(str1); + free(str2); + + pnc = pnc->next; } fprintf(f, "}\n"); @@ -689,7 +687,6 @@ fprintf(f, "\tblist_pos { %d } { %d } { %d } { %d } { %d } { %d }\n", blist_pos.x, blist_pos.y, blist_pos.width, blist_pos.height, blist_pos.xoff, blist_pos.yoff); - fprintf(f, "\tlatest_ver { %s }\n", latest_ver); fprintf(f, "}\n"); } @@ -801,7 +798,6 @@ blist_pos.y = 0; blist_pos.xoff = 0; blist_pos.yoff = 0; - g_snprintf(latest_ver, BUF_LONG, "%s", VERSION); } } @@ -880,11 +876,11 @@ gaimrc_write_options(f); gaimrc_write_sounds(f); gaimrc_write_away(f); + gaimrc_write_pounce(f); + gaimrc_write_chat(f); #ifdef GAIM_PLUGINS gaimrc_write_plugins(f); #endif - gaimrc_write_pounce(f); - gaimrc_write_chat(f); fclose(f); chmod(buf, S_IRUSR | S_IWUSR); }