Ejemplo n.º 1
0
 public void onSubScriptionRequest(final Contact from) {
   String username = from.getAddress().getFullName();
   String nickname = from.getName();
   queryOrInsertContact(from); // FIXME Miron
   Uri uri =
       insertOrUpdateSubscription(
           username,
           nickname,
           Imps.Contacts.SUBSCRIPTION_TYPE_FROM,
           Imps.Contacts.SUBSCRIPTION_STATUS_SUBSCRIBE_PENDING);
   mContext
       .getStatusBarNotifier()
       .notifySubscriptionRequest(
           mProviderId, mAccountId, ContentUris.parseId(uri), username, nickname);
   final int N = mRemoteSubscriptionListeners.beginBroadcast();
   for (int i = 0; i < N; i++) {
     ISubscriptionListener listener = mRemoteSubscriptionListeners.getBroadcastItem(i);
     try {
       listener.onSubScriptionRequest(from);
     } catch (RemoteException e) {
       // The RemoteCallbackList will take care of removing the
       // dead listeners.
     }
   }
   mRemoteSubscriptionListeners.finishBroadcast();
 }
Ejemplo n.º 2
0
    public void onSubscriptionDeclined(final String contact) {
      insertOrUpdateSubscription(
          contact,
          null,
          Imps.Contacts.SUBSCRIPTION_TYPE_NONE,
          Imps.Contacts.SUBSCRIPTION_STATUS_NONE);

      final int N = mRemoteSubscriptionListeners.beginBroadcast();
      for (int i = 0; i < N; i++) {
        ISubscriptionListener listener = mRemoteSubscriptionListeners.getBroadcastItem(i);
        try {
          listener.onSubscriptionDeclined(contact);
        } catch (RemoteException e) {
          // The RemoteCallbackList will take care of removing the
          // dead listeners.
        }
      }
      mRemoteSubscriptionListeners.finishBroadcast();
    }