Skip to content

Commit

Permalink
Merge origin/feature/sticker into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Tebbe Ubben committed Jun 14, 2024
2 parents eed0aa7 + 8354e0b commit 64c318c
Show file tree
Hide file tree
Showing 128 changed files with 776 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data-represantation of a single text message in a chat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
instance creation
newFrom: aJsonObject

^ self new
text: ((aJsonObject at: 'sticker') at: 'emoji');
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
asSnippet

^ self text
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
asText

^ self text
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
text: aString

text := aString
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
text

^ text
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"class" : {
"newFrom:" : "JK 5/31/2024 11:40" },
"instance" : {
"asSnippet" : "RK 6/26/2021 11:37",
"asText" : "rgw 5/12/2022 14:28",
"text" : "TR 6/20/2021 10:17",
"text:" : "pk 8/4/2021 11:47" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "TelegramClient-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "<historical>",
"instvars" : [
"text" ],
"name" : "TCCAnimatedStickerMessage",
"pools" : [
],
"super" : "TCCMessage",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sending
sendStickerMessage: aStickerPath

self core send: (TCCRequest newSendStickerMessage: aStickerPath asString to: self id).
self selectedReplyToMessageId: self class defaultSelectedReplyToMessageId.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"requestedMessages:" : "aka 6/15/2022 11:52",
"selectedReplyToMessageId" : "JS 5/20/2022 09:50",
"selectedReplyToMessageId:" : "ek 8/4/2022 11:36",
"sendMessage:" : "JS 5/20/2022 10:06",
"sendMessage:" : "JK 5/28/2024 09:53",
"sendStickerMessage:" : "JK 5/28/2024 10:26",
"stillRequestedMessages" : "ek 8/4/2022 11:38",
"title" : "rs 6/7/2020 22:24",
"title:" : "5/11/2021 10:09:15",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ initialize
userStore: (TCCUserStore newWith: self);
imageStore: (TCCImageStore newWith: self);
videoStore: (TCCVideoStore newWith: self);
stickerStore: (TCCStickerStore newWith: self);
callbackCounter: 0.


"Mac users report serious slowdowns when receiveLoop is running at lower priority"
"So we have to rely on just the delay"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
stickerStore: aStickerStore

stickerStore := aStickerStore.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
stickerStore

^ stickerStore
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"freeClient" : "6/9/2021 14:12:18",
"generateCallbackId" : "pk 8/5/2021 17:04",
"getOwnProfile" : "pk 8/5/2021 17:05",
"handleEvent:" : "rgw 7/21/2022 13:13",
"handleEvent:" : "JK 5/16/2024 22:13",
"handleMessageEvent:" : "rgw 5/12/2022 13:44",
"handlePendingEvent:" : "per 8/2/2021 15:05",
"imageStore" : "pk 6/19/2021 17:15",
"imageStore:" : "TR 6/22/2021 09:33",
"initialize" : "JK 6/12/2024 19:42",
"initialize" : "TU 6/14/2024 09:38",
"initializeHandlers" : "RS 8/1/2021 12:53",
"isClientAlive" : "js 5/28/2020 17:18",
"loggedInUserId" : "pk 8/5/2021 17:04",
Expand All @@ -36,8 +36,10 @@
"send:thenDo:" : "rgw 6/2/2022 09:46",
"sendPhoneNumber:" : "RS 7/31/2021 15:57",
"setUserId:" : "pk 8/5/2021 17:05",
"stickerStore" : "JK 5/16/2024 21:25",
"stickerStore:" : "JK 5/16/2024 21:25",
"tryHandleError:" : "aka 5/21/2022 12:07",
"update" : "rgw 7/24/2022 15:08",
"update" : "JK 5/16/2024 21:57",
"userStore" : "per 7/15/2021 12:56",
"userStore:" : "tr 7/25/2021 17:57",
"videoStore" : "JK 6/12/2024 19:42",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"pendingRequests",
"callbackCounter",
"userStore",
"videoStore" ],
"videoStore",
"stickerStore" ],
"name" : "TCCCore",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"instance" : {
"core" : "6/14/2024 09:21:38",
"core:" : "6/14/2024 09:21:38",
"getFormFor:" : "rgw 6/6/2022 18:51",
"getFormFor:" : "JK 5/16/2024 22:13",
"getFormPromiseFor:" : "rgw 6/6/2022 18:43",
"requestImageFor:with:" : "JK 6/12/2024 19:46" } }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
WebPDecodeBGRAInto: aPointer1 dataSize: aNumber1 outputBuffer: aPointer2 outputBufferSize: aNumber2 outputStride: aNumber3
<cdecl: uint8_t* 'WebPDecodeBGRAInto'(uint8_t*, size_t, uint8_t*, size_t, long) module: 'libwebp'>
^self externalCallFailed
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
WebPGetInfo: aPointer1 dataSize: aNumber width: aPointer2 height: aPointer3
<cdecl: long 'WebPGetInfo'(uint8_t*, size_t, long*, long*) module: 'libwebp'>
^self externalCallFailed
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
as yet unclassified
decode: aByteArray
"decodes a WebP image from a ByteArray and returns the result Form or nil in case of an error"

| dimensions decodedImage result |

dimensions := self getFileInfo: aByteArray.
dimensions ifNil: [ ^nil ].
decodedImage := ByteArray new: (dimensions x) * (dimensions y) * 4.
result := self WebPDecodeBGRAInto: aByteArray dataSize: aByteArray size outputBuffer: decodedImage outputBufferSize: decodedImage size outputStride: dimensions x * 4.
(result isNull) ifFalse: [ ^ self formFrom: decodedImage dimensions: dimensions ].
^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
as yet unclassified
formFrom: aByteArray dimensions: aPoint
"creates a Form from an BGRA ByteArray"

^ Form
extent: aPoint
depth: 32
bits: ((Bitmap new: aByteArray size / 4)
fromByteStream: aByteArray readStream;
yourself)


Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
as yet unclassified
getFileInfo: aByteArray
"returns the dimensions of the given image or nil if it is not a valid WebP format"

| result widthHandle heightHandle |

widthHandle := ExternalType long allocate.
heightHandle := ExternalType long allocate.
result := TCCLibWebP WebPGetInfo: aByteArray dataSize: aByteArray size width: widthHandle height: heightHandle.
(result = 1)
ifTrue: [^ (widthHandle at: 1)@(heightHandle at: 1)]
ifFalse: [ ^ nil ]

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"class" : {
"WebPDecodeBGRAInto:dataSize:outputBuffer:outputBufferSize:outputStride:" : "TU 5/18/2024 15:20",
"WebPGetInfo:dataSize:width:height:" : "TU 5/18/2024 01:44",
"decode:" : "TU 5/22/2024 19:22",
"formFrom:dimensions:" : "TU 5/22/2024 19:21",
"getFileInfo:" : "TU 5/29/2024 15:05" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "TelegramClient-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "TCCLibWebP",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ newMessageWith: aJsonObject
['messagePoll'] -> [TCCPollMessage newFrom: aJsonObject].
['messagePhoto'] -> [TCCPhotoMessage newFrom: aJsonObject].
['messageVideo'] -> [TCCVideoMessage newFrom: aJsonObject].
['messageSticker'] -> [TCCStickerMessage newFrom: aJsonObject].
['messageChatAddMembers'] -> [TCCAddMembersMessage newFrom: aJsonObject].
['messageChatDeleteMember'] -> [TCCDeleteMemberMessage newFrom: aJsonObject].
} otherwise: [TCCNotSupportedMessage new]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"class" : {
"maxReplySnippetSize" : "rgw 5/12/2022 16:05",
"newFromMessageEvent:in:with:" : "rgw 6/2/2022 09:01",
"newMessageWith:" : "TU 6/14/2024 09:29",
"newMessageWith:" : "TU 6/14/2024 09:39",
"timeStampToDateAndTime:" : "JB 5/16/2021 09:42" },
"instance" : {
"asReplySnippet" : "rgw 5/12/2022 16:05",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
instance creation
getInstalledStickerSets

^ TCCRequest
newWithType: 'getInstalledStickerSets'
from: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
instance creation
getStickerSetFor: aStickerSetId

^ TCCRequest
newWithType: 'getStickerSet'
from: {
'set_id' -> aStickerSetId}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
instance creation
newRequestSticker: aStickerId

^ TCCRequest
newWithType: 'downloadFile'
from: {
'file_id'->aStickerId.
'priority'->32.
'offset'->0.
'limit'->0.
'synchronous' -> true.
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
instance creation
newSendMessage: aString to: aChatId

"
^ TCCRequest
newWithType: 'sendMessage'
from: {
Expand All @@ -12,4 +12,5 @@ newSendMessage: aString to: aChatId
'text' -> aString asString squeakToUtf8
})
})
}
}"
Transcript show: 'hier passiert ja doch was'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
instance creation
newSendStickerMessage: aStickerPath to: aChatId

^ TCCRequest
newWithType: 'sendMessage'
from: {
'chat_id' -> aChatId.
'input_message_content' -> (Dictionary newFrom: {
'@type' -> 'inputMessageSticker'.
'sticker' -> (Dictionary newFrom: {
'@type' -> 'inputFileLocal'.
'path' -> aStickerPath.
})
})
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"class" : {
"getInstalledStickerSets" : "JK 5/23/2024 21:46",
"getStickerSetFor:" : "JK 5/31/2024 14:50",
"newCheckAuthenticationCode:" : "RS 6/23/2021 16:35",
"newCheckAuthenticationPassword:" : "aka 5/21/2022 10:34",
"newCheckDatabaseEncryptionKey:" : "RS 6/23/2021 16:35",
Expand All @@ -12,10 +14,12 @@
"newGetSuperGroupMembersOf:with:until:" : "JB 8/1/2021 11:31",
"newLogOut" : "RS 6/23/2021 16:33",
"newRequestFile:" : "JB 8/1/2021 11:35",
"newRequestSticker:" : "JK 5/16/2024 21:39",
"newSearchChatFrom:" : "RS 6/23/2021 16:38",
"newSendMessage:to:" : "RS 6/23/2021 16:41",
"newSendMessage:to:" : "6/7/2024 09:02:10",
"newSendMessage:to:asReplyTo:" : "JS 5/20/2022 10:02",
"newSendPhoneNumber:" : "RS 6/23/2021 16:34",
"newSendStickerMessage:to:" : "JK 5/28/2024 10:52",
"newSetPollAnswer:message:options:" : "TU 6/6/2024 01:15",
"newUser:" : "JB 8/1/2021 11:55",
"newWithType:from:" : "rs 6/6/2020 16:21" },
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
instance creation
newAnimatedStickerFrom: aJsonObject

^ TCCAnimatedStickerMessage newFrom: aJsonObject.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
instance creation
newFrom: aJsonObject

| stickerData |
stickerData := (aJsonObject at: 'sticker').
(stickerData at: 'is_animated') ifTrue:
[^ self newAnimatedStickerFrom: aJsonObject].

^ self new
width: (stickerData at: 'width');
height: (stickerData at: 'height');
stickerId: ((stickerData at: 'sticker') at: 'id');
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
asSnippet

^ 'Sticker'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
asText

^ 'Sticker'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
height: aNumber

height := aNumber.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
height

^ height
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
stickerId: aNumber

stickerId := aNumber.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
stickerId

^ stickerId
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
width: aNumber

width := aNumber.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
width

^ width
Loading

0 comments on commit 64c318c

Please sign in to comment.