MSN Chat problem ( chat message bouncing back)

Hi,

I am able to send chat message to another yahoo user using smack and via openfire but unable to send chat message to MSN and Gtalk contacts.

Problem is chat message is bouncing back from MSN and Gtalk as if they have sended the message.

I guess it’s possible to chat with msn and Gtalk contacts. — Gtalk is experimental but MSN is not.

Is there any temporary solution available for Gtalk chat ?

msn.zenon153 is my msn transport address.

Received message: org.jivesoftware.smack.packet.Message@23f9d225
ERROR_MESSAGE:
from<somnathmajee hotmail.com@msn.zenon153>
null
Type To <user1@zenon153/Smack>

Below is my test code

// Assume we’ve created an XMPPConnection name “connection”.

        ChatManager chatmanager = conn.getChatManager();
        Chat newChat = chatmanager.createChat("somnathmajee\40hotmail.com@msn.zenon153", new MessageListener() {
            public void processMessage(Chat chat, Message message) {
                System.out.println("Received message: " + message);
            }
        });
        try {
            newChat.sendMessage("MESSAGE PELE BOLISH");
        }
        catch (XMPPException e) {
            System.out.println("Error Delivering block");
        }

Thanks,

Samba

Hi,

Finally i found the solution myself.

Suppose you want to send chat message to yahoo, msn and gtalk users having the id’s as shown below.

Please note that the mail sign / icon is the @ sign .

Yahoo:- testuser@yahoo.com

MSN:- testuser1@yahoo.com / testuser1@yahoo.com is registered as windows live id

Gtlak:- testuser@gmail.com

Your domainname is yourdomain.com , so your yahoo, gtalk and msn transport address will be

  1. msn.yourdomain.com
  2. yahoo.yourdomain.com
  3. gtalk.yourdomain.com

Set to address to :-

  1. testuesr@yahoo.yourdomain.com
  2. testuser\40gmail.com@gtalk.yourdomain.com
  3. testuser1\40yahoo.com@msn.yourdomain.com or testuser1\40hotmail.com@msn.yourdomain.com

Don’t forget to put the \40 in place of @.

Notes / Steps:-

  1. Connect to XMPP Server
  2. **Add message listener
    **
  3. Register Yahoo, Gtlak, MSN transport
  4. **Add Yahoo, Gtlak, MSN transport to the roster / contacts
    **
  5. Login to Yahoo, Gtlak, MSN transport
  6. Now send message

You can use the below code:-

        Chat chat = rim.XMPPCreateChat(conn, "atul280781\\40hotmail.com@msn.zenon153");                                                  
   
        if(chat!=null)
        {                   
            System.out.println("SENDING CHAT MESSAGE");
            rim.XMPPSendChatMessage("Hello World!!", chat);
        }                   
    public void XMPPSendChatMessage(String Message, Chat chat)
    {
        try{
           
            chat.sendMessage(Message);
        }
        catch(XMPPException e)
        {
            System.out.println("CHAT_ERROR: " + e);
        }
    }

public void XMPPAddMessageListener(XMPPConnection connection,ZXML zxmlObj)
{
PacketFilter messageFilter = new PacketTypeFilter (Message.class);
XMPPMessageListener listener = zxmlObj.new XMPPMessageListener();

        connection.addPacketListener(listener, messageFilter);                                    
    }
public class XMPPMessageListener implements PacketListener
    {       
        public void processPacket(Packet packet)
        {
            Message message = (Message) packet;  
           
            Message.Type msgType    =    message.getType();               
            String msgFrom            =    message.getFrom();
            String msgTo            =    message.getTo();
            String msgBody            =    message.getBody();
                              
           
               if(msgType == Message.Type.normal)
               {
                   System.out.println("NORMAL_MESSAGE: ");
               }
               else if(msgType == Message.Type.headline)
               {
                   System.out.println("HEADLINE_MESSAGE: ");
               }
               else if(msgType == Message.Type.chat)
               {
                   System.out.println("CHAT_MESSAGE: ");
                   System.out.println("from<"+ msgFrom +">\n"+msgBody+ "\nType <"+message.getType() +" > To <"+msgTo +">");
               }
               else if(msgType == Message.Type.groupchat)
               {
                   System.out.println("GROUP_CHAT_MESSAGE: ");
               }
               else if(msgType == Message.Type.error)
               {
                   System.out.println("ERROR_MESSAGE: ");
                  
                   System.out.println(packet.getError());
                   System.out.println(packet.getXmlns());                      
               }
              
            System.out.println("from<"+ msgFrom +">\n"+msgBody+ "\nType <"+message.getType() +" > To <"+msgTo +">");                                               
        }
    }

Thanks,

Soumyadipta De