Sending a buddy request in ICQ fails when using libpurple

michaelcbrook at msn.com michaelcbrook at msn.com
Wed Aug 5 21:09:05 EDT 2009


On Wed, 2009-08-05 at 17:56 -0700, Mark Doliner wrote:
> On Wed, Aug 5, 2009 at 5:29 PM,
> michaelcbrook at msn.com<michaelcbrook at msn.com> wrote:
> > On Wed, 2009-08-05 at 10:52 -0700, Mark Doliner wrote:
> >> On Wed, Aug 5, 2009 at 6:22 AM,
> >> michaelcbrook at msn.com<michaelcbrook at msn.com> wrote:
> >> > Ok, since there's been no replies, I'll elaborate a little...
> >> >
> >> > I made a program using libpurple, and one of its features is the ability
> >> > to send buddy requests to certain users in a database.  It runs strictly
> >> > on the command line.  (And no..it is not a spam bot or any stupid thing
> >> > like that).
> >> >
> >> > Now for the problem: Whenever I send a buddy request from my program to
> >> > another ICQ account, the buddy request is never received on the other
> >> > side.  In my program, I send the buddy request by calling
> >> > purple_account_add_buddy().  Also as another note, when I close my
> >> > program (signing the ICQ account off) and run it again, the buddy I just
> >> > tried to add disappears, so it's not staying on the server-side buddy
> >> > list.
> >> >
> >> > Since pidgin can add ICQ buddies successfully but my program can't (for
> >> > some reason??), I tested out the difference between the debug logs when
> >> > adding a buddy in pidgin and adding a buddy in my program (the buddy is
> >> > logged in on a standard Windows ICQ client):
> >> >
> >> > *Adding buddy in libpurple with purple_account_add_buddy():
> >> >
> >> > (05:54:07) oscar: ssi: adding buddy 401787217 to group Buddies
> >> > (05:54:07) oscar: Requesting ICQ alias for 401787217
> >> > (05:54:07) oscar: rate change (param ID 0x0001): curavg = 4668, maxavg =
> >> > 6000, alert at 2000, clear warning at 2500, limit at 1500, disconnect at
> >> > 800 (window size = 80)
> >> > (05:54:07) oscar: ssi: status is 0x000e for a 0x0008 action with name no
> >> > item
> >> > (05:54:07) oscar: icq response: 60 bytes, 579746952, 0x07da, 0x0028
> >> > (05:54:07) oscar: ssi: status is 0x0000 for a 0x0009 action with name
> >> > Buddies
> >> > (05:54:09) util: Writing file accounts.xml to directory /dev/null
> >> > (05:54:09) util: Error creating directory /dev/null: File exists
> >> > (05:54:12) util: Writing file blist.xml to directory /dev/null
> >> > (05:54:12) util: Error creating directory /dev/null: File exists
> >> >
> >> > The buddy request was never received on the other end...
> >> >
> >> > I know the natural assumption is "your program is broken" but I can
> >> > confirm that it works with 3 out of 4 protocols...It works with AIM,
> >> > Yahoo, and MSN, but fails with ICQ, and it still fails even in the
> >> > simplest program.  I am really stumped and would greatly appreciate any
> >> > help...this problem is delaying the launch of a website I'm creating.
> >>
> >> In Pidgin isn't there a dialog that asks the user if they want to
> >> request authorization from the buddy, and allows the user to enter a
> >> little message?  Does your UI handle that?  I think you would need to
> >> implement the request_input callback in the request API.
> >>
> >> -Mark
> >>
> > Is it possible to use purple_request_input without a GUI?  If it is, I
> > don't quite know how the callback functions would be called...
> 
> Yes it's possible.  Your uiop function can call the appropriate
> callback to respond to the request.
> 
> -Mark
> 
Ahh I see now.  I tried calling ok_cb() when the request_input uiop was
called, but I'm getting a segmentation fault now.  Here's my code:

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)
{
ok_cb();
}

static PurpleRequestUiOps request_uiops = 
{
	request_input, /* request_input  */
	NULL,          /* request_choice */
	NULL,          /* request_action */
	NULL,          /* request_fields */
	NULL,          /* request_file   */
	NULL,          /* close_request  */
	NULL,          /* request_folder */
	NULL,
	NULL,
	NULL,
	NULL
};




More information about the Support mailing list