# HG changeset patch # User Sean Egan # Date 1030502299 0 # Node ID b48065e5233732ba32eccdeba8635dd96c21d05f # Parent 8de4f34a1bd745bfa8b0482bc0538630dffd4061 [gaim-migrate @ 3503] A few patches. Brian--tell me what your last name is, and I'll put it in. ;) committer: Tailor Script diff -r 8de4f34a1bd7 -r b48065e52337 ChangeLog --- a/ChangeLog Tue Aug 27 22:22:55 2002 +0000 +++ b/ChangeLog Wed Aug 28 02:38:19 2002 +0000 @@ -45,6 +45,11 @@ (Thanks Jonas Birmé) * Parse URL messages and Contact Sending in ICQ (Thanks Mark Doliner) + * Added GAIM::remove_event_handler and made set_info short + circuitable in perl. (Thanks Ryan McCabe) + * Improved MSN internationalization (Thanks A Lee) + * Can get info for ICQ and Jabber users from the "Edit + Buddies" tab (Thanks click81) version 0.59 (06/24/2002): * Hungarian translation added (Thanks, Sutto Zoltan) diff -r 8de4f34a1bd7 -r b48065e52337 plugins/PERL-HOWTO --- a/plugins/PERL-HOWTO Tue Aug 27 22:22:55 2002 +0000 +++ b/plugins/PERL-HOWTO Wed Aug 28 02:38:19 2002 +0000 @@ -131,10 +131,15 @@ so that gaim knows what the changes are. Perl scripts can short-circuit certain events (namely event_im_send, - event_im_recv, event_chat_send, and event_chat_recv). To short-circuit an - event simply return a non-0 value. This will cause all subsequent scripts - and the event itself to never happen (i.e. the user won't see it happen, - and _send events won't actually send). + event_im_recv, event_chat_send, event_chat_recv and event_set_info). To + short-circuit an event simply return a non-0 value. This will cause all + subsequent scripts and the event itself to never happen (i.e. the user + won't see it happen, and _send events won't actually send). + +GAIM::remove_event_handler(event, function) + This removes the event handler for the specified event that + calls "function" as its handler. The event handler must have been + previously added with GAIM::add_event_handler. GAIM::add_timeout_handler(integer, function, args) This calls function after integer number of seconds. It only calls function diff -r 8de4f34a1bd7 -r b48065e52337 src/perl.c --- a/src/perl.c Tue Aug 27 22:22:55 2002 +0000 +++ b/src/perl.c Wed Aug 28 02:38:19 2002 +0000 @@ -106,6 +106,7 @@ /* handler commands */ XS(XS_GAIM_add_event_handler); /* when servers talk */ +XS(XS_GAIM_remove_event_handler); /* remove a handler */ XS(XS_GAIM_add_timeout_handler); /* figure it out */ /* play sound */ @@ -244,6 +245,7 @@ newXS ("GAIM::serv_send_im", XS_GAIM_serv_send_im, "GAIM"); newXS ("GAIM::add_event_handler", XS_GAIM_add_event_handler, "GAIM"); + newXS ("GAIM::remove_event_handler", XS_GAIM_remove_event_handler, "GAIM"); newXS ("GAIM::add_timeout_handler", XS_GAIM_add_timeout_handler, "GAIM"); newXS ("GAIM::play_sound", XS_GAIM_play_sound, "GAIM"); @@ -814,6 +816,30 @@ XSRETURN_EMPTY; } +XS (XS_GAIM_remove_event_handler) +{ + unsigned int junk; + struct _perl_event_handlers *ehn; + GList *cur = perl_event_handlers; + dXSARGS; + + while (cur) { + GList *next = cur->next; + ehn = cur->data; + + if (!strcmp(ehn->event_type, SvPV(ST(0), junk)) && + !strcmp(ehn->handler_name, SvPV(ST(1), junk))) + { + perl_event_handlers = g_list_remove(perl_event_handlers, ehn); + g_free(ehn->event_type); + g_free(ehn->handler_name); + g_free(ehn); + } + + cur = next; + } +} + static int perl_timeout(gpointer data) { struct _perl_timeout_handlers *handler = data; diff -r 8de4f34a1bd7 -r b48065e52337 src/protocols/jabber/jabber.c --- a/src/protocols/jabber/jabber.c Tue Aug 27 22:22:55 2002 +0000 +++ b/src/protocols/jabber/jabber.c Wed Aug 28 02:38:19 2002 +0000 @@ -3075,6 +3075,11 @@ struct proto_buddy_menu *pbm; pbm = g_new0(struct proto_buddy_menu, 1); + pbm->label = _("Get Info"); + pbm->callback = jabber_get_info; + pbm->gc = gc; + m = g_list_append(m, pbm); + pbm = g_new0(struct proto_buddy_menu, 1); pbm->label = _("Remove From Roster"); pbm->callback = jabber_remove_buddy_roster_item; pbm->gc = gc; diff -r 8de4f34a1bd7 -r b48065e52337 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Tue Aug 27 22:22:55 2002 +0000 +++ b/src/protocols/msn/msn.c Wed Aug 28 02:38:19 2002 +0000 @@ -844,8 +844,8 @@ char buf[MSN_BUF_LEN]; char *srvfriend; - srvfriend = str_to_utf8(url_encode(map->friend)); - g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, map->user, srvfriend); + srvfriend = str_to_utf8(map->friend); + g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, map->user, url_encode(srvfriend)); g_free(srvfriend); if (msn_write(md->fd, buf, strlen(buf)) < 0) { @@ -863,10 +863,10 @@ { struct msn_data *md = map->gc->proto_data; char buf[MSN_BUF_LEN]; - char *srvfriend = str_to_utf8(url_encode(map->friend)); + char *srvfriend = str_to_utf8(map->friend); if (*(map->user)) { - g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, map->user, srvfriend); + g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, map->user, url_encode(srvfriend)); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(map->gc, "Write error"); signoff(map->gc); @@ -1191,7 +1191,9 @@ GET_NEXT(tmp); GET_NEXT(tmp); GET_NEXT(tmp); - friend = utf8_to_str(tmp); + + friend = url_decode(tmp); + friend = utf8_to_str(friend); g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); g_free(friend); @@ -2115,14 +2117,14 @@ if (!entry || *entry == NULL) alias = g_strdup(""); else - alias = str_to_utf8(url_encode(entry)); + alias = str_to_utf8(entry); if (strlen(alias) >= BUDDY_ALIAS_MAXLEN) { do_error_dialog(_("New MSN friendly name too long."), NULL, GAIM_ERROR); return; } - g_snprintf(buf, sizeof(buf), "REA %d %s %s\r\n", ++md->trId, gc->username, alias); + g_snprintf(buf, sizeof(buf), "REA %d %s %s\r\n", ++md->trId, gc->username, url_encode(alias)); g_free(alias); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(gc, "Write error"); diff -r 8de4f34a1bd7 -r b48065e52337 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Tue Aug 27 22:22:55 2002 +0000 +++ b/src/protocols/oscar/oscar.c Wed Aug 28 02:38:19 2002 +0000 @@ -3702,6 +3702,23 @@ return m; } +static GList *oscar_edit_buddy_menu(struct gaim_connection *gc, char *who) +{ + GList *m = NULL; + struct proto_buddy_menu *pbm; + struct oscar_data *odata = gc->proto_data; + + if (odata->icq) { + pbm = g_new0(struct proto_buddy_menu, 1); + pbm->label = _("Get Info"); + pbm->callback = oscar_get_info; + pbm->gc = gc; + m = g_list_append(m, pbm); + } + + return m; +} + static GList *oscar_user_opts() { GList *m = NULL; @@ -3950,6 +3967,7 @@ ret->actions = oscar_actions; ret->do_action = oscar_do_action; ret->buddy_menu = oscar_buddy_menu; + ret->edit_buddy_menu = oscar_edit_buddy_menu; ret->user_opts = oscar_user_opts; ret->login = oscar_login; ret->close = oscar_close; diff -r 8de4f34a1bd7 -r b48065e52337 src/server.c --- a/src/server.c Tue Aug 27 22:22:55 2002 +0000 +++ b/src/server.c Wed Aug 28 02:38:19 2002 +0000 @@ -232,7 +232,8 @@ void serv_set_info(struct gaim_connection *g, char *info) { if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_info) { - plugin_event(event_set_info, g, info, 0, 0); + if (plugin_event(event_set_info, g, info, 0, 0)) + return; g->prpl->set_info(g, info); } }