mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-05 04:07:44 +00:00
core: link notices
This commit is contained in:
1 parent
3ed4511e80
commit
40fc230f06
50 files changed
+1329
-353
No files matched your search
@@ -282,10 +282,11 @@ class APIRemoveMembers(TypedDict):
|
||||
groupId: int # int64
|
||||
groupMemberIds: list[int] # int64, non-empty
|
||||
withMessages: bool
|
||||
notice: NotRequired["T.LinkNotice"]
|
||||
|
||||
|
||||
def APIRemoveMembers_cmd_string(self: APIRemoveMembers) -> str:
|
||||
return '/_remove #' + str(self['groupId']) + ' ' + ','.join(map(str, self['groupMemberIds'])) + (' messages=on' if self['withMessages'] else '')
|
||||
return '/_remove #' + str(self['groupId']) + ' ' + ','.join(map(str, self['groupMemberIds'])) + (' messages=on' if self['withMessages'] else '') + ((' notice=' + json.dumps(self.get('notice'))) if self.get('notice') is not None else '')
|
||||
|
||||
APIRemoveMembers_Response = CR.UserDeletedMembers | CR.ChatCmdError
|
||||
|
||||
@@ -599,10 +600,11 @@ APIGetChats_Response = CR.ApiChats | CR.ChatCmdError
|
||||
class APIDeleteChat(TypedDict):
|
||||
chatRef: "T.ChatRef"
|
||||
chatDeleteMode: "T.ChatDeleteMode"
|
||||
notice: NotRequired["T.LinkNotice"]
|
||||
|
||||
|
||||
def APIDeleteChat_cmd_string(self: APIDeleteChat) -> str:
|
||||
return '/_delete ' + T.ChatRef_cmd_string(self['chatRef']) + ' ' + T.ChatDeleteMode_cmd_string(self['chatDeleteMode'])
|
||||
return '/_delete ' + T.ChatRef_cmd_string(self['chatRef']) + ' ' + T.ChatDeleteMode_cmd_string(self['chatDeleteMode']) + ((' notice=' + json.dumps(self.get('notice'))) if self.get('notice') is not None else '')
|
||||
|
||||
APIDeleteChat_Response = CR.ContactDeleted | CR.ContactConnectionDeleted | CR.GroupDeletedUser | CR.ChatCmdError
|
||||
|
||||
|
||||
@@ -892,6 +892,11 @@ class ChatErrorType_unsupportedConnReq(TypedDict):
|
||||
class ChatErrorType_connReqMessageProhibited(TypedDict):
|
||||
type: Literal["connReqMessageProhibited"]
|
||||
|
||||
class ChatErrorType_linkNotice(TypedDict):
|
||||
type: Literal["linkNotice"]
|
||||
expiresAt: NotRequired[str] # ISO-8601 timestamp
|
||||
reason: NotRequired["ReportReason"]
|
||||
|
||||
class ChatErrorType_contactNotReady(TypedDict):
|
||||
type: Literal["contactNotReady"]
|
||||
contact: "Contact"
|
||||
@@ -1124,6 +1129,7 @@ ChatErrorType = (
|
||||
| ChatErrorType_notResolvedLocally
|
||||
| ChatErrorType_unsupportedConnReq
|
||||
| ChatErrorType_connReqMessageProhibited
|
||||
| ChatErrorType_linkNotice
|
||||
| ChatErrorType_contactNotReady
|
||||
| ChatErrorType_contactNotActive
|
||||
| ChatErrorType_contactDisabled
|
||||
@@ -1179,7 +1185,7 @@ ChatErrorType = (
|
||||
| ChatErrorType_exception
|
||||
)
|
||||
|
||||
ChatErrorType_Tag = Literal["noActiveUser", "noConnectionUser", "noSndFileUser", "noRcvFileUser", "userUnknown", "userExists", "chatRelayExists", "differentActiveUser", "cantDeleteActiveUser", "cantDeleteLastUser", "cantHideLastUser", "hiddenUserAlwaysMuted", "emptyUserPassword", "userAlreadyHidden", "userNotHidden", "invalidDisplayName", "chatNotStarted", "chatNotStopped", "chatStoreChanged", "invalidConnReq", "simplexDomainNotReady", "notResolvedLocally", "unsupportedConnReq", "connReqMessageProhibited", "contactNotReady", "contactNotActive", "contactDisabled", "connectionDisabled", "groupUserRole", "groupMemberInitialRole", "contactIncognitoCantInvite", "groupIncognitoCantInvite", "groupContactRole", "groupDuplicateMember", "groupDuplicateMemberId", "groupNotJoined", "groupMemberNotActive", "cantBlockMemberForSelf", "groupMemberUserRemoved", "groupMemberNotFound", "groupCantResendInvitation", "groupInternal", "fileNotFound", "fileSize", "fileAlreadyReceiving", "fileCancelled", "fileCancel", "fileAlreadyExists", "fileWrite", "fileSend", "fileRcvChunk", "fileInternal", "fileImageType", "fileImageSize", "fileNotReceived", "fileNotApproved", "fallbackToSMPProhibited", "inlineFileProhibited", "invalidForward", "invalidChatItemUpdate", "invalidChatItemDelete", "hasCurrentCall", "noCurrentCall", "callContact", "directMessagesProhibited", "agentVersion", "agentNoSubResult", "commandError", "badgeRedeemError", "agentCommandError", "invalidFileDescription", "connectionIncognitoChangeProhibited", "connectionUserChangeProhibited", "peerChatVRangeIncompatible", "relayTestError", "internalError", "exception"]
|
||||
ChatErrorType_Tag = Literal["noActiveUser", "noConnectionUser", "noSndFileUser", "noRcvFileUser", "userUnknown", "userExists", "chatRelayExists", "differentActiveUser", "cantDeleteActiveUser", "cantDeleteLastUser", "cantHideLastUser", "hiddenUserAlwaysMuted", "emptyUserPassword", "userAlreadyHidden", "userNotHidden", "invalidDisplayName", "chatNotStarted", "chatNotStopped", "chatStoreChanged", "invalidConnReq", "simplexDomainNotReady", "notResolvedLocally", "unsupportedConnReq", "connReqMessageProhibited", "linkNotice", "contactNotReady", "contactNotActive", "contactDisabled", "connectionDisabled", "groupUserRole", "groupMemberInitialRole", "contactIncognitoCantInvite", "groupIncognitoCantInvite", "groupContactRole", "groupDuplicateMember", "groupDuplicateMemberId", "groupNotJoined", "groupMemberNotActive", "cantBlockMemberForSelf", "groupMemberUserRemoved", "groupMemberNotFound", "groupCantResendInvitation", "groupInternal", "fileNotFound", "fileSize", "fileAlreadyReceiving", "fileCancelled", "fileCancel", "fileAlreadyExists", "fileWrite", "fileSend", "fileRcvChunk", "fileInternal", "fileImageType", "fileImageSize", "fileNotReceived", "fileNotApproved", "fallbackToSMPProhibited", "inlineFileProhibited", "invalidForward", "invalidChatItemUpdate", "invalidChatItemDelete", "hasCurrentCall", "noCurrentCall", "callContact", "directMessagesProhibited", "agentVersion", "agentNoSubResult", "commandError", "badgeRedeemError", "agentCommandError", "invalidFileDescription", "connectionIncognitoChangeProhibited", "connectionUserChangeProhibited", "peerChatVRangeIncompatible", "relayTestError", "internalError", "exception"]
|
||||
|
||||
ChatFeature = Literal["timedMessages", "fullDelete", "reactions", "voice", "files", "calls", "sessions"]
|
||||
|
||||
@@ -1547,6 +1553,11 @@ class ContactAddressPlan_contactViaAddress(TypedDict):
|
||||
type: Literal["contactViaAddress"]
|
||||
contact: "Contact"
|
||||
|
||||
class ContactAddressPlan_linkNotice(TypedDict):
|
||||
type: Literal["linkNotice"]
|
||||
expiresAt: NotRequired[str] # ISO-8601 timestamp
|
||||
reason: NotRequired["ReportReason"]
|
||||
|
||||
ContactAddressPlan = (
|
||||
ContactAddressPlan_ok
|
||||
| ContactAddressPlan_ownLink
|
||||
@@ -1554,9 +1565,10 @@ ContactAddressPlan = (
|
||||
| ContactAddressPlan_connectingProhibit
|
||||
| ContactAddressPlan_known
|
||||
| ContactAddressPlan_contactViaAddress
|
||||
| ContactAddressPlan_linkNotice
|
||||
)
|
||||
|
||||
ContactAddressPlan_Tag = Literal["ok", "ownLink", "connectingConfirmReconnect", "connectingProhibit", "known", "contactViaAddress"]
|
||||
ContactAddressPlan_Tag = Literal["ok", "ownLink", "connectingConfirmReconnect", "connectingProhibit", "known", "contactViaAddress", "linkNotice"]
|
||||
|
||||
class ContactShortLinkData(TypedDict):
|
||||
profile: "Profile"
|
||||
@@ -2001,6 +2013,11 @@ class GroupLinkPlan_updateRequired(TypedDict):
|
||||
type: Literal["updateRequired"]
|
||||
groupSLinkData_: NotRequired["GroupShortLinkData"]
|
||||
|
||||
class GroupLinkPlan_linkNotice(TypedDict):
|
||||
type: Literal["linkNotice"]
|
||||
expiresAt: NotRequired[str] # ISO-8601 timestamp
|
||||
reason: NotRequired["ReportReason"]
|
||||
|
||||
GroupLinkPlan = (
|
||||
GroupLinkPlan_ok
|
||||
| GroupLinkPlan_ownLink
|
||||
@@ -2009,9 +2026,10 @@ GroupLinkPlan = (
|
||||
| GroupLinkPlan_known
|
||||
| GroupLinkPlan_noRelays
|
||||
| GroupLinkPlan_updateRequired
|
||||
| GroupLinkPlan_linkNotice
|
||||
)
|
||||
|
||||
GroupLinkPlan_Tag = Literal["ok", "ownLink", "connectingConfirmReconnect", "connectingProhibit", "known", "noRelays", "updateRequired"]
|
||||
GroupLinkPlan_Tag = Literal["ok", "ownLink", "connectingConfirmReconnect", "connectingProhibit", "known", "noRelays", "updateRequired", "linkNotice"]
|
||||
|
||||
class GroupMember(TypedDict):
|
||||
groupMemberId: int # int64
|
||||
@@ -2175,6 +2193,10 @@ LinkContent = LinkContent_page | LinkContent_image | LinkContent_video | LinkCon
|
||||
|
||||
LinkContent_Tag = Literal["page", "image", "video", "unknown"]
|
||||
|
||||
class LinkNotice(TypedDict):
|
||||
ttl: NotRequired[int] # int64
|
||||
reason: NotRequired["ReportReason"]
|
||||
|
||||
class LinkOwnerSig(TypedDict):
|
||||
ownerId: NotRequired[str]
|
||||
chatBinding: str
|
||||
|
||||
Reference in new issue
Block a user