Mercurial > pidgin
changeset 2102:899c22dcee42
[gaim-migrate @ 2112]
I haven't actually tested that it works, but theoretically it does.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 01 Aug 2001 20:31:53 +0000 |
parents | dd3aa315519d |
children | d403300222d2 |
files | ChangeLog plugins/SIGNALS src/conversation.c src/gaim.h src/plugins.c |
diffstat | 5 files changed, 54 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Aug 01 19:22:07 2001 +0000 +++ b/ChangeLog Wed Aug 01 20:31:53 2001 +0000 @@ -9,6 +9,10 @@ * Added Russian Translation * Can select which protocols are compiled statically (e.g.: ./configure --with-static-prpls=oscar,jabber) + * New plugin event: event_im_displayed. Use this to change + the message after it's displayed (e.g. encrypt it), or to + display an auto-response after the message is displayed + (e.g. for eliza bots). version 0.11.0-pre14 (06/17/2001): * Fixed a segfault with Oscar's account confirmation
--- a/plugins/SIGNALS Wed Aug 01 19:22:07 2001 +0000 +++ b/plugins/SIGNALS Wed Aug 01 20:31:53 2001 +0000 @@ -23,7 +23,9 @@ event_error, event_quit, event_new_conversation, - event_set_info + event_set_info, + event_draw_menu, + event_im_displayed }; To add a signal handler, call the fuction gaim_signal_connect with the @@ -257,3 +259,29 @@ Called when the user sends his profile to the server. 'info' is the profile being sent. + +event_draw_menu: + GtkWidget *menu, char *name + + Called when you right-click on a buddy. + + 'menu' is the menu that is about to be displayed. + 'name' is the name of the buddy that was clicked. + +event_im_displayed: + struct gaim_connection *gc, char *who, char **what + + This is called after what you send is displayed but before it's + actually sent. That is, when the user clicks the "send" button + in an IM window, first it gets passed to event_im_send handlers, + then it gets displayed, then it gets passed to these handlers, and + then it gets sent over the wire. This is useful for when you want + to encrypt something on the way out, or when you want to send a + response and have it displayed after what triggered the response. + + 'gc' is the connection the message was received on. + 'who' is who sent the message. + 'what' is what was sent. It's expected that you modify this. If + you set *what to NULL the message won't be sent, but the preferred + way of doing this is to attach to event_im_send so that it really + won't be displayed at all.
--- a/src/conversation.c Wed Aug 01 19:22:07 2001 +0000 +++ b/src/conversation.c Wed Aug 01 20:31:53 2001 +0000 @@ -750,7 +750,7 @@ void send_callback(GtkWidget *widget, struct conversation *c) { - char *buf, *buf2, *buf3; + char *buf, *buf2; int limit; if (!c->gc) @@ -851,11 +851,17 @@ } if (!c->is_chat) { - buf3 = g_strdup(buf); - write_to_conv(c, buf3, WFLAG_SEND, NULL, time((time_t)NULL)); - g_free(buf3); + char *buffy; + + write_to_conv(c, buf, WFLAG_SEND, NULL, time((time_t)NULL)); - serv_send_im(c->gc, c->name, buf, 0); + buffy = g_strdup(buf); + plugin_event(event_im_displayed, c->gc, c->name, &buffy, 0); + if (buffy) { + serv_send_im(c->gc, c->name, buffy, 0); + g_free(buffy); + } + if (c->makesound && (sound_options & OPT_SOUND_SEND)) play_sound(SEND);
--- a/src/gaim.h Wed Aug 01 19:22:07 2001 +0000 +++ b/src/gaim.h Wed Aug 01 20:31:53 2001 +0000 @@ -201,6 +201,7 @@ event_new_conversation, event_set_info, event_draw_menu, + event_im_displayed, /* any others? it's easy to add... */ };
--- a/src/plugins.c Wed Aug 01 19:22:07 2001 +0000 +++ b/src/plugins.c Wed Aug 01 20:31:53 2001 +0000 @@ -725,6 +725,9 @@ case event_draw_menu: sprintf(buf, "event_draw_menu"); break; + case event_im_displayed: + sprintf(buf, "event_im_displayed"); + break; default: sprintf(buf, "event_unknown"); break; @@ -777,6 +780,7 @@ /* struct gaim_connection *, char *, char ** */ case event_im_send: + case event_im_displayed: case event_chat_send: { void (*function)(struct gaim_connection *, char *, char **, @@ -953,6 +957,11 @@ case event_draw_menu: g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2); break; + case event_im_displayed: + g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", + ((struct gaim_connection *)arg1)->username, (char *)arg2, + (char *)arg3 ? (char *)arg3 : "(null)"); + break; default: break; }