java
new ContactList()
java
-3374609151465534159L
java
for (java.util.Enumeration ns = getNetworks(); ns.hasMoreElements();) {
Object n = ns.nextElement();
if (n instanceof ExceptionReporter) {
((ExceptionReporter) n).report(e);
return;
}
}
System.err.println(e.getMessage());
e.printStackTrace();
java
try {
// ViewFactory
setViewFactory(ViewFactory.getDefault());
// Network
Network.discoverNetworks();
// Create and register edit/view
new ContactListEdit(contactList);
} catch (Exception e) {
e.printStackTrace();
}
java
for (java.util.Enumeration ns = getNetworks(); ns.hasMoreElements();) {
Network n = (Network) ns.nextElement();
Identity id = getContactList().getIdentity(n);
if (id != null) {
n.login(id.getUserId(), id.getPassword());
}
}
java
for (java.util.Enumeration ns = getNetworks(); ns.hasMoreElements();) {
Network n = (Network) ns.nextElement();
if (getContactList().getIdentity(n) != null) {
n.logout();
}
}
java
for (java.util.Enumeration cs = getContactList().getContacts(); cs
.hasMoreElements();) {
Contact listed = (Contact) cs.nextElement();
if (listed.getUserId().equals(c.getUserId())) {
if (c.getStatus() != null) {
listed.setStatus(c.getStatus());
}
if (c.getName() != null) {
listed.setName(c.getName());
}
return;
}
}
getContactList().addContact(c);
java
for (java.util.Enumeration cs = getConversations(); cs
.hasMoreElements();) {
Conversation c = (Conversation) cs.nextElement();
String contact = c.getContact().getUserId();
if (contact.equals(r.getSender())) {
c.setMessage(r);
return;
}
}
Conversation conv = new Conversation();
new ConversationEdit(conv);
addConversation(conv);
for (java.util.Enumeration cs = getContactList().getContacts(); cs
.hasMoreElements();) {
Contact c = (Contact) cs.nextElement();
if (c.getUserId().equals(r.getSender())) {
conv.setContact(c);
break;
}
}
if (conv.getContact() == null) {
conv.setContact(new Contact());
conv.getContact().setUserId(r.getSender());
}
conv.setMessage(r);
java
final StringBuffer fmt = new StringBuffer();
final String name = getName();
final String status = getStatus();
fmt.append(" ");
fmt.append((name == null) ? getUserId() : name);
if (getNetwork() != null) {
fmt.append(" - ");
fmt.append(getNetwork().getName());
}
fmt.append(" (");
fmt.append((status == null) ? "offline" : status);
fmt.append(")");
return fmt.toString();
java
for (java.util.Enumeration cs = getContacts(); cs.hasMoreElements();) {
Contact contact = (Contact) cs.nextElement();
if ((contact instanceof Identity)
&& (contact.getNetwork() == forNw)) {
return (Identity) contact;
}
}
return null;
java
for (java.util.Enumeration cs = getContacts(); cs.hasMoreElements();) {
Contact contact = (Contact) cs.nextElement();
if (contact.getUserId().equals(userId)) {
if (contact.getName() == null) {
return contact.getUserId();
} else {
return contact.getName();
}
}
}
return userId;
java
return "* " + super.toString().substring(2);
java
if (getNetwork() != null) {
getNetwork().send(this);
}
java
String[] options = {"im.networking.jabber.mejabber.MEJabber",
"im.networking.jabber.defaultjabber.DefaultJabber",
"im.networking.sms.SMS", "im.networking.local.Local"};
im.InstantMessagingClient client = im.InstantMessagingClient
.getInstance();
for (int i = 0; i < options.length; i++) {
try {
client.addNetwork((Network) Class.forName(options[i])
.newInstance());
} catch (Exception e) {
}
}
java
throw new RuntimeException("login not supported");
java
setModel(c);
InstantMessagingClient client = InstantMessagingClient.getInstance();
setView(client.getViewFactory().createContactListView());
getView().addListener(this);
onContactListAdd();
java
int index = getModel().getIndexOfContact(c);
if (index > -1) {
ContactEdit edit = new ContactEdit(c);
insertContactEdit(edit, index);
getView().addContact(c, index);
} else {
ContactEdit edit = getContactEditFor(c);
index = getIndexOfContactEdit(edit);
getView().removeContact(index);
removeContactEdit(edit);
}
java
getView().setEnabled(false);
im.InstantMessagingClient client = im.InstantMessagingClient
.getInstance();
im.view.NewContactDialog dlg = client.getViewFactory()
.createNewContactDialog();
for (java.util.Enumeration ns = client.getNetworks(); ns
.hasMoreElements();) {
dlg
.addNetwork(((im.networking.Network) ns.nextElement())
.getName());
}
dlg.addListener(this);
java
int index = getView().getSelectedContact();
if (index > -1) {
im.model.Contact c = getModel().getContactAt(index);
if (c instanceof im.model.Identity) {
im.model.Identity id = (im.model.Identity) c;
id.getNetwork().logout();
} else {
c.getNetwork().removeContact(c);
}
getModel().removeContact(c);
}
java
int index = getView().getSelectedContact();
if (index > -1) {
im.model.Contact c = getModel().getContactAt(index);
im.InstantMessagingClient client = im.InstantMessagingClient
.getInstance();
// reuse existing conversation, if any
for (java.util.Enumeration cs = client.getConversations(); cs
.hasMoreElements();) {
im.model.Conversation conv = (im.model.Conversation) cs
.nextElement();
im.model.Contact contact = conv.getContact();
if (contact.equals(c)) {
conv.setContact(new im.model.Contact());
conv.setContact(c);
return;
}
}
// else new conversation
im.model.Conversation conv = new im.model.Conversation();
new ConversationEdit(conv);
client.addConversation(conv);
conv.setContact(c);
}
java
if (okClicked) {
im.model.Contact c;
im.networking.Network n = im.InstantMessagingClient.getInstance()
.getNetworkAt(dlg.getNetwork());
if (getModel().getIdentity(n) == null) {
im.model.Identity id = new im.model.Identity();
id.setNetwork(n);
id.setUserId(dlg.getUid());
id.setName(dlg.getName());
id.setPassword(dlg.getPassword());
c = id;
getModel().addContact(c);
id.getNetwork().login(id.getUserId(), id.getPassword());
} else {
c = new im.model.Contact();
c.setNetwork(n);
c.setUserId(dlg.getUid());
c.setName(dlg.getName());
getModel().addContact(c);
c.getNetwork().addContact(c);
}
}
getView().setEnabled(true);
java
for (java.util.Enumeration ces = getContactEdits(); ces
.hasMoreElements();) {
ContactEdit ce = (ContactEdit) ces.nextElement();
if (ce.getModel().equals(c)) {
return ce;
}
}
return null;
java
setModel(c);
java
onChange();
java
onChange();
java
int index = getListEdit().getIndexOfContactEdit(this);
if (index > -1) {
getListEdit().getView().removeContact(index);
getListEdit().getView().addContact(getModel(), index);
}
java
setModel(c);
im.InstantMessagingClient client = im.InstantMessagingClient
.getInstance();
setView(client.getViewFactory().createConversationView());
getView().addListener(this);
java
if (m.getContent() instanceof String) {
im.model.ContactList list = im.InstantMessagingClient.getInstance()
.getContactList();
getView().addContent(
list.getUserName(m.getSender()) + ": " + m.getContent());
} else {
getView().addContent(m.getContent());
}
getView().toFront();
java
if (c.getName() != null) {
getView().setTitle(c.getName());
} else if (c.getUserId() != null) {
getView().setTitle(c.getUserId());
}
getView().toFront();
java
im.InstantMessagingClient.getInstance().removeConversation(getModel());
java
try {
im.model.Contact recipient = getModel().getContact();
if (recipient == null) {
throw new NullPointerException(
"No recipient available in ConversationEdit.onConversationSend()");
}
im.model.Contact sender = getSender(recipient);
if (sender == null) {
throw new NullPointerException(
"No sender available in ConversationEdit.onConversationSend()");
}
im.model.Message msg = new im.model.Message();
msg.setNetwork(recipient.getNetwork());
msg.setSender(sender.getUserId());
msg.setRecipient(recipient.getUserId());
msg.setContent(getView().getContent());
msg.send();
getModel().setMessage(msg);
} catch (Exception e) {
im.InstantMessagingClient.getInstance().report(e);
}
java
im.InstantMessagingClient c = im.InstantMessagingClient.getInstance();
return c.getContactList().getIdentity(recipient.getNetwork());
java
String[] options = {"im.view.swing.SwingViewFactory",
"im.view.awt.AWTViewFactory", "im.view.lcdui.LCDUIViewFactory"};
ViewFactory factory = null;
for (int i = 0; i < options.length && factory == null; i++) {
try {
factory = (ViewFactory) Class.forName(options[i]).newInstance();
} catch (Exception e) {
}
}
return factory;