Mercurial > pidgin
changeset 573:9566a53cde23
[gaim-migrate @ 583]
ctl-[bius] for inserting HTML, more perl mods, and props to X-Chat
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 01 Aug 2000 23:25:23 +0000 |
parents | faca21605e1b |
children | 0aca48e1baa7 |
files | doc/CREDITS src/conversation.c src/perl.c |
diffstat | 3 files changed, 83 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/CREDITS Tue Aug 01 22:59:00 2000 +0000 +++ b/doc/CREDITS Tue Aug 01 23:25:23 2000 +0000 @@ -39,3 +39,7 @@ G. Sumner Hayes <IM: SumnerFool> Security Patches Brian Ryner for a little make file patch :) + +A big thanks to the X-Chat developers, who were kind enough to +license X-Chat under the GPL so that I could learn to be as cool +as them. -EWarmenhoven
--- a/src/conversation.c Tue Aug 01 22:59:00 2000 +0000 +++ b/src/conversation.c Tue Aug 01 23:25:23 2000 +0000 @@ -452,21 +452,44 @@ gboolean keypress_callback(GtkWidget *entry, GdkEventKey *event, struct conversation *c) { - int pos; - if(event->keyval==GDK_Return) { - if(!(event->state & GDK_SHIFT_MASK) - && (general_options & OPT_GEN_ENTER_SENDS)) { - gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c); - //to stop the putting in of the enter character - gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); - } else { - gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); - pos=gtk_editable_get_position(GTK_EDITABLE(entry)); - gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos); - } - } + int pos; + if(event->keyval==GDK_Return) { + if(!(event->state & GDK_SHIFT_MASK) + && (general_options & OPT_GEN_ENTER_SENDS)) { + gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c); + //to stop the putting in of the enter character + gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); + } else { + gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); + pos=gtk_editable_get_position(GTK_EDITABLE(entry)); + gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos); + } + } else if (event->state & GDK_CONTROL_MASK) { + switch (event->keyval) { + case 'i': + quiet_set(c->italic, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->italic))); + do_italic(c->italic, c->entry); + gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); + break; + case 'u': /* ctl-u is GDK_Clear, which clears the line */ + quiet_set(c->underline, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->underline))); + do_underline(c->underline, c->entry); + gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); + break; + case 'b': /* ctl-b is GDK_Left, which moves backwards */ + quiet_set(c->bold, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->bold))); + do_bold(c->bold, c->entry); + gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); + break; + case 's': + quiet_set(c->strike, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->strike))); + do_strike(c->strike, c->entry); + gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); + break; + } + } - return TRUE; + return TRUE; }
--- a/src/perl.c Tue Aug 01 22:59:00 2000 +0000 +++ b/src/perl.c Tue Aug 01 23:25:23 2000 +0000 @@ -28,8 +28,7 @@ #endif #undef PACKAGE -/* #ifdef USE_PERL */ -#if 0 +#if 0 /* #ifdef USE_PERL */ #include <EXTERN.h> #ifndef _SEM_SEMUN_UNDEFINED @@ -51,7 +50,13 @@ char *shutdowncallback; /* bleh */ }; +struct _perl_timeout_handlers { + char *handler_name; + gint iotag; +}; + static GList *perl_list = NULL; +static GList *perl_timeout_handlers = NULL; static PerlInterpreter *my_perl = NULL; XS (XS_AIM_register); /* so far so good */ @@ -64,7 +69,7 @@ /* XS (XS_AIM_send_raw); /* this i can do for toc, but for oscar... ? */ XS (XS_AIM_command); /* this should be easier */ /* XS (XS_AIM_command_with_server); /* FIXME: this should probably be removed */ -XS (XS_AIM_channel_list); /* probably return conversation list */ +XS (XS_AIM_channel_list); /* probably return conversation list (online buddies?) */ /* XS (XS_AIM_server_list); /* huh? does this apply? */ XS (XS_AIM_user_list); /* return the buddy list */ /* XS (XS_AIM_user_info); /* we'll see.... */ @@ -175,6 +180,7 @@ void perl_end() { struct perlscript *scp; + struct _perl_timeout_handlers *thn; while (perl_list) { scp = perl_list->data; @@ -187,6 +193,14 @@ g_free(scp); } + while (perl_timeout_handlers) { + thn = perl_timeout_handlers->data; + perl_timeout_handlers = g_list_remove(perl_timeout_handlers, thn); + gtk_timeout_remove(thn->iotag); + g_free(thn->handler_name); + g_free(thn); + } + if (my_perl != NULL) { perl_destruct(my_perl); perl_free(my_perl); @@ -221,8 +235,30 @@ /* XS (XS_AIM_add_command_handler); /* once again, um... */ /* XS (XS_AIM_add_print_handler); /* can i really do this? */ +static int perl_timeout(struct _perl_timeout_handlers *handler) +{ + execute_perl(handler->handler_name, ""); + perl_timeout_handlers = g_list_remove(perl_timeout_handlers, handler); + g_free(handler->handler_name); + g_free(handler); + + return 0; /* returning zero removes the timeout handler */ +} + XS (XS_AIM_add_timeout_handler) { + int junk; + long timeout; + struct _perl_timeout_handlers *handler; + dXSARGS; + items = 0; + + handler = g_new0(struct _perl_timeout_handlers, 1); + timeout = atol(SvPV(ST(0), junk)); + handler->handler_name = g_strdup(SvPV(ST(1), junk)); + perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler); + handler->iotag = gtk_timeout_add(timeout, (GtkFunction)perl_timeout, handler); + XSRETURN_EMPTY; } /* XS (XS_AIM_print); /* how am i going to do this */ @@ -235,19 +271,19 @@ /* XS (XS_AIM_command_with_server); /* FIXME: this should probably be removed */ -XS (XS_AIM_channel_list) +XS (XS_AIM_channel_list) /* online buddies? */ { } /* XS (XS_AIM_server_list); /* huh? does this apply? */ -XS (XS_AIM_user_list) +XS (XS_AIM_user_list) /* buddy list */ { } /* XS (XS_AIM_user_info); /* we'll see.... */ -XS (XS_AIM_ignore_list) +XS (XS_AIM_ignore_list) /* deny list */ { }