Mercurial > pidgin
changeset 802:1afe98d2461e
[gaim-migrate @ 812]
ha, i'm smart. i should commit to things.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 30 Aug 2000 23:27:04 +0000 |
parents | 1a47432e2ba1 |
children | 7f75b17d4e14 |
files | plugins/PERL-HOWTO src/plugins.c |
diffstat | 2 files changed, 21 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/PERL-HOWTO Wed Aug 30 21:32:44 2000 +0000 +++ b/plugins/PERL-HOWTO Wed Aug 30 23:27:04 2000 +0000 @@ -16,10 +16,6 @@ the most part things should be written in Perl. It's more stable than plugins. -Right now, the only way to test that your script is working correctly is to -load the perl plugin and load the script through that. (This is also the only -way I have of knowing that the interface is working correctly.) - Everything available in normal perl scripts should be available in gaim's perl interface, so I'm not going to bother describing that. The important things are the functions provided by gaim's internal AIM module, which is @@ -95,13 +91,14 @@ AIM::print_to_chat(room, what) This should be just as obvious as the last command. + AIM::add_event_handler(event, function) This is the most important of them all. This is basically exactly like - gaim_signal_connect. You pass which event you want to connect to (a string - with the same name as the events for plugins, see SIGNALS), and a string - with the name of the function you want called. Simple enough? + gaim_signal_connect for plugins. You pass which event you want to connect to + (a string with the same name as the events for plugins, see SIGNALS), and a + string with the name of the function you want called. Simple enough? - When this is triggered, the same arguments will be passed in @_ and are not + When this is triggered, the arguments will be passed in @_ and are not broken into a list, but left as one long string. You'll have to parse those yourself with split. (Sounding exactly like X-Chat yet?) The arguments are the exact same as those passed to the plugins, and are passed after the @@ -109,7 +106,8 @@ so that gaim knows what the changes are. Unlike X-Chat, perl scripts cannot short-circut gaim (that is, your script will be called in order it was added, despite what other scripts do, and afterwards, execution will continue as - normal). + normal). Names of buddies and chat rooms will be in quotes, and all other + values (like text messages) will not be. AIM::add_timeout_handler(integer, function) This calls function after integer number of seconds. It only calls function
--- a/src/plugins.c Wed Aug 30 21:32:44 2000 +0000 +++ b/src/plugins.c Wed Aug 30 23:27:04 2000 +0000 @@ -724,49 +724,49 @@ buf[0] = 0; break; case event_im_recv: - sprintf(buf, "%s %s", *(char **)arg1, *(char **)arg2); + sprintf(buf, "\"%s\" %s", *(char **)arg1, *(char **)arg2); break; case event_im_send: - sprintf(buf, "%s %s", (char *)arg1, *(char **)arg2); + sprintf(buf, "\"%s\" %s", (char *)arg1, *(char **)arg2); break; case event_buddy_signon: - sprintf(buf, "%s", (char *)arg1); + sprintf(buf, "\"%s\"", (char *)arg1); break; case event_buddy_signoff: - sprintf(buf, "%s", (char *)arg1); + sprintf(buf, "\"%s\"", (char *)arg1); break; case event_buddy_away: - sprintf(buf, "%s", (char *)arg1); + sprintf(buf, "\"%s\"", (char *)arg1); break; case event_buddy_back: - sprintf(buf, "%s", (char *)arg1); + sprintf(buf, "\"%s\"", (char *)arg1); break; case event_blist_update: buf[0] = 0; break; case event_chat_invited: - sprintf(buf, "%s %s %s", (char *)arg1, (char *)arg2, (char *)arg3); + sprintf(buf, "\"%s\" \"%s\" %s", (char *)arg1, (char *)arg2, (char *)arg3); break; case event_chat_join: - sprintf(buf, "%s", (char *)arg1); + sprintf(buf, "\"%s\"", (char *)arg1); break; case event_chat_leave: - sprintf(buf, "%s", (char *)arg1); + sprintf(buf, "\"%s\"", (char *)arg1); break; case event_chat_buddy_join: - sprintf(buf, "%s %s", (char *)arg1, (char *)arg2); + sprintf(buf, "\"%s\" \"%s\"", (char *)arg1, (char *)arg2); break; case event_chat_buddy_leave: - sprintf(buf, "%s %s", (char *)arg1, (char *)arg2); + sprintf(buf, "\"%s\" \"%s\"", (char *)arg1, (char *)arg2); break; case event_chat_recv: - sprintf(buf, "%s %s %s", (char *)arg1, (char *)arg2, (char *)arg3); + sprintf(buf, "\"%s\" \"%s\" %s", (char *)arg1, (char *)arg2, (char *)arg3); break; case event_chat_send: - sprintf(buf, "%s %s", (char *)arg1, *(char **)arg2); + sprintf(buf, "\"%s\" %s", (char *)arg1, *(char **)arg2); break; case event_warned: - sprintf(buf, "%s %d", (char *)arg1, (int)arg2); + sprintf(buf, "\"%s\" %d", (char *)arg1, (int)arg2); break; case event_error: sprintf(buf, "%d", (int)arg1);