Re-request Authorization with libpurple?
michaelcbrook at msn.com
michaelcbrook at msn.com
Tue Aug 11 23:09:48 EDT 2009
On Tue, 2009-08-11 at 17:32 -0700, Mark Doliner wrote:
> On Tue, Aug 11, 2009 at 4:00 PM,
> michaelcbrook at msn.com<michaelcbrook at msn.com> wrote:
> > Does anyone know how to imitate the "Re-request Authorization" button,
> > that's in pidgin, in libpurple?
>
> I think you would need to call the blist_node_menu prpl callback
> function for the buddy, then find the action in the list with the name
> "Re-request Authorization" and call the callback function. Yes, it's
> ugly
>
> -Mark
>
Ok, I think I'm really close, but I'm having some trouble calling the
callback function. Here's what I have:
gboolean re_request_buddy(gpointer data)
{
printf("Re-requesting authorization...\n");
PurpleBuddy *buddy = data;
if (buddy!=NULL)
{
PurplePluginProtocolInfo *prpl_info =
PURPLE_PLUGIN_PROTOCOL_INFO(purple_account_get_connection(purple_buddy_get_account(buddy))->prpl);
if(prpl_info && prpl_info->blist_node_menu)
{
GList *menu = prpl_info->blist_node_menu((PurpleBlistNode *)buddy);
int i = 0;
while (i < g_list_length(menu))
{
PurpleMenuAction *menu_action = g_list_nth_data(menu, i);
if (strcmp(menu_action->label, "Re-request Authorization")==0)
{
printf("Found re-request menu option...\n");
menu_action->callback((PurpleBlistNode *)buddy);
break;
}
i++;
}
}
else
{
printf("ERROR 2\n");
}
}
else
{
printf("ERROR 1\n");
}
}
The compiler comes back saying:
master.c: In function ‘re_request_buddy’:
master.c:1129: error: too many arguments to function
‘menu_action->callback’
How should I be calling the callback function?
-Michael
More information about the Support
mailing list