# HG changeset patch # User Jeffrey Connelly # Date 1188154266 0 # Node ID 0202145e3465359bc3cc66aef06e717a67bb9411 # Parent fdddf11a42f2952d682efda64df7c530d847cfb1 In msimprpl, fix the msim_uri_handler(). The sendIM and addContact commands now work (accepting a contact ID). diff -r fdddf11a42f2 -r 0202145e3465 libpurple/protocols/myspace/myspace.c --- 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);