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
return network.elements();
java
return contactList;
java
return conversation.elements();
java
return viewFactory;
java
this.contactList = contactList;
java
this.viewFactory = viewFactory;
java
if (! this.network.contains(network)) {
this.network.addElement(network);
}
java
if (! this.conversation.contains(conversation)) {
this.conversation.addElement(conversation);
}
java
this.network.removeElement(network);
java
this.conversation.removeElement(conversation);
java
try {
return (im.networking.Network) network.elementAt(index);
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
java
return this.network.indexOf(network);
java
if (! this.network.contains(network)) {
try {
this.network.insertElementAt(network, index);
} catch (ArrayIndexOutOfBoundsException e) {
this.network.addElement(network);
}
}
java
return userId;
java
return name;
java
return status;
java
this.userId = userId;
java
this.name = name;
java
this.status = status;
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 contact.elements();
java
if (! this.contact.contains(contact)) {
this.contact.addElement(contact);
}
java
this.contact.removeElement(contact);
java
try {
return (im.model.Contact) contact.elementAt(index);
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
java
return this.contact.indexOf(contact);
java
if (! this.contact.contains(contact)) {
try {
this.contact.insertElementAt(contact, index);
} catch (ArrayIndexOutOfBoundsException e) {
this.contact.addElement(contact);
}
}
java
return message;
java
return contact;
java
this.message = message;
java
this.contact = contact;
java
return "* " + super.toString().substring(2);
java
return password;
java
this.password = password;
java
if (getNetwork() != null) {
getNetwork().send(this);
}
java
return sender;
java
return recipient;
java
return content;
java
this.sender = sender;
java
this.recipient = recipient;
java
this.content = content;
java
return network;
java
this.network = network;
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
return name;
java
return recvContact;
java
return recvMsg;
java
this.name = name;
java
this.recvContact = recvContact;
java
this.recvMsg = recvMsg;
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
return model;
java
return view;
java
return contactEdit.elements();
java
this.model = model;
java
this.view = view;
java
if (! this.contactEdit.contains(contactEdit)) {
this.contactEdit.addElement(contactEdit);
contactEdit.setListEdit(this);
}
java
if (this.contactEdit.contains(contactEdit)) {
this.contactEdit.removeElement(contactEdit);
contactEdit.setListEdit(null);
}
java
try {
return (im.edit.ContactEdit) contactEdit.elementAt(index);
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
java
return this.contactEdit.indexOf(contactEdit);
java
if (! this.contactEdit.contains(contactEdit)) {
try {
this.contactEdit.insertElementAt(contactEdit, index);
} catch (ArrayIndexOutOfBoundsException e) {
this.contactEdit.addElement(contactEdit);
}
contactEdit.setListEdit(this);
}
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
return model;
java
return listEdit;
java
this.model = model;
java
if (this.listEdit != listEdit) {
if (this.listEdit != null) this.listEdit.removeContactEdit(this);
this.listEdit = listEdit;
if (listEdit != null) listEdit.addContactEdit(this);
}
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
return model;
java
return view;
java
this.model = model;
java
this.view = view;
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;