Here is the portion of code that authentificate a users, searches for a matching “skaber” user in the roster and tries to open a jingle session using the ICETransportManager. Shouldn’'t entry.getUser() return the full JID as written in the source comments instead of the “user@server” format ?
public void actionPerformed(ActionEvent e)
{
if (“btnLoginClick” == e.getActionCommand()) {
if (comm == null && !comm.isConnected()) {
comm = new XMPPConnection(“gmail.com”);
try {
comm.connect();
comm.login(txtUser.getText(), String.valueOf(txtPass.getPassword()));
} catch (Exception exp) {
System.out.println(exp.getMessage());
}
}
if (comm.isConnected()) {
Roster roster = comm.getRoster();
Collection entries = roster.getEntries();
Iterator i = entries.iterator();
while (i.hasNext()) {
RosterEntry entry = (RosterEntry)i.next();
System.out.println(entry.getUser());
if (entry.getUser().contains(“skaber”)) {
Message msg = new Message(entry.getUser(), Message.Type.chat);
msg.setBody(“You will receive a call…”);
comm.sendPacket(msg);
ICETransportManager icetm0 = new ICETransportManager(comm, “jivesoftware.com”, 3478);
JingleManager jm = new JingleManager(comm, icetm0, new JmfMediaManager());
try {
OutgoingJingleSession session = jm.createOutgoingJingleSession(entry.getUser());
session.start();
} catch (Exception exp) {
System.out.println(exp.getMessage());
}
}
}
}
}
}