1

The following snippet is picked out of a JIRA plugin I'm writing to (hopefully) notify people (co-workers) via an IM (gchat in my case) when they've been @mentioned on a JIRA ticket.

   import org.jivesoftware.smack.Chat;
   import org.jivesoftware.smack.ChatManager;
   import org.jivesoftware.smack.ConnectionConfiguration;
   import org.jivesoftware.smack.MessageListener;
   import org.jivesoftware.smack.XMPPConnection;
   import org.jivesoftware.smack.XMPPException;
   import org.jivesoftware.smack.packet.Message;

   ConnectionConfiguration config = new ConnectionConfiguration(<server>, <port>, <domain>);
   XMPPConnection connection = New XMPPConnection(config);

   connection.connect();
   connection.login(someone@domain_a.com, <password>);

   ChatManager chatManager = connection.getChatManager();

   Chat chat = chatManager.createChat(someone@domain_b, new MessageListener() {
      public void processMessage(Chat chat, Message msg) {
          System.out.println("Received message "+ msg);
      }
   });

   chat.sendMessage(<msg>);

My issue is that I'm able to send the IM notifications to users that share the domain of the user who was authenticated at the line:

connection.login(someone@domain_a.com, <password>);

But not others - eg: I can send from somone@domain_a.com to someon_else@domain_a.com but NOT able to send it to someone_else@domain_b.com...

Any help is appreciated. Cheers,

4

1 回答 1

0

我将继续回答我的菜鸟错误:

问题是经过身份验证的用户在他们的聊天列表中没有他们试图将消息发送到(来自不同域)的用户......

一旦他们成为“朋友”,它就没有问题#facepalm

于 2012-10-31T12:57:58.457 回答