• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007-2008 Esmertec AG.
3  * Copyright (C) 2007-2008 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 package com.android.im;
19 
20 import com.android.im.IContactList;
21 import com.android.im.IContactListListener;
22 import com.android.im.ISubscriptionListener;
23 import com.android.im.engine.Contact;
24 
25 interface IContactListManager {
registerContactListListener(IContactListListener listener)26     void registerContactListListener(IContactListListener listener);
unregisterContactListListener(IContactListListener listener)27     void unregisterContactListListener(IContactListListener listener);
28 
registerSubscriptionListener(ISubscriptionListener listener)29     void registerSubscriptionListener(ISubscriptionListener listener);
unregisterSubscriptionListener(ISubscriptionListener listener)30     void unregisterSubscriptionListener(ISubscriptionListener listener);
31 
32     /**
33      * Gets all the contact lists of this account.
34      */
getContactLists()35     List getContactLists();
36 
37     /**
38      * Gets a contact list with specific name, return null if no contact list is found.
39      */
getContactList(String name)40     IContactList getContactList(String name);
41 
42     /**
43      * Creates a contact list with given name and a list of initial contacts.
44      *
45      * @param name the name of the list to create.
46      * @param contacts a list of contacts will be added to the new contact list, can be null.
47      */
createContactList(String name, in List<Contact> contacts)48     int createContactList(String name, in List<Contact> contacts);
49 
50     /**
51      * Deletes a contact list with given name.
52      *
53      * @param name the name of the list to delete.
54      */
deleteContactList(String name)55     int deleteContactList(String name);
56 
57     /**
58      * Removes a contact from all contact lists. Note the temporary contacts
59      * can only be removed by this method.
60      *
61      * @param address the address of the contact to be removed.
62      */
removeContact(String address)63     int removeContact(String address);
64 
65     /**
66      * Approves a subscription request from another user.
67      */
approveSubscription(String address)68     void approveSubscription(String address);
69 
70     /**
71      * Declines a subscription request from another user.
72      */
declineSubscription(String address)73     void declineSubscription(String address);
74 
75     /**
76      * Blocks a contact. The ContactListListener will be notified when the contact is blocked
77      * successfully or any error occurs.
78      *
79      * @param address the address of the contact to block.
80      * @return ILLEGAL_CONTACT_LIST_MANAGER_STATE if contact lists is not loaded.
81      */
blockContact(String address)82     int blockContact(String address);
83 
84     /**
85      * Unblocks a contact.The ContactListListener will be notified when the contact is blocked
86      * successfully or any error occurs.
87      *
88      * @param address the address of the contact to unblock.
89      * @return ILLEGAL_CONTACT_LIST_MANAGER_STATE if contact lists is not loaded.
90      */
unBlockContact(String address)91     int unBlockContact(String address);
92 
93     /**
94      * Tells if a certain contact is blocked.
95      *
96      * @param address the address of the contact.
97      * @return true if it's blocked; false otherwise.
98      */
isBlocked(String address)99     boolean isBlocked(String address);
100 
101     /**
102      * Explicitly load contact lists from the server. The user only needs to call this method if
103      * autoLoadContacts is false when login; otherwise, contact lists will be downloaded from the
104      * server automatically after login.
105      */
loadContactLists()106     void loadContactLists();
107 
108     /**
109      * Gets the state of the manager.
110      *
111      * @return the state of the manager.
112      */
getState()113     int getState();
114 }
115