123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721 |
- /*!
- * \~chinese
- * @header IEMContactManager.h
- * @abstract 此协议定义了好友相关操作
- * @author Hyphenate
- * @version 3.00
- *
- * \~english
- * @header IEMContactManager.h
- * @abstract The protocol defines the operations of contact
- * @author Hyphenate
- * @version 3.00
- */
- #import <Foundation/Foundation.h>
- #import "EMCommonDefs.h"
- #import "EMContactManagerDelegate.h"
- @class EMError;
- /*!
- * \~chinese
- * 好友相关操作
- *
- * \~english
- * Contact Management
- */
- @protocol IEMContactManager <NSObject>
- @required
- #pragma mark - Delegate
- /*!
- * \~chinese
- * 添加回调代理
- *
- * @param aDelegate 要添加的代理
- * @param aQueue 执行代理方法的队列
- *
- * \~english
- * Add delegate
- *
- * @param aDelegate Delegate
- * @param aQueue (optional) The queue of calling delegate methods. Pass in nil to run on main thread.
- */
- - (void)addDelegate:(id<EMContactManagerDelegate>)aDelegate
- delegateQueue:(dispatch_queue_t)aQueue;
- /*!
- * \~chinese
- * 移除回调代理
- *
- * @param aDelegate 要移除的代理
- *
- * \~english
- * Remove delegate
- *
- * @param aDelegate Delegate
- */
- - (void)removeDelegate:(id)aDelegate;
- #pragma mark - Contact Operations
- /*!
- * \~chinese
- * 获取本地存储的所有好友
- *
- * @result 好友列表<NSString>
- *
- * \~english
- * Get all contacts from local database
- *
- * @result Contact list<String>
- */
- - (NSArray *)getContacts;
- /*!
- * \~chinese
- * 从服务器获取所有的好友
- *
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Get all contacts from the server
- *
- * @param aCompletionBlock The callback block of completion
- *
- */
- - (void)getContactsFromServerWithCompletion:(void (^)(NSArray *aList, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 从服务器获取所有的好友
- *
- * 同步方法,会阻塞当前线程
- *
- * @param pError 错误信息
- *
- * @return 好友列表<NSString>
- *
- * \~english
- * Get all the contacts from the server
- *
- * Synchronization method will block the current thread
- *
- * @param pError Error
- *
- * @return Contact list<NSString>
- */
- - (NSArray *)getContactsFromServerWithError:(EMError **)pError;
- /*!
- * \~chinese
- * 添加好友
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 要添加的用户
- * @param aMessage 邀请信息
- *
- * @return 错误信息
- *
- * \~english
- * Add a contact with invitation message
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername The user to add
- * @param aMessage (optional) Invitation message. Pass in nil to ignore.
- *
- * @return Error
- */
- - (EMError *)addContact:(NSString *)aUsername
- message:(NSString *)aMessage;
- /*!
- * \~chinese
- * 添加好友
- *
- * @param aUsername 要添加的用户
- * @param aMessage 邀请信息
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Add a contact
- *
- * @param aUsername The user to be added
- * @param aMessage Friend request message
- * @param aCompletionBlock The callback block of completion
- *
- */
- - (void)addContact:(NSString *)aUsername
- message:(NSString *)aMessage
- completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 删除好友
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 要删除的好友
- * @param aIsDeleteConversation 是否删除会话
- *
- * @return 错误信息
- *
- * \~english
- * Delete a contact
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername The user to delete
- * @param aIsDeleteConversation If to keep the assoicated conversation and messages
- *
- * @return Error
- */
- - (EMError *)deleteContact:(NSString *)aUsername
- isDeleteConversation:(BOOL)aIsDeleteConversation;
- /*!
- * \~chinese
- * 删除好友
- *
- * @param aUsername 要删除的好友
- * @param aIsDeleteConversation 是否删除会话
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Delete a contact
- *
- * @param aUsername The user to be deleted
- * @param aIsDeleteConversation Delete the conversation or not
- * @param aCompletionBlock The callback block of completion
- *
- */
- - (void)deleteContact:(NSString *)aUsername
- isDeleteConversation:(BOOL)aIsDeleteConversation
- completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 同意加好友的申请
- *
- * @param aUsername 申请者
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Apporove a friend request
- *
- * @param aUsername User who initiated the friend request
- * @param aCompletionBlock The callback block of completion
- *
- */
- - (void)approveFriendRequestFromUser:(NSString *)aUsername
- completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 拒绝加好友的申请
- *
- * @param aUsername 申请者
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Decline a friend request
- *
- * @param aUsername User who initiated the friend request
- * @param aCompletionBlock The callback block of completion
- *
- */
- - (void)declineFriendRequestFromUser:(NSString *)aUsername
- completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock;
- #pragma mark - Blacklist Operations
- /*!
- * \~chinese
- * 从本地获取黑名单列表
- *
- * @result 黑名单列表<NSString>
- *
- * \~english
- * Get the blacklist of blocked users from local database
- *
- * @result Blacklist<NSString> blacklist usernames
- */
- - (NSArray *)getBlackList;
- /*!
- * \~chinese
- * 从服务器获取黑名单列表
- *
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Get the blacklist from the server
- *
- * @param aCompletionBlock The callback block of completion
- *
- * @result aList<NSString> blacklist usernames
- */
- - (void)getBlackListFromServerWithCompletion:(void (^)(NSArray *aList, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 从服务器获取黑名单列表
- *
- * 同步方法,会阻塞当前线程
- *
- * @param pError 错误信息
- *
- * @return 黑名单列表<NSString>
- *
- * \~english
- * Get the blacklist from the server
- *
- * Synchronization method will block the current thread
- *
- * @param pError Error
- *
- * @return Blacklist<NSString>
- */
- - (NSArray *)getBlackListFromServerWithError:(EMError **)pError;
- /*!
- * \~chinese
- * 将用户加入黑名单
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 要加入黑命单的用户
- *
- * @return 错误信息
- *
- * \~english
- * Add a user to blacklist
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername Block user
- *
- * @return Error
- */
- - (EMError *)addUserToBlackList:(NSString *)aUsername;
- /*!
- * \~chinese
- * 将用户加入黑名单
- *
- * @param aUsername 要加入黑命单的用户
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Add a user to blacklist
- *
- * @param aUsername Block user
- * @param aCompletionBlock The callback block of completion
- *
- */
- - (void)addUserToBlackList:(NSString *)aUsername
- completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 将用户移出黑名单
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 要移出黑命单的用户
- *
- * @return 错误信息
- *
- * \~english
- * Remove user out of blacklist
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername Unblock user
- *
- * @return Error
- */
- - (EMError *)removeUserFromBlackList:(NSString *)aUsername;
- /*!
- * \~chinese
- * 将用户移出黑名单
- *
- * @param aUsername 要移出黑命单的用户
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Remove a user from blacklist
- *
- * @param aUsername Unblock user
- * @param aCompletionBlock The callback block of completion
- *
- */
- - (void)removeUserFromBlackList:(NSString *)aUsername
- completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock;
- /*!
- * \~chinese
- * 同意加好友的申请
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 申请者
- *
- * @return 错误信息
- *
- * \~english
- * Accept a friend request
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername User who initiated the friend request
- *
- * @return Error
- */
- - (EMError *)acceptInvitationForUsername:(NSString *)aUsername;
- /*!
- * \~chinese
- * 拒绝加好友的申请
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 申请者
- *
- * @return 错误信息
- *
- * \~english
- * Decline a friend request
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername User who initiated the friend request
- *
- * @return Error
- *
- * Please use the new method
- * - (void)declineFriendRequestFromUser:(NSString *)aUsername
- * completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock;
- */
- - (EMError *)declineInvitationForUsername:(NSString *)aUsername;
- #pragma mark - Other platform
- /*!
- * \~chinese
- * 获取当前账号在其他平台(Windows或者Web)登录的id列表
- * id使用方法类似于好友username
- *
- * @param pError 错误信息
- *
- * @return id列表
- *
- * \~english
- * Get the id list of the current account on another platform (Windows or Web)
- * Id usage is similar to friend username
- *
- * @param pError Error
- *
- * @return id list
- *
- */
- - (NSArray *)getSelfIdsOnOtherPlatformWithError:(EMError **)pError;
- /*!
- * \~chinese
- * 获取当前账号在其他平台(Windows或者Web)登录的id列表
- * id使用方法类似于好友username
- *
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Get the id list of the current account on another platform (Windows or Web)
- * Id usage is similar to friend username
- *
- * @param aCompletionBlock The callback block of completion
- *
- */
- - (void)getSelfIdsOnOtherPlatformWithCompletion:(void (^)(NSArray *aList, EMError *aError))aCompletionBlock;
- #pragma mark - EM_DEPRECATED_IOS
- /*!
- * \~chinese
- * 将用户加入黑名单
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 要加入黑命单的用户
- * @param aBoth 是否同时屏蔽发给对方的消息
- *
- * @return 错误信息
- *
- * \~english
- * Add a user to blacklist
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername Block user
- * @param aBoth if aBoth is YES, then hide user and block messages from blocked user; if NO, then hide user from blocked user
- *
- * @return Error
- */
- - (EMError *)addUserToBlackList:(NSString *)aUsername
- relationshipBoth:(BOOL)aBoth EM_DEPRECATED_IOS(3_2_3, 3_6_2, "Use -[IEMContactManager addUserToBlackList:]");
- #pragma mark - EM_DEPRECATED_IOS 3.2.3
- /*!
- * \~chinese
- * 添加回调代理
- *
- * @param aDelegate 要添加的代理
- *
- * \~english
- * Add delegate
- *
- * @param aDelegate Delegate
- */
- - (void)addDelegate:(id<EMContactManagerDelegate>)aDelegate EM_DEPRECATED_IOS(3_1_0, 3_2_2, "Use -[IEMContactManager addDelegate:delegateQueue:]");
- #pragma mark - EM_DEPRECATED_IOS < 3.2.3
- /*!
- * \~chinese
- * 从数据库获取所有的好友
- *
- * @return 好友列表<NSString>
- *
- * \~english
- * Get all the friends from the DB
- *
- * @return Contact list<NSString>
- */
- - (NSArray *)getContactsFromDB __deprecated_msg("Use -getContacts");
- /*!
- * \~chinese
- * 从数据库获取黑名单列表
- *
- * @return 黑名单列表<NSString>
- *
- * \~english
- * Get the blacklist from the DB
- *
- * @return Blacklist<NSString>
- */
- - (NSArray *)getBlackListFromDB __deprecated_msg("Use -getBlackList");
- /*!
- * \~chinese
- * 从服务器获取所有的好友
- *
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Get all the friends from the server
- *
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncGetContactsFromServer:(void (^)(NSArray *aList))aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -getContactsFromServerWithCompletion:");
- /*!
- * \~chinese
- * 添加好友
- *
- * @param aUsername 要添加的用户
- * @param aMessage 邀请信息
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Add a contact
- *
- * @param aUsername The user to add
- * @param aMessage Friend invitation message
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncAddContact:(NSString *)aUsername
- message:(NSString *)aMessage
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -addContact:message:completion:");
- /*!
- * \~chinese
- * 删除好友
- *
- * 同步方法,会阻塞当前线程
- *
- * @param aUsername 要删除的好友
- *
- * @return 错误信息
- *
- * \~english
- * Delete a contact
- *
- * Synchronization method will block the current thread
- *
- * @param aUsername The user to delete
- *
- * @return Error
- */
- - (EMError *)deleteContact:(NSString *)aUsername __deprecated_msg("Use -deleteContact:username:isDeleteConversation:");
- /*!
- * \~chinese
- * 删除好友
- *
- * @param aUsername 要删除的好友
- * @param aCompletionBlock 完成的回调
- *
- * \~english
- * Delete a contact
- *
- * @param aUsername The user to be deleted
- * @param aCompletionBlock The callback block of completion
- *
- */
- - (void)deleteContact:(NSString *)aUsername
- completion:(void (^)(NSString *aUsername, EMError *aError))aCompletionBlock __deprecated_msg("Use -deleteContact:username:isDeleteConversation:");
- /*!
- * \~chinese
- * 删除好友
- *
- * @param aUsername 要删除的好友
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Delete friend
- *
- * @param aUsername The user to delete
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncDeleteContact:(NSString *)aUsername
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -deleteContact:completion:");
- /*!
- * \~chinese
- * 从服务器获取黑名单列表
- *
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Get the blacklist from the server
- *
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncGetBlackListFromServer:(void (^)(NSArray *aList))aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -getBlackListFromServerWithCompletion:");
- /*!
- * \~chinese
- * 将用户加入黑名单
- *
- * @param aUsername 要加入黑命单的用户
- * @param aBoth 是否同时屏蔽发给对方的消息
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Add user to blacklist
- *
- * @param aUsername The user to add
- * @param aBoth Whether block messages from me to the user which is added to the black list
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncAddUserToBlackList:(NSString *)aUsername
- relationshipBoth:(BOOL)aBoth
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -addUserToBlackList:completion:");
- /*!
- * \~chinese
- * 将用户移出黑名单
- *
- * @param aUsername 要移出黑命单的用户
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Remove user from blacklist
- *
- * @param aUsername The user to remove from blacklist
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncRemoveUserFromBlackList:(NSString *)aUsername
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -removeUserFromBlackList:completion:");
- /*!
- * \~chinese
- * 同意加好友的申请
- *
- * @param aUsername 申请者
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Agree invitation
- *
- * @param aUsername Applicants
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncAcceptInvitationForUsername:(NSString *)aUsername
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -approveFriendRequestFromUser:completion:");
- /*!
- * \~chinese
- * 拒绝加好友的申请
- *
- * @param aUsername 申请者
- * @param aSuccessBlock 成功的回调
- * @param aFailureBlock 失败的回调
- *
- * \~english
- * Decline invitation
- *
- * @param aUsername Applicants
- * @param aSuccessBlock The callback block of success
- * @param aFailureBlock The callback block of failure
- *
- */
- - (void)asyncDeclineInvitationForUsername:(NSString *)aUsername
- success:(void (^)())aSuccessBlock
- failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -declineFriendRequestFromUser:completion:");
- @end
|