Re: How to Write a simple XMPP (Jabber) client using the Smack API
Quote:
Originally Posted by
richie1985
Hello,
how can i use single sign on to authenticate the client?
thanks!
Hello.
I am unsure what you mean? Can you please start a new thread regarding this issue.
Thanks.
Re: How to Write a simple XMPP (Jabber) client using the Smack API
Quote:
Originally Posted by
JavaPF
Hello.
I am unsure what you mean? Can you please start a new thread regarding this issue.
Thanks.
Yes i do it:
http://www.javaprogrammingforums.com...-sign-sso.html
Re: How to Write a simple XMPP (Jabber) client using the Smack API
hello everbody
i installed openfire server on my machine , and i programmed a software with java , an instant messanger interfaces ,( client interfaces and administrator interfaces ) i added this code of smack , but the problem is , i dont know how i am gonna use xmpp protocol to add it to my application so i can communicated the client with the administrator !! can anyone please tell me what i gotta do else to make my project work as an instant messanger !! and thank you again !!
Re: How to Write a simple XMPP (Jabber) client using the Smack API
Quote:
Originally Posted by
MTW
hello everbody
i installed openfire server on my machine , and i programmed a software with java , an instant messanger interfaces ,( client interfaces and administrator interfaces ) i added this code of smack , but the problem is , i dont know how i am gonna use xmpp protocol to add it to my application so i can communicated the client with the administrator !! can anyone please tell me what i gotta do else to make my project work as an instant messanger !! and thank you again !!
Please start a new thread regarding this issue. The best forum to post in is here - Java Networking
Have you tried getting the example code to work by itself?
Re: How to Write a simple XMPP (Jabber) client using the Smack API
hello to everybody :rolleyes:
why when i run your program the connection is refused :mad:
i did only copy and past!!!!!!
why????
Re: How to Write a simple XMPP (Jabber) client using the Smack API
Do you have a server? You can't just run the code I posted without configuring it.
Re: How to Write a simple XMPP (Jabber) client using the Smack API
hello :)
i have a problem to presence notification. this is the code:
Code Java:
public void displayBuddyList()
{
Roster roster = connection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
System.out.println("\n\n" + entries.size() + " buddy(ies):");
Presence presence;
for(RosterEntry r:entries)
{
System.out.println(r.getUser());
presence = roster.getPresence(r.getUser());
System.out.println(presence);
}
}
but my contacts are always unavailable :( Could you help me? pleaseeeeeeeeeee
Re: How to Write a simple XMPP (Jabber) client using the Smack API
Re: How to Write a simple XMPP (Jabber) client using the Smack API
hello,
i used this code for jabber client
import java.util.*;
import java.io.*;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message;
public class chat implements MessageListener{
XMPPConnection connection;
public void login(String userName, String password) throws XMPPException
{
//////////ConnectionConfiguration config = new ConnectionConfiguration("im.server.here",5222, "Work");
connection = new XMPPConnection("jabber.org");
connection.connect();
connection.login(userName, password);
}
public void sendMessage(String message, String to) throws XMPPException
{
Chat chat = connection.getChatManager().createChat(to, this);
chat.sendMessage(message);
}
public void displayBuddyList()
{
Roster roster = connection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
System.out.println("\n\n" + entries.size() + " buddy(ies):");
for(RosterEntry r:entries)
{
System.out.println(r.getUser());
}
}
public void disconnect()
{
connection.disconnect();
}
public void processMessage(Chat chat, Message message)
{
if(message.getType() == Message.Type.chat)
System.out.println(chat.getParticipant() + " says: " + message.getBody());
}
public static void main(String args[]) throws XMPPException, IOException
{
// declare variables
chat c = new chat();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String msg;
// turn on the enhanced debugger
XMPPConnection.DEBUG_ENABLED = true;
// Enter your login information here
c.login("hassan786@jabber.org", "bcsf08m018");
c.displayBuddyList();
System.out.println("-----");
System.out.println("Who do you want to talk to? - Type contacts full email address:");
String talkTo = br.readLine();
System.out.println("-----");
System.out.println("All messages will be sent to " + talkTo);
System.out.println("Enter your message in the console:");
System.out.println("-----\n");
while( !(msg=br.readLine()).equals("bye"))
{
c.sendMessage(msg, talkTo);
}
c.disconnect();
System.exit(0);
}
}
Problem is that
i have made account on jabber.org now if i run the this java programme so if i put my own username and password as well as on console when programme asked that to which user you wanted to connect if i put my own username again than this programme send message and also show on console the recieve message .But if on console i put some other jabber username to which i send message and this user is also online (means run this application on another laptop) but he never recieve the message on his console.
Also explain what parameters i put for jabber account there(new ConnectionConfiguration("im.server.here",5222, "Work");)
Re: How to Write a simple XMPP (Jabber) client using the Smack API
reply to " swaqpoli " post
presence = roster.getPresence(r.getUser());
after above line try with presense.getStatus();
the same problem i have faced when i am running it on local
but when i run it on our site it runs perfectly. once u try with uploding application into your real website