purple_conv_im_send works not as expected

Anatoliy Belsky anatoliy at belsky.info
Sat Nov 24 08:53:36 EST 2007


Hi,

i have the following question. I'm trying to start a new conversation with the 
code like this:

	account = purple_account_new(name, prpl);
	purple_account_set_password(account, password);
	purple_account_set_enabled(account, UI_ID, TRUE);

	conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, "somebody"); 
	purple_conv_im_send(PURPLE_CONV_IM(conv), "hi there!");

but this not works at all.  If the I check the account with 
purple_account_is_connected(account), it turns out, that the account is not 
connected yet. So in fact the account goes online after about 5 seconds after  
the conversation has being started.

At the same time the piece of code in the callback write_conv or write_im 
function works, if i start the conversation from the other side:

	if(PURPLE_MESSAGE_RECV == flags) {
		if(0 == strcmp("hello", message)) {
			purple_conv_im_send(con, "hi there!");
		}
	}

so the question is: what I'm doing wrong? ... as I guess, may be in the first 
case the account is not yet ready (or not connected), and therefore the 
message could be sent?

thanks in advance

--
Anatoliy




More information about the Devel mailing list