Questions about MySpaceIMPlugging msim_import_friends

Christopher Jiménez cjimenez16 at gmail.com
Tue Mar 24 21:22:34 EDT 2009


Hi All.
I am very new to libpurple and I am still figuring out some stuff. I am
building a chat client for a college project and have been adding support
for MySpaceIM.
I will like to be abble to export contact from myspace.com to myspaceim from
my client. I check the code and looks like msim_import_friends is the
function to call.
The problem is that I dont know how to do it.
Do I need to call it directly from the myspace.c class by doing something
like this?

extern "C" {
#include <libpurple/protocols/myspace/myspace.h>
}

Or is there other way of doing it?
You may understand better if I send you an code part of other functionality.
For example this is how I add a contact

#include <libpurple/blist.h>
}

bool PurpleIMContactList::addContactCbk(void * data)
{
    Mutex::ScopedLock lock(PurpleIMContactList::_mutex);

    PurpleIMContactList * imContactList = ((misc_t *)data)->instance;
    const char * groupName =(const char *)((misc_t *)data)->data_ptr1;
    const char * contactId =(const char *)((misc_t *)data)->data_ptr2;
    PurpleAccount *gAccount =
purple_accounts_find(imContactList->getIMAccount().getLogin().c_str(),

PurpleIMPrcl::GetPrclId(imContactList->getIMAccount().getProtocol()));
    PurpleGroup *gGroup = NULL;
    PurpleBuddy *gBuddy = NULL;

    if ((gGroup = purple_find_group(groupName)) == NULL) {
        gGroup = purple_group_new(groupName);
        purple_blist_add_group(gGroup, NULL);
    }

    gBuddy = purple_buddy_new(gAccount, contactId, contactId);
    purple_blist_add_buddy(gBuddy, NULL, gGroup, NULL);
    purple_account_add_buddy(gAccount, gBuddy);

    purple_timeout_remove(((misc_t *)data)->cbk_id);

    free(((misc_t *)data)->data_ptr1);
    free(((misc_t *)data)->data_ptr2);
    free((misc_t *)data);

    return TRUE;
}

I dont know if there is  way of getting to that function using blist for
example.
Any help will be much appreciated.
Thanks a lot
CJC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.im/pipermail/devel/attachments/20090324/336450c0/attachment.html>


More information about the Devel mailing list