Mercurial > pidgin.yaz
changeset 19439:0202145e3465
In msimprpl, fix the msim_uri_handler(). The sendIM and addContact commands
now work (accepting a contact ID).
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Sun, 26 Aug 2007 18:51:06 +0000 |
parents | fdddf11a42f2 |
children | 3ad938b84843 eb0fe583bc53 |
files | libpurple/protocols/myspace/myspace.c |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Sun Aug 26 18:42:00 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Sun Aug 26 18:51:06 2007 +0000 @@ -2995,12 +2995,16 @@ if (g_ascii_strcasecmp(proto, "myim")) return FALSE; - uid_str = g_hash_table_lookup(params, "uID"); - cid_str = g_hash_table_lookup(params, "cID"); + /* Parameters are case-insensitive. */ + uid_str = g_hash_table_lookup(params, "uid"); + cid_str = g_hash_table_lookup(params, "cid"); uid = uid_str ? atol(uid_str) : 0; cid = cid_str ? atol(cid_str) : 0; + /* Need a contact. */ + g_return_val_if_fail(cid != 0, FALSE); + /* Find our account with specified user id, or use first connected account if uid=0. */ account = NULL; l = purple_accounts_get_all(); @@ -3020,18 +3024,21 @@ return FALSE; } + /* TODO: msim_lookup_user() on cid, so can add by username? */ + /* myim:sendIM?uID=USERID&cID=CONTACTID */ if (!g_ascii_strcasecmp(cmd, "sendIM")) { PurpleConversation *conv; conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, cid_str, account); - if (!conv) + if (!conv) { + purple_debug_info("msim_uri_handler", "creating new conversation for %s\n", cid_str); conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, cid_str); + } + + /* Just open the window so the user can send an IM. */ purple_conversation_present(conv); - /* TODO: where to get the message? or is there any? */ - purple_conv_send_confirm(conv, "test"); - /* myim:addContact?uID=USERID&cID=CONTACTID */ } else if (!g_ascii_strcasecmp(cmd, "addContact")) { purple_blist_request_add_buddy(account, cid_str, _("Buddies"), NULL);