nick is just that, the resource of the occupant's jid. For example, your room is "room" on domain "muc.domain.com" and you join the room with the nick of "nick", then the full jid of this occupant would be r...@muc.domain.com/nick. In this scenario the variable nick would be plainly "nick" by the time this method were called. I see one difference between mine and your code. When you construct a Jabber::Message, you set the recipient's address. Try constructing the Jabber::Message object with a nil recipient and then just use the second parameter to @muc.send for that. The MUCClient class does a little magic when processing a message stanza object--it fixes the message type and the recipient address, but it might only do that if the recipient is nil.
+= Erik Elmore On Thu, Mar 25, 2010 at 2:23 PM, StuFF mc <m...@stuffmc.com> wrote: > just to be sure... what's "nick" - is it just "user123", without any @ > or / ? :-) Just to be sure, once again, coz if it's the case, that's > exactly my code, and nope, it doesn't work in my case :( > > The only difference would be the way the message is build, but since I > can see the "body" in the XML and it works speaking to the room, I'd > be clueless... (but hey! thanks for your help in *any* case) > > > On Thu, Mar 25, 2010 at 7:19 PM, Erik Elmore <e...@ironsavior.net> wrote: > > I have a method that sends private messages and I can confirm that it > works > > in response to commands. I don't have it sending messages in response to > > join events, but it does process join events for the purposes of tracking > > the state of room occupants. This method could be called from the last > > method I posted right after the line with "begin". > > > > def notify_nick( nick, body, html = nil ) > > reply = Jabber::Message.new > > reply.body = body > > unless html.nil? > > reply.body = 'If you can see this, you need to use a client that > > supports XHTML messages.' if body.nil? > > reply.add_element(Jabber::XHTML::HTML.new(html)) > > end > > @muc.send(reply, nick) > > end > > > > += > > Erik Elmore > > > > > > > > > > On Thu, Mar 25, 2010 at 2:12 PM, StuFF mc <m...@stuffmc.com> wrote: > >> > >> And I should mention that I use m.from.resource ( "m" being the > >> presence object from the @muc.add_join_callback). I also tried with > >> the complete "r...@server.com/resource" and in this case as we all > >> know the resource is the user, but it doesn't work either... > >> > >> > >> > >> On Thu, Mar 25, 2010 at 7:11 PM, StuFF mc <m...@stuffmc.com> wrote: > >> > I think my problem is more about Private messages... Your code would > >> > work in my code, since I already checked that. Sending a message in > >> > the Chat Room works. > >> > > >> > What doesn't (and did until recently) is sending a private message to > >> > someone in the room (actually to the one appearing in the room, and in > >> > your case to the one sending the command). Would you mind checking if > >> > your code works if you send back the "some message" only to the user > >> > who has initiated the command? > >> > > >> > > >> > > >> > On Thu, Mar 25, 2010 at 7:06 PM, Erik Elmore <e...@ironsavior.net> > >> > wrote: > >> >> Keep in mind that if the decode thread raises errors, you might not > >> >> necessarily see any output at all. The begin..rescue..end block > within > >> >> the > >> >> callback structure I just posted is the best way I've found to detect > >> >> errors > >> >> within the decode thread. > >> >> > >> >> += > >> >> Erik Elmore > >> >> > >> >> > >> >> > >> >> > >> >> On Thu, Mar 25, 2010 at 1:58 PM, StuFF mc <m...@stuffmc.com> wrote: > >> >>> > >> >>> Also what's the best way to investigate on such an issue :( I > checked > >> >>> from Adium it works perfectly from Jabber's side, so there's > >> >>> definetely something wrong with either my code or (I doubt) XMPP. > >> >>> > >> >>> But this code was working until recently. I don't know what I might > >> >>> have changed (also looking at Git it doesn't strike me). > >> >>> > >> >>> Once the "send" is sent, isn't there some kind of "confirmation" > that > >> >>> the message arrived? > >> >>> > >> >>> > >> >>> On Thu, Mar 25, 2010 at 6:35 PM, StuFF mc <m...@stuffmc.com> wrote: > >> >>> > ? In the same thread? How would you do else? > >> >>> > > >> >>> > > >> >>> > On Thu, Mar 25, 2010 at 6:31 PM, Erik Elmore <e...@ironsavior.net > > > >> >>> > wrote: > >> >>> >> You are trying to send a message in the same thread as the > >> >>> >> handler. I > >> >>> >> know > >> >>> >> that isn't ideal, but I don't know if it might cause a deadlock > >> >>> >> condition or > >> >>> >> raise errors, however. > >> >>> >> > >> >>> >> += > >> >>> >> Erik Elmore > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> On Thu, Mar 25, 2010 at 11:44 AM, StuFF mc <m...@stuffmc.com> > wrote: > >> >>> >>> > >> >>> >>> http://pastie.textmate.org/private/h8tmlxwwahv0rbhrcsw7rg > >> >>> >>> > >> >>> >>> Anybody would know why? > >> >>> >>> > >> >>> >>> Cheers. > >> >>> >>> > >> >>> >>> _______________________________________________ > >> >>> >>> Xmpp4r-devel mailing list > >> >>> >>> Xmpp4r-devel@gna.org > >> >>> >>> https://mail.gna.org/listinfo/xmpp4r-devel > >> >>> >> > >> >>> >> > >> >>> >> _______________________________________________ > >> >>> >> Xmpp4r-devel mailing list > >> >>> >> Xmpp4r-devel@gna.org > >> >>> >> https://mail.gna.org/listinfo/xmpp4r-devel > >> >>> >> > >> >>> >> > >> >>> > > >> >>> > >> >>> _______________________________________________ > >> >>> Xmpp4r-devel mailing list > >> >>> Xmpp4r-devel@gna.org > >> >>> https://mail.gna.org/listinfo/xmpp4r-devel > >> >> > >> >> > >> >> _______________________________________________ > >> >> Xmpp4r-devel mailing list > >> >> Xmpp4r-devel@gna.org > >> >> https://mail.gna.org/listinfo/xmpp4r-devel > >> >> > >> >> > >> > > >> > >> _______________________________________________ > >> Xmpp4r-devel mailing list > >> Xmpp4r-devel@gna.org > >> https://mail.gna.org/listinfo/xmpp4r-devel > > > > > > _______________________________________________ > > Xmpp4r-devel mailing list > > Xmpp4r-devel@gna.org > > https://mail.gna.org/listinfo/xmpp4r-devel > > > > > > _______________________________________________ > Xmpp4r-devel mailing list > Xmpp4r-devel@gna.org > https://mail.gna.org/listinfo/xmpp4r-devel >
_______________________________________________ Xmpp4r-devel mailing list Xmpp4r-devel@gna.org https://mail.gna.org/listinfo/xmpp4r-devel