How to make smack client to chat with facebook contacts?

i am creating a facebook chat client.i have made a gui & it can integrate with facebook server showing the buddies online.now i want to chat with someone online. i used following code for that…but it doesnt work!Can anyone help?an example would be the best thing.

regurds-

dibosh

code:

private class messageProcessor implements MessageListener
{

        public void sendMessage(String message, String to) throws XMPPException
        {
        
            Chat chat = connection.getChatManager().createChat(to, this);
            chat.sendMessage(message);
           
        }
        public void processMessage(Chat chat, Message message)
        {
            if(message.getType() == Message.Type.chat)
            System.out.println(chat.getParticipant() + " says: " + message.getBody());
        }
}

I have modified topic and added some tags. Next time make more informative thread title.

Thank you.Will you please suggest a solution regarding my problem?another question how to get the name of the buddies rather than their numerical id(e.g.-1127183782371234@chat.facebook.com;facebook returned me such id-s in roster)?

I’m not a coder and don’t know Smack, so i can’t help. Though i think this is not exactly the right place to ask questions about facebook internal stuff.

hi…

can you tell me what did you do to solve the numerical id issue??

Thanks:)

well i have done my project completed a long time ago.Smack is a cool api & i got it by myself trying a bit playing with it.Read the documentations first.One way to ignore the numerical id is, u collect the roster collection at the beggining & when u try to chat with somebody u can match the id with stored roster & show the corresponding name.another way is more effective.But i cant xplain it here.Its a bit of code & I can mail you if you send me a feedback.Till then keep trying!believe me the API is so cool & its superb to play with

One more point I made my facebook chatter & so u can get any help from me.I would love to answer.In some other section of the forum I answered a bit of it,u can also check it there(a code sample is also posted).

In case of any trouble just mail me.Oh,dont forget to like if u found it helpful

2 Likes

Hi…

Even i thought of storing the numerical id s and then retreving the corresponding names of the users.But the requirement says that I cant use a database!!!:frowning:

So I would like to know if there are any other means…

I followed your other posts…Helped a lot in finishing my project…

i will mail you with more details…

Thanks:)

Welcome.

Thanks for the feedback.

Well you dont need to use a database.Each time you login u should

retrieve the roster & save it in an array of strings(the whole

string). Then you will try to match which name has the corresponding

id.(Details is out of my scope here )

By the way looking forward to listening from you in details.

May be then I will be able to send you some snippet.

regards…