[swift-users] Changing presence for MUC...
Marc Neeley
neeleym at ociweb.com
Fri Mar 2 20:53:50 CET 2012
I apologize, but when I turn the client tracing on in the code, the output
appears to be encrypted. Is there some sort of switch that removes that?
Regardless, I've attached the file if it helps. This is just the startup and
connection.
In the meantime I'll follow your other suggestions below.
Thanks,
Marc
-----Original Message-----
From: k.i.smith at gmail.com [mailto:k.i.smith at gmail.com] On Behalf Of Kevin
Smith
Sent: Friday, March 02, 2012 1:28 PM
To: Marc Neeley
Cc: swift-users at swift.im
Subject: Re: [swift-users] Changing presence for MUC...
On Fri, Mar 2, 2012 at 6:49 PM, Marc Neeley <neeleym at ociweb.com> wrote:
> I thought that I would want presence to go to everything that I am
> connected to.
Sending it through the PresenceSender is the thing to do, then.
> I guess I'm either in the room or not with a given MUC instance. When
> I join with a joinAs(...), shouldn't a .onJoinComplete() callback be
> triggered?
There's three possible outcomes - onJoinComplete for a successful join,
onJoinFailed for an authoritative failure to join, or neither while
Swiften's waiting for the server to tell it one way or the other. It's not
immediately obvious to me what it's not triggering for you - before I start
blaming it on buggy MUC servers, it'd probably be good to check this isn't a
problem with our code - can you send the protocol transcript for the
session, please?
> I was assuming that joinAs() was asynchronous like
> connect() is for a client session and that .onJoinComplete() would be
>analogous to .onConnected().
You assumed correctly.
> After joining, I wanted the bot that I'm working on to send a few
> messages after joining.
>
> I have a new client session called XMPPclient_ and in the
> onConnected() handle I join the room:
I think you want to join the MUC through the MUCManager exposed on
Client::getMUCManager(). This will sort out the DirectedPresenceSender for
you.
> void MessageEngineComponent::handleJoinComplete(const std::string&
> nick) {
>
> if (verbose_) {
> std::cout << "Join complete for:" << nick << std::endl;
> }
>
> joined_ = true;
>
> boost::shared_ptr<Swift::Message> xmppMsg(new
> Swift::Message());
> xmppMsg->setType(Swift::Message::Type::Groupchat);
> xmppMsg->setTo(localRoom_);
> xmppMsg->setFrom(XMPPclient_->getJID());
If you're writing a client (or a bot, or whatever) you don't want to be
setting the from attribute on stanzas, not that this will break what you're
doing. Probably.
> The above code doesn't seem to fire. Did do the bind incorrectly or am
> I misinterpreting what .onJoinComplete() is?
I suspect something else is at play. Let's see the XML and go from there.
/K
More information about the swift-users
mailing list