Esempio n. 1
0
 private void handleInvitation(long id, boolean accept) {
   if (mGroupManager == null) {
     return;
   }
   ContentResolver cr = mService.getContentResolver();
   Cursor c =
       cr.query(
           ContentUris.withAppendedId(Imps.Invitation.CONTENT_URI, id), null, null, null, null);
   if (c == null) {
     return;
   }
   if (c.moveToFirst()) {
     String inviteId = c.getString(c.getColumnIndexOrThrow(Imps.Invitation.INVITE_ID));
     int status;
     if (accept) {
       mGroupManager.acceptInvitationAsync(inviteId);
       status = Imps.Invitation.STATUS_ACCEPTED;
     } else {
       mGroupManager.rejectInvitationAsync(inviteId);
       status = Imps.Invitation.STATUS_REJECTED;
     }
     // TODO c.updateInt(c.getColumnIndexOrThrow(Imps.Invitation.STATUS), status);
     // c.commitUpdates();
   }
   c.close();
 }
Esempio n. 2
0
 public ImConnectionAdapter(long providerId, ImConnection connection, RemoteImService service) {
   mProviderId = providerId;
   mConnection = connection;
   mService = service;
   mConnectionListener = new ConnectionListenerAdapter();
   mConnection.addConnectionListener(mConnectionListener);
   if ((connection.getCapability() & ImConnection.CAPABILITY_GROUP_CHAT) != 0) {
     mGroupManager = mConnection.getChatGroupManager();
     mInvitationListener = new InvitationListenerAdapter();
     mGroupManager.setInvitationListener(mInvitationListener);
   }
 }