Skip to content

Commit

Permalink
Engine-XMPP: regression from fc69d82 caused NRE when sending messages…
Browse files Browse the repository at this point in the history
… to bare Jids

this was noticed in gtalk, as messages there are always sent to bare Jids.
calling /whois on a contact to which such a message had been sent caused the NullRefException.
this will be properly fixed in refactor/XmppResourceModel
  • Loading branch information
Oliver Schneider committed Dec 1, 2013
1 parent bc32716 commit d4dcc31
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Engine-XMPP/Protocols/Xmpp/XmppProtocolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1358,17 +1358,21 @@ void _Say(ChatModel chat, string text, bool send, bool display)
);
}

[MethodImpl(MethodImplOptions.Synchronized)]
void SendPrivateMessage(XmppPersonModel person, Jid jid, string text)
{
var mesg = new Message(jid, XmppMessageType.chat, text);
var res = person.GetOrCreateResource(jid);
if (res.NicknameContactKnowsFromMe != Nicknames[0]) {
res.NicknameContactKnowsFromMe = Nicknames[0];
mesg.Nickname = new Nickname(Nicknames[0]);
XmppResourceModel res;
if (person.Resources.TryGetValue(jid.Resource ?? "", out res)) {
if (res.NicknameContactKnowsFromMe != Nicknames[0]) {
res.NicknameContactKnowsFromMe = Nicknames[0];
mesg.Nickname = new Nickname(Nicknames[0]);
}
}
JabberClient.Send(mesg);
}

[MethodImpl(MethodImplOptions.Synchronized)]
void SendPrivateMessage(XmppPersonModel person, string text)
{
Jid jid = person.Jid;
Expand Down

0 comments on commit d4dcc31

Please sign in to comment.