libpurple msn change display name

yiğit boyar yboyar at gmail.com
Thu Apr 29 15:25:17 EDT 2010


to directly use msn_act_id, u have to compile w/ msn plugin.

if you are just comfortable w/ nullclient settings, I found a workaround to
capture msn_act_id function pointer w/o compiling w/ msn (somehow linking
did not work, maybe i could not make it work).
I'm sure it is not the best thing to do, but libpurple is just a part of my
application and i did not want to mess w/ purple plugins.

Basically what i do is, find the set friendly name action in msn plugin,
trigger it, add a listener to ui ops and grap the function from ok_cb,

*how to trigger*:

    GList * iter;
    int i;
    iter = purple_plugins_get_protocols();
    for (i = 0; iter; iter = iter->next) {
        PurplePlugin * plugin = (PurplePlugin *)(iter->data);
        PurplePluginInfo * info = plugin->info;
        if (strcmp(info->name, "MSN") == 0) {

            GList * (* actions)(PurplePlugin * plugin, gpointer context);
            actions = plugin->info->actions;
            GList * itr = actions(plugin, NULL);
            for (; itr; itr = itr->next) {
                if (itr->data) {
                    PurplePluginAction * action = (PurplePluginAction * )
itr->data;
                    printf("%s\n", action->label);
                    if (strcmp(action->label, "Set Friendly Name...") == 0)
{
                        action->callback(action);
                    }
                } else {
                    printf("%s\n", "no data for action");
                }
            }
        }
    }

*how to grap the funciton pointer:*

static void * request_input(const char * title, const char * primary, const
char * secondary, const char * default_value, gboolean multiline, gboolean
masked, gchar * hint, const char * ok_text, GCallback ok_cb, const char *
cancel_text, GCallback cancel_cb, PurpleAccount * account, const char * who,
PurpleConversation * conv, void * user_data) {
    if (strcmp(primary, "Set friendly name for (null).") == 0) {
//here, ok_cb is the set friendly name function
// static void ( * set_friendly_name)(void * , const char * );
        set_friendly_name = ((PurpleRequestInputCb) ok_cb);

    }

*ui op listeners:*

static PurpleRequestUiOps notificationd_request_uiops = {
    request_input,
    NULL,
    NULL,
    NULL,
NULL,
    NULL,
    NULL,
NULL,
    NULL,
    NULL,
    NULL
};

purple_request_set_ui_ops(&notificationd_request_uiops);


of course, in the listener, u can directly call the callback to set the
username.
or as u get the reference to the set_friendly_name function, u can always
call it by:
PurpleConnection * gc = purple_account_get_connection(account);
set_friendly_name(gc, nickname.c_str());

hope it helps,

yigit

On Wed, Apr 28, 2010 at 7:42 PM, Craig Harding <craigwharding at gmail.com>wrote:

> See previous emails to this list regarding set_alias and also look for
> the msn_act_id function in the libpurple/protocols/msn directory.
>
>
>
> On 2/22/10, Hij Bogdan <bogdan_hij at yahoo.com> wrote:
> > Hello guys,
> >
> > Using libpurple 2.6.3 on a  Gentoo x64 machine.
> >
> > I am trying to change display name(friendly name) with
> > purple_connection_set_display_name() function but with no efect.
> > I can see that this function is not enough to do this.
> > How could I touch my goal?
> > I have to mention that i am not using any interface. My code is based on
> > nullclient example and a java module is taking all the information from
> my
> > shared object through JNI.
> > Any suggestion will be highly appreciated.
> >
> > Thank you in advance,
> > Bogdan
> >
> >
> >
> >
>
> _______________________________________________
> Support at pidgin.im mailing list
> Want to unsubscribe?  Use this link:
> http://pidgin.im/cgi-bin/mailman/listinfo/support
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.im/pipermail/support/attachments/20100429/5f670ede/attachment.html>


More information about the Support mailing list