Commit bf13ed51 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Return an error presence when probing non-existent user. GATE-85

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk/src/plugins/gateway@5670 b35dd754-fafc-0310-a699-88a17e54d16e
parent 84bb2b20
......@@ -11,17 +11,18 @@
package org.jivesoftware.wildfire.gateway.protocols.msn;
import net.sf.jml.*;
import net.sf.jml.impl.MsnMessengerFactory;
import net.sf.jml.impl.BasicMessenger;
import net.sf.jml.impl.MsnMessengerFactory;
import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.gateway.*;
import org.jivesoftware.wildfire.user.UserNotFoundException;
import org.jivesoftware.wildfire.roster.RosterItem;
import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.user.UserNotFoundException;
import org.xmpp.packet.JID;
import org.xmpp.packet.PacketError;
import org.xmpp.packet.Presence;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
/**
......@@ -256,13 +257,17 @@ public class MSNSession extends TransportSession {
*/
public void retrieveContactStatus(JID jid) {
MsnContact msnContact = msnContacts.get(getTransport().convertJIDToID(jid));
if (msnContact == null) {
return;
}
Presence p = new Presence();
p.setTo(getJID());
p.setFrom(getTransport().convertIDToJID(msnContact.getEmail().toString()));
((MSNTransport)getTransport()).setUpPresencePacket(p, msnContact.getStatus());
if (msnContact != null) {
p.setFrom(getTransport().convertIDToJID(msnContact.getEmail().toString()));
((MSNTransport)getTransport()).setUpPresencePacket(p, msnContact.getStatus());
}
else {
// User was not found so send an error presence
p.setFrom(jid);
p.setError(PacketError.Condition.forbidden);
}
getTransport().sendPacket(p);
}
......
......@@ -10,21 +10,22 @@
package org.jivesoftware.wildfire.gateway.protocols.yahoo;
import java.io.IOException;
import java.util.*;
import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.gateway.*;
import org.jivesoftware.wildfire.user.UserNotFoundException;
import org.jivesoftware.wildfire.roster.RosterItem;
import org.jivesoftware.wildfire.user.UserNotFoundException;
import org.xmpp.packet.JID;
import org.xmpp.packet.Presence;
import org.xmpp.packet.Message;
import org.xmpp.packet.PacketError;
import org.xmpp.packet.Presence;
import ymsg.network.LoginRefusedException;
import ymsg.network.Session;
import ymsg.network.YahooGroup;
import ymsg.network.YahooUser;
import java.io.IOException;
import java.util.*;
/**
* Represents a Yahoo session.
*
......@@ -348,14 +349,22 @@ public class YahooSession extends TransportSession {
YahooUser user = yahooSession.getUser(jid.getNode());
Presence p = new Presence();
p.setTo(getJID());
p.setFrom(getTransport().convertIDToJID(user.getId()));
if (user != null) {
// User was found so update presence accordingly
p.setFrom(getTransport().convertIDToJID(user.getId()));
String custommsg = user.getCustomStatusMessage();
if (custommsg != null) {
p.setStatus(custommsg);
}
String custommsg = user.getCustomStatusMessage();
if (custommsg != null) {
p.setStatus(custommsg);
}
((YahooTransport)getTransport()).setUpPresencePacket(p, user.getStatus());
((YahooTransport)getTransport()).setUpPresencePacket(p, user.getStatus());
}
else {
// User was not found so send an error presence
p.setFrom(jid);
p.setError(PacketError.Condition.forbidden);
}
getTransport().sendPacket(p);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment