Search in sources :

Example 31 with Contact

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);
}
Also used : XmppAddress(org.awesomeapp.messenger.plugin.xmpp.XmppAddress) Contact(org.awesomeapp.messenger.model.Contact)

Example 32 with Contact

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;
}
Also used : XmppAddress(org.awesomeapp.messenger.plugin.xmpp.XmppAddress) IChatSession(org.awesomeapp.messenger.service.IChatSession) ChatSession(org.awesomeapp.messenger.model.ChatSession) Contact(org.awesomeapp.messenger.model.Contact) ImErrorInfo(org.awesomeapp.messenger.model.ImErrorInfo)

Example 33 with Contact

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);
}
Also used : Presence(org.awesomeapp.messenger.model.Presence) ContentResolver(android.content.ContentResolver) Contact(org.awesomeapp.messenger.model.Contact)

Aggregations

Contact (org.awesomeapp.messenger.model.Contact)33 RemoteException (android.os.RemoteException)11 XmppAddress (org.awesomeapp.messenger.plugin.xmpp.XmppAddress)10 Presence (org.awesomeapp.messenger.model.Presence)6 XmppStringprepException (org.jxmpp.stringprep.XmppStringprepException)6 Intent (android.content.Intent)5 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 ImException (org.awesomeapp.messenger.model.ImException)5 IContactListManager (org.awesomeapp.messenger.service.IContactListManager)5 ContentValues (android.content.ContentValues)4 Uri (android.net.Uri)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 KeyManagementException (java.security.KeyManagementException)4 KeyStoreException (java.security.KeyStoreException)4 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)4 CertificateException (java.security.cert.CertificateException)4 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)4 ContactList (org.awesomeapp.messenger.model.ContactList)4 IChatSession (org.awesomeapp.messenger.service.IChatSession)4