[Delta] trying to make a code like justins code (jabber example) but i have errors
justin-psi2 at affinix.com
Mon Mar 24 16:49:57 PDT 2008
On Monday 24 March 2008 4:09 pm, K. Nimer wrote:
> i guess it does say "press any key to continue" which tells me that yes it
> does quit
> so what do u mean by making it loop?
Iris is event-based and uses the Qt event loop to operate. You should
probably learn some more about Qt programming in general if you don't
Basically, when you call sendMessage(), this queues your request to send the
message. The message will be sent "in the background". If you quit
instantly after queuing the request then Iris will not have a chance to send
Instead of abruptly quitting the application after requesting to send the
message, try cleanly logging out from the server. This will ensure Iris has
transmitted all of the data needed. To do this, you call client->close().
When the logout process has completed, then the delayedCloseFinished() signal
is emitted. Only then should the application quit.
Add a new slot:
// at this point we are disconnected from the server. we can quit safely.
And of course listen for it, just like the other signals:
connect( m_pStream, SIGNAL( delayedCloseFinished() ), SLOT(
stream_delayedCloseFinished() ) );
Now, instead of calling QCoreApplication::instance()->quit() elsewhere in your
program, call m_pClient->close().
m_pClient->start( m_jid.host(), m_jid.user(), m_pass, m_jid.resource() );
std::cout << "Authenticated on server - sweet!" << std::endl;
// our work here is done...
More information about the Delta