Hi All,

I am very new to Smack API. I have started using it from last one month
only. So If you find this as a silly question, just dont feel bad and
help me out to make my Application work.


Application Description.

I am building an IM client with Openfire as my chat server and I am
communicating with openfire through the Smack API. I am also using the
Spark client parallely foir testing purpose.

I am able to do the following things.

1) Login
2) Populate my friend's list from Roster
3) Detect the presence of my friends.
4) Get the Chat history of my friends(Currently everything is coming as
null.but timestamp is displayed properly)

Problem Description

1) When I am sending the message from a user to another user, It is not
able to send the Message. I suppose the flow is broken in the 
sendMessage method of the Chat Class.
2) When I am sending the message, I am getting back a null from the
Jabber.

I am pasting my send and process method below


public void send(String sender, String message) throws XMPPException {
                
                        Chat chat = fChat.getChat();// This is getting a chat 
object
properly
                        if(chat!=null) {
                                System.out.println("Sending message to " + 
sender + "
Message:"+message);
                                Message msg = new Message();
                                msg.setFrom(this.username);
                                
                                msg.setBody(message);
                                chat.sendMessage(msg);// I think it is broken 
in this line only
                        }
                }
        }



public void process(Chat chat, Message message) {
                
                String from = message.getFrom();
                int slashIndex = from.indexOf("/");
                slashIndex = slashIndex == -1 ? from.length() : slashIndex;
                from = from.substring(0, slashIndex);
                FriendChat fChat = (FriendChat) this.friendChatMap.get(from);
                fChat.setChat(chat);
                String msg = message.getBody();
                fChat.addMessage(msg, false);
                
this.publish(Constants.TOPIC_NAME_PREFIX+"/"+toSimpleUserId(this.getUserName()),
"{from:'"+toSimpleUserId(from)+"',message:'"+msg+"'}");// this publish
is used to publish this message to the client
        }



Could you please point out what can be the problem with this code.

Believe me I have followed all the basic rules of Smack API


Thanks in Advance

Vijesh


-- 
viju1983
------------------------------------------------------------------------
viju1983's Profile: http://www.jabberforum.org/member.php?userid=17427
View this thread: http://www.jabberforum.org/showthread.php?t=1306

_______________________________________________
JDev mailing list
Forum: http://www.jabberforum.org/forumdisplay.php?f=20
Info: http://mail.jabber.org/mailman/listinfo/jdev
Unsubscribe: [email protected]
_______________________________________________

Reply via email to