/// <summary> /// 删除好友 /// </summary> /// <param name="accid">对方账号</param> /// <param name="deleteAlias">是否删除好友备注</param> /// <param name="cb">操作结果回调</param> public static void DeleteFriend(string accid, bool deleteAlias, FriendOperationDelegate cb) { IntPtr ptr = DelegateConverter.ConvertToIntPtr(cb); string jsonExt = Newtonsoft.Json.JsonConvert.SerializeObject(new { delete_alias = deleteAlias }); FriendNativeMethods.nim_friend_delete(accid, jsonExt, DeleteFriendDelegate, ptr); }
/// <summary> /// 更新好友资料 /// </summary> /// <param name="profile"></param> /// <param name="cb"></param> public static void UpdateFriendInfo(NIMFriendProfile profile, FriendOperationDelegate cb) { if (profile == null || string.IsNullOrEmpty(profile.AccountId)) { throw new ArgumentException("profile or accountid can't be null"); } string jsonParam = profile.Serialize(); FriendNativeMethods.nim_friend_update(jsonParam, null, cb, IntPtr.Zero); }
/// <summary> /// 更新好友资料 /// </summary> /// <param name="profile"></param> /// <param name="cb"></param> public static void UpdateFriendInfo(NIMFriendProfile profile, FriendOperationDelegate cb) { if (profile == null || string.IsNullOrEmpty(profile.AccountId)) { throw new ArgumentException("profile or accountid can't be null"); } var jsonParam = profile.Serialize(); IntPtr ptr = DelegateConverter.ConvertToIntPtr(cb); FriendNativeMethods.nim_friend_update(jsonParam, null, UpdateFriendDelegate, ptr); }
/// <summary> /// 删除好友 /// </summary> /// <param name="accid">对方账号</param> /// <param name="cb">操作结果回调</param> public static void DeleteFriend(string accid, FriendOperationDelegate cb) { FriendNativeMethods.nim_friend_delete(accid, null, cb, IntPtr.Zero); }
/// <summary> /// 添加、验证好友 /// </summary> /// <param name="accid">对方账号</param> /// <param name="verifyType">验证类型</param> /// <param name="msg"></param> /// <param name="cb">操作结果回调</param> public static void ProcessFriendRequest(string accid, NIMVerifyType verifyType, string msg, FriendOperationDelegate cb) { FriendNativeMethods.nim_friend_request(accid, verifyType, msg, null, cb, IntPtr.Zero); }
/// <summary> /// 添加、验证好友 /// </summary> /// <param name="accid">对方账号</param> /// <param name="verifyType">验证类型</param> /// <param name="msg"></param> /// <param name="cb">操作结果回调</param> public static void ProcessFriendRequest(string accid, NIMVerifyType verifyType, string msg, FriendOperationDelegate cb) { var ptr = DelegateConverter.ConvertToIntPtr(cb); FriendNativeMethods.nim_friend_request(accid, verifyType, msg, null, ProcessFriendRequestDelegate, ptr); }
/// <summary> /// 删除好友 /// </summary> /// <param name="accid">对方账号</param> /// <param name="cb">操作结果回调</param> public static void DeleteFriend(string accid, FriendOperationDelegate cb) { IntPtr ptr = DelegateConverter.ConvertToIntPtr(cb); FriendNativeMethods.nim_friend_delete(accid, null, DeleteFriendDelegate, ptr); }