purple_conv_im_send works not as expected

Atamurad Hezretkuliyev atamyrat at gmail.com
Sat Nov 24 10:59:51 EST 2007


Hi,

I have no idea what's wrong with your code, but you can try it with 
PurpleConnectionUiOps,

static void on_connected(PurpleConnection *gc)
{
        printf("Connected! %s\n", gc->account->username);
}

Then fill in PurpleConenctionUiOps structure;
static PurpleConnectionUiOps conn_ui_ops =
{
        NULL,
        on_connected,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL
};

Add following line to init_libpurple()
purple_connections_set_ui_ops(&conn_ui_ops);

regards,
atamurad

Anatoliy Belsky wrote:
> Thanks for the answer, Daniel.
>
> Sorry, the connection to the signal was there too .. I'm playing with the 
> nullclient ... so the full code fragment would be as:
>         account = purple_account_new(name, prpl);
>         purple_account_set_password(account, password);
>         purple_account_set_enabled(account, UI_ID, TRUE);
>
> 	status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE);
> 	purple_savedstatus_activate(status);
>
>     	static int handle;		    
> 	purple_signal_connect(purple_connections_get_handle(), "signed-on", 
> 			&handle,  PURPLE_CALLBACK(signed_on), NULL);
>
>         conv = purple_conversation_new(PURPLE_CONV_TYPE_IM,
>  			account, "account2 at hotmail.com)"); 
>         purple_conv_im_send(PURPLE_CONV_IM(conv), "hi there!");
>
>
> It still not works. The nullclient brings the following output:
>
> 	Username: account1 at hotmail.com
> 	Password:
> 	Starting conversation
> 	Sending a message
> 	(account2 at hotmail.com) (16:08:24) account1 at hotmail.com: hi there!
> 	(account2 at hotmail.com) (16:08:35) AccountName2: account2 at hotmail.com is now
>  	known as AccountName2.
>
> 	Account connected: account1 at hotmail.com prpl-msn
>
> As you can see, the account connected message comes after the message was 
> sent. The signed_on callback function returns immediately after it was 
> called. 
>
> Actually I'm writing the php binding for purple, this makes things more 
> complicated. But this code was probed with pure c. 
>
> May be you have an idea, how can I catch the moment, where the account was 
> connected?
>
> regards
>
> --Anatoliy
>
> _______________________________________________
> Devel mailing list
> Devel at pidgin.im
> http://pidgin.im/cgi-bin/mailman/listinfo/devel
>   




More information about the Devel mailing list