use of org.awesomeapp.messenger.model.Contact in project Zom-Android by zom.
the class ChatSessionAdapter method inviteContact.
public void inviteContact(String contact) {
if (!mIsGroupChat) {
return;
}
ContactListManagerAdapter listManager = (ContactListManagerAdapter) mConnection.getContactListManager();
Contact invitee = new Contact(new XmppAddress(contact), contact, Imps.Contacts.TYPE_NORMAL);
getGroupManager().inviteUserAsync((ChatGroup) mChatSession.getParticipant(), invitee);
}
use of org.awesomeapp.messenger.model.Contact in project Zom-Android by zom.
the class ChatSessionManagerAdapter method createChatSession.
public IChatSession createChatSession(String contactAddress, boolean isNewSession) {
ContactListManagerAdapter listManager = (ContactListManagerAdapter) mConnection.getContactListManager();
Contact contact = listManager.getContactByAddress(Address.stripResource(contactAddress));
if (contact == null) {
try {
contact = new Contact(new XmppAddress(contactAddress), contactAddress, Imps.Contacts.TYPE_NORMAL);
// long contactId = listManager.queryOrInsertContact(contact);
// String[] address = {Address.stripResource(contactAddress)};
// contact = listManager.createTemporaryContacts(address)[0];
} catch (IllegalArgumentException e) {
mSessionListenerAdapter.notifyChatSessionCreateFailed(contactAddress, new ImErrorInfo(ImErrorInfo.ILLEGAL_CONTACT_ADDRESS, "Invalid contact address:" + contactAddress));
return null;
}
}
if (contact != null) {
ChatSession session = getChatSessionManager().createChatSession(contact, isNewSession);
return getChatSessionAdapter(session, isNewSession);
} else
return null;
}
use of org.awesomeapp.messenger.model.Contact in project Zom-Android by zom.
the class LoopbackConnection method loginAsync.
@Override
public void loginAsync(long accountId, String passwordTemp, long providerId, boolean retry) {
ContentResolver contentResolver = mContext.getContentResolver();
String userName = Imps.Account.getUserName(contentResolver, accountId);
mUserPresence = new Presence(Presence.AVAILABLE, "available", null, null, Presence.CLIENT_TYPE_DEFAULT);
mUser = new Contact(new LoopbackAddress(userName + "!", "loopback", null), userName, Imps.Contacts.TYPE_NORMAL);
setState(LOGGED_IN, null);
}
Aggregations