void JabberServerRegisterAccount::clientHandshaken()
{
	kdebugf();
	// try to register an account
	XMPP::JT_Register *reg = new XMPP::JT_Register(Client->client()->rootTask());
	connect(reg, SIGNAL(finished()), SLOT(sendRegistrationData()));
	reg->getForm(Server);
	reg->go(true);
	kdebugf();
}
Ejemplo n.º 2
0
bool JabberTransport::removeAccount( )
{
	if(m_status == Removing  ||  m_status == AccountRemoved)
		return true; //so it can be deleted
	
	if (!account()->isConnected())
	{
		account()->errorConnectFirst ();
		return false;
	}
	
	m_status = Removing;
	XMPP::JT_Register *task = new XMPP::JT_Register ( m_account->client()->rootTask () );
	QObject::connect ( task, SIGNAL ( finished () ), this, SLOT ( removeAllContacts() ) );

	//JabberContact *my=static_cast<JabberContact*>(myself());
	task->unreg ( myself()->contactId() );
	task->go ( true );
	return false; //delay the removal
}
void JabberServerRegisterAccount::sendRegistrationData()
{
	kdebugf();
	XMPP::JT_Register *reg = (XMPP::JT_Register *)sender();
	if (reg->success()) {
		XMPP::XData xdata;
	//TODO: upewnić się, że to to jest potrzebne tak jak jest
		if (reg->hasXData()) {
			isOld_ = false;
			xdata = reg->xdata(); 
		}
		else {
			isOld_ = true;
			xdata = convertToXData(reg->form());
		}
	//
		XMPP::JT_Register *reg = new XMPP::JT_Register(Client->client()->rootTask());
		connect(reg, SIGNAL(finished()), this, SLOT(actionFinished()));
		if (isOld_) {
			XMPP::Form form = convertFromXData(fields);
			form.setJid(Server);
			reg->setForm(form);
		}
		else {
			reg->setForm(Server,fields);
		}
		reg->go(true);

	}
	else {
		Result = false;
		emit finished(this);
		MessageBox::msg(tr("This server does not support registration"), false, "Warning");
	}
	kdebugf2();
}