use of org.awesomeapp.messenger.service.IImConnection in project Zom-Android by zom.
the class ContactListItem method declineSubscription.
void declineSubscription() {
ImApp app = ((ImApp) ((Activity) getContext()).getApplication());
IImConnection mConn = app.getConnection(mHolder.mProviderId, mHolder.mAccountId);
if (mConn != null) {
try {
IContactListManager manager = mConn.getContactListManager();
manager.declineSubscription(new Contact(new XmppAddress(address), nickname, Imps.Contacts.TYPE_NORMAL));
app.dismissChatNotification(mHolder.mProviderId, address);
manager.removeContact(address);
} catch (RemoteException e) {
// mHandler.showServiceErrorAlert(e.getLocalizedMessage());
LogCleaner.error(ImApp.LOG_TAG, "decline sub error", e);
}
}
}
use of org.awesomeapp.messenger.service.IImConnection in project Zom-Android by zom.
the class ContactListItem method approveSubscription.
/*
private String queryGroupMembers(ContentResolver resolver, long groupId) {
String[] projection = { Imps.GroupMembers.NICKNAME };
Uri uri = ContentUris.withAppendedId(Imps.GroupMembers.CONTENT_URI, groupId);
Cursor c = resolver.query(uri, projection, null, null, null);
StringBuilder buf = new StringBuilder();
if (c != null) {
while (c.moveToNext()) {
buf.append(c.getString(0));
Imps.Avatars.DATA
if (!c.isLast()) {
buf.append(',');
}
}
}
c.close();
return buf.toString();
}*/
void approveSubscription() {
ImApp app = ((ImApp) ((Activity) getContext()).getApplication());
IImConnection mConn = app.getConnection(mHolder.mProviderId, mHolder.mAccountId);
if (mConn != null) {
try {
IContactListManager manager = mConn.getContactListManager();
manager.approveSubscription(new Contact(new XmppAddress(address), nickname, Imps.Contacts.TYPE_NORMAL));
} catch (RemoteException e) {
// mHandler.showServiceErrorAlert(e.getLocalizedMessage());
LogCleaner.error(ImApp.LOG_TAG, "approve sub error", e);
}
}
}
use of org.awesomeapp.messenger.service.IImConnection in project Zom-Android by zom.
the class ContactsListFragment method unarchiveContact.
private static void unarchiveContact(Activity activity, String address, int contactType, long providerId, long accountId) {
try {
IImConnection mConn;
ImApp app = ((ImApp) activity.getApplication());
mConn = app.getConnection(providerId, accountId);
// then delete the contact from our list
IContactListManager manager = mConn.getContactListManager();
int res = manager.archiveContact(address, contactType, false);
if (res != ImErrorInfo.NO_ERROR) {
// mHandler.showAlert(R.string.error,
// ErrorResUtils.getErrorRes(getResources(), res, address));
}
} catch (RemoteException re) {
}
}
use of org.awesomeapp.messenger.service.IImConnection in project Zom-Android by zom.
the class ContactsListFragment method deleteContact.
private static void deleteContact(Activity activity, long itemId, String address, long providerId, long accountId) {
try {
IImConnection mConn;
ImApp app = ((ImApp) activity.getApplication());
mConn = app.getConnection(providerId, accountId);
// first leave, delete an existing chat session
IChatSessionManager sessionMgr = mConn.getChatSessionManager();
if (sessionMgr != null) {
IChatSession session = sessionMgr.getChatSession(Address.stripResource(address));
}
// then delete the contact from our list
IContactListManager manager = mConn.getContactListManager();
int res = manager.removeContact(address);
if (res != ImErrorInfo.NO_ERROR) {
// mHandler.showAlert(R.string.error,
// ErrorResUtils.getErrorRes(getResources(), res, address));
}
} catch (RemoteException re) {
}
}
use of org.awesomeapp.messenger.service.IImConnection in project Zom-Android by zom.
the class ConversationListItem method getEncryptionState.
private void getEncryptionState(long providerId, long accountId, String address, ConversationViewHolder holder) {
try {
ImApp app = ((ImApp) ((Activity) getContext()).getApplication());
IImConnection conn = app.getConnection(providerId, accountId);
if (conn == null || conn.getChatSessionManager() == null)
return;
IChatSession chatSession = conn.getChatSessionManager().getChatSession(address);
if (chatSession != null) {
if (chatSession.isEncrypted()) {
holder.mStatusIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_encrypted_grey));
holder.mStatusIcon.setVisibility(View.VISIBLE);
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// mCurrentChatSession.getOtrChatSession();
}
Aggregations