GroupProxy.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2015-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <Foundation/Foundation.h>
  21. #import "Conversation.h"
  22. #import "Contact.h"
  23. #import "AbstractGroupMessage.h"
  24. @class EntityManager;
  25. @interface GroupProxy : NSObject
  26. @property (readonly) NSData *groupId;
  27. @property (readonly) NSString *name;
  28. @property (readonly) NSSet *members;
  29. @property (readonly) NSSet *activeMembers;
  30. @property (readonly) NSSet *activeMemberIds;
  31. @property (readonly) NSSet *memberIdsIncludingSelf;
  32. @property (readonly) Contact *creator;
  33. + (instancetype)groupProxyForConversation:(Conversation *)conversation;
  34. + (instancetype)groupProxyForConversation:(Conversation *)conversation entityManager:(EntityManager*)entityManager;
  35. + (instancetype)groupProxyForMessage:(AbstractGroupMessage *)message;
  36. + (instancetype)newGroupWithId:(NSData *)groupId creator:(Contact *)creator;
  37. + (void)sendSyncRequestWithGroupId:(NSData *)groupId creator:(NSString *)groupCreator;
  38. + (void)recordSyncRequestWithGroupId:(NSData *)groupId creator:(NSString *)groupCreator;
  39. - (BOOL)isOwnGroup;
  40. - (BOOL)isSelfMember;
  41. - (void)setName:(NSString *)name remoteSentDate:(NSDate*)remoteSentDate;
  42. - (BOOL)didLeaveGroup;
  43. - (BOOL)didRequestSync;
  44. - (BOOL)canSendInGroup;
  45. - (Contact *)contactForMemberIdentity:(NSString *)identity;
  46. - (void)resendSyncRequest;
  47. - (void)resendLeaveMessageTo:(NSString *)identity;
  48. - (Conversation *)conversation;
  49. - (void)adminAddMembersFromBackup:(NSSet *)identities entityManager:(EntityManager*)entityManager;
  50. - (void)adminAddMember:(Contact *)contact;
  51. - (void)adminRemoveMember:(Contact *)contact;
  52. - (void)adminDeleteGroup;
  53. - (BOOL)isGroupMember:(NSString *)contactIdentity;
  54. - (void)remoteAddGroupMember:(NSString*)memberIdentity notify:(BOOL)notify remoteSentDate:remoteSentDate;
  55. - (void)remoteRemoveGroupMember:(NSString*)memberIdentity remoteSentDate:remoteSentDate;
  56. - (void)remoteGroupMemberLeft:(NSString *)memberIdentity remoteSentDate:remoteSentDate;
  57. - (void)updateGroupMyIdentity:(NSString *)groupMyIdentity forConversation:(Conversation *)conversation;
  58. - (void)syncGroupInfoToIdentity:(NSString *)identity;
  59. - (void)syncGroupInfoToContact:(Contact *)contact;
  60. - (void)syncGroupInfoToAll;
  61. - (NSString *)creatorString;
  62. - (NSString *)membersSummaryString;
  63. - (NSArray *)sortedActiveMembers;
  64. - (void)leaveGroup;
  65. @end