2 * Copyright (C) 2007-2008 Esmertec AG.
3 * Copyright (C) 2007-2008 The Android Open Source Project
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 package com.android.im;
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;
25 interface IContactListManager {
26 void registerContactListListener(IContactListListener listener);
27 void unregisterContactListListener(IContactListListener listener);
29 void registerSubscriptionListener(ISubscriptionListener listener);
30 void unregisterSubscriptionListener(ISubscriptionListener listener);
33 * Gets all the contact lists of this account.
35 List getContactLists();
38 * Gets a contact list with specific name, return null if no contact list is found.
40 IContactList getContactList(String name);
43 * Creates a contact list with given name and a list of initial contacts.
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.
48 int createContactList(String name, in List<Contact> contacts);
51 * Deletes a contact list with given name.
53 * @param name the name of the list to delete.
55 int deleteContactList(String name);
58 * Removes a contact from all contact lists. Note the temporary contacts
59 * can only be removed by this method.
61 * @param address the address of the contact to be removed.
63 int removeContact(String address);
66 * Approves a subscription request from another user.
68 void approveSubscription(String address);
71 * Declines a subscription request from another user.
73 void declineSubscription(String address);
76 * Blocks a contact. The ContactListListener will be notified when the contact is blocked
77 * successfully or any error occurs.
79 * @param address the address of the contact to block.
80 * @return ILLEGAL_CONTACT_LIST_MANAGER_STATE if contact lists is not loaded.
82 int blockContact(String address);
85 * Unblocks a contact.The ContactListListener will be notified when the contact is blocked
86 * successfully or any error occurs.
88 * @param address the address of the contact to unblock.
89 * @return ILLEGAL_CONTACT_LIST_MANAGER_STATE if contact lists is not loaded.
91 int unBlockContact(String address);
94 * Tells if a certain contact is blocked.
96 * @param address the address of the contact.
97 * @return true if it's blocked; false otherwise.
99 boolean isBlocked(String address);
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.
106 void loadContactLists();
109 * Gets the state of the manager.
111 * @return the state of the manager.