Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Feature Request: getJoinedSquareChats #43

Closed
betteray opened this issue Jun 27, 2022 · 6 comments
Closed

Feature Request: getJoinedSquareChats #43

betteray opened this issue Jun 27, 2022 · 6 comments
Labels
invalid This doesn't seem right

Comments

@betteray
Copy link
Contributor

I had implemented the getJoinedSquareChats method. But the server response a CHRLINE.exceptions.LineServiceException: Code: -519, Message: NO XLT:Not yet implemented.

def getJoinedSquareChats(self, continuationToken: str = None, limit=100):
        METHOD_NAME = "getJoinedSquareChats"
        request = []
        if continuationToken is not None:
            request.append([11, 2, continuationToken])
        request.append([8, 3, limit])

        params = [
            [12, 1, request]
        ]

        sqrd = self.generateDummyProtocol(
            METHOD_NAME,
            params,
            self.SquareService_REQ_TYPE
        )

        return self.postPackDataAndGetUnpackRespData(
            self.SquareService_API_PATH,
            sqrd,
            self.SquareService_RES_TYPE,
            readWith=f"SquareService.{METHOD_NAME}",
            baseException=SquareService.SQUARE_EXCEPTION
        )

The error is as below:

[2022-06-27 13:45:33] can't use Line Cube
[2022-06-27 13:45:34] Loading Custom Data: aaf87505fdfb410f45b0461291bbf188
Traceback (most recent call last):
  File "/Users/ray/Documents/work/CHRLINE/examples/LineApi.py", line 162, in <module>
    api.getJoinedSquareChats()
  File "/Users/ray/Documents/work/CHRLINE/examples/LineApi.py", line 128, in getJoinedSquareChats
    chats = self.cl.getJoinedSquareChats()
  File "/Users/ray/Documents/work/CHRLINE/CHRLINE/services/SquareService.py", line 731, in getJoinedSquareChats
    return self.postPackDataAndGetUnpackRespData(
  File "/Users/ray/Documents/work/CHRLINE/CHRLINE/models.py", line 524, in postPackDataAndGetUnpackRespData
    res = self.serializeDummyProtocolToThrift(
  File "/Users/ray/Documents/work/CHRLINE/CHRLINE/models.py", line 801, in serializeDummyProtocolToThrift
    raise LineServiceException(
CHRLINE.exceptions.LineServiceException: Code: -519, Message: NO XLT:Not yet implemented
@WEDeach WEDeach added the invalid This doesn't seem right label Jun 27, 2022
@WEDeach
Copy link
Member

WEDeach commented Jun 27, 2022

LineServiceException means the error came from the Line Service
If the server response the function is not implemented, that's it

If you know where it is used plz let me know 🍡

@WEDeach WEDeach closed this as completed Jun 27, 2022
@betteray
Copy link
Contributor Author

Thanks for the quick reply. I want to get all my joined square chats and found this method. I thought my request param is wrong or something so the server response error. If the response exception description is precise, then it should be as you said that the line service has not implemented it yet.

Anyway, do you know how can I get all my joined square chats?

@WEDeach
Copy link
Member

WEDeach commented Jun 27, 2022

At present chrline does not have good support for Square, the reason is that we do not implement fetchMyEvents correctly

I think you have to use fetchMyEvents to iterate through all events (for JoinSquareChat events) to record currently joined SquareChats

btw, I don't know how they handel with revisions, if you only join 1 Square and 3 SquareChats, there are many unnecessary chats makes 30000+ revisions, how to handel with it? (idk)

@betteray
Copy link
Contributor Author

Hi @WEDeach, I have seen you have updated the Push-dev branch with fetchMyEvents. I want to know how you capture the request of /PUSH/1/subs?m=20 endpoint. Because I can only hook the android app to get what's been request and response. I tried the Charlse Proxy, but it can't capture this endpoint. But with wireshark, i can't dump the ssl key log file. Do you have a solution about capture the wire data.

2022-06-30 10:56:43.936 2804-3206/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@7f9ebe1) fetchMyEvents, args: fetchMyEvents_args(request:FetchMyEventsRequest(subscriptionId:1656557801819, syncToken:6084, limit:100, continuationToken:null))
2022-06-30 10:56:44.540 2804-2901/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@7f9ebe1) fetchMyEvents, result: fetchMyEvents_result(success:FetchMyEventsResponse(subscription:SubscriptionState(subscriptionId:1656557801819, ttlMillis:3600000), events:[], syncToken:6084, continuationToken:null), e:null)
2022-06-30 10:56:50.775 2804-3234/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@fc270ac) fetchMyEvents, args: fetchMyEvents_args(request:FetchMyEventsRequest(subscriptionId:0, syncToken:6084, limit:100, continuationToken:null))
2022-06-30 10:56:51.311 2804-3234/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@fc270ac) fetchMyEvents, result: fetchMyEvents_result(success:FetchMyEventsResponse(events:[SquareEvent(createdTime:0, type:NOTIFICATION_MESSAGE, payload:<SquareEventPayload notificationMessage:SquareEventNotificationMessage(squareChatMid:m4abbc47d17d5d9a6b36dc2c47d7ff436, squareMessage:SquareMessage(message:Message(from:p727fecc6a800b83044e46177112fff30, to:m4abbc47d17d5d9a6b36dc2c47d7ff436, toType:SQUARE_CHAT, id:408905123247423493, createdTime:1656557750187, deliveredTime:1656557750187, hasText:false, contentType:STICKER, contentMetadata:{NOTIFICATION_DISABLED=null, app_extension_type=null, app_version_code=121010263, STKVER=1, STKID=378598815, STKPKGID=14431146}, sessionId:0, reactions:[]), fromType:SQUARE_MEMBER, squareMessageRevision:1, state:SENT), reqSeq:29479, senderDisplayName:ไลน์ดีๆก็มีคนรับ, unreadCount:1000, requiredToFetchChatEvents:false)>, syncToken:6085, eventStatus:NORMAL)], syncToken:6085, continuationToken:null), e:null)
2022-06-30 10:57:16.975 2804-3234/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@2e1fa4) fetchMyEvents, args: fetchMyEvents_args(request:FetchMyEventsRequest(subscriptionId:0, syncToken:6085, limit:100, continuationToken:null))
2022-06-30 10:57:17.589 2804-3234/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@2e1fa4) fetchMyEvents, result: fetchMyEvents_result(success:FetchMyEventsResponse(events:[SquareEvent(createdTime:0, type:NOTIFICATION_MESSAGE, payload:<SquareEventPayload notificationMessage:SquareEventNotificationMessage(squareChatMid:m0988193be4ef0e5f67e0fbafcc5d5bcb, squareMessage:SquareMessage(message:Message(from:p13ed47a7df68daba80b459858531323a, to:m0988193be4ef0e5f67e0fbafcc5d5bcb, toType:SQUARE_CHAT, id:408905164787810317, createdTime:1656557776246, deliveredTime:1656557776246, hasText:true, contentType:VIDEO, contentMetadata:{DURATION=224653, SRC_SVC_CODE=talk}, sessionId:0, chunks:[], reactions:[]), fromType:SQUARE_MEMBER, squareMessageRevision:1, state:SENT), reqSeq:65460, senderDisplayName:pum, unreadCount:579, requiredToFetchChatEvents:false)>, syncToken:6086, eventStatus:NORMAL)], syncToken:6086, continuationToken:null), e:null)
2022-06-30 10:57:19.944 2804-3234/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@58313cc) fetchMyEvents, args: fetchMyEvents_args(request:FetchMyEventsRequest(subscriptionId:0, syncToken:6086, limit:100, continuationToken:null))
2022-06-30 10:57:20.462 2804-3234/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@58313cc) fetchMyEvents, result: fetchMyEvents_result(success:FetchMyEventsResponse(events:[SquareEvent(createdTime:0, type:NOTIFICATION_MESSAGE, payload:<SquareEventPayload notificationMessage:SquareEventNotificationMessage(squareChatMid:m0988193be4ef0e5f67e0fbafcc5d5bcb, squareMessage:SquareMessage(message:Message(from:p13ed47a7df68daba80b459858531323a, to:m0988193be4ef0e5f67e0fbafcc5d5bcb, toType:SQUARE_CHAT, id:408905170173296642, createdTime:1656557779313, deliveredTime:1656557779313, hasText:true, contentType:VIDEO, contentMetadata:{SRC_SVC_CODE=talk}, sessionId:0, chunks:[], reactions:[]), fromType:SQUARE_MEMBER, squareMessageRevision:1, state:SENT), reqSeq:65462, senderDisplayName:pum, unreadCount:580, requiredToFetchChatEvents:false)>, syncToken:6087, eventStatus:NORMAL)], syncToken:6087, continuationToken:null), e:null)
2022-06-30 10:57:22.505 2804-3234/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@41d4e06) fetchMyEvents, args: fetchMyEvents_args(request:FetchMyEventsRequest(subscriptionId:0, syncToken:6087, limit:100, continuationToken:null))
2022-06-30 10:57:23.030 2804-3234/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@41d4e06) fetchMyEvents, result: fetchMyEvents_result(success:FetchMyEventsResponse(events:[SquareEvent(createdTime:0, type:NOTIFICATION_MESSAGE, payload:<SquareEventPayload notificationMessage:SquareEventNotificationMessage(squareChatMid:m0988193be4ef0e5f67e0fbafcc5d5bcb, squareMessage:SquareMessage(message:Message(from:p13ed47a7df68daba80b459858531323a, to:m0988193be4ef0e5f67e0fbafcc5d5bcb, toType:SQUARE_CHAT, id:408905172907982849, createdTime:1656557781842, deliveredTime:1656557781842, hasText:true, contentType:VIDEO, contentMetadata:{SRC_SVC_CODE=talk}, sessionId:0, chunks:[], reactions:[]), fromType:SQUARE_MEMBER, squareMessageRevision:1, state:SENT), reqSeq:65463, senderDisplayName:pum, unreadCount:581, requiredToFetchChatEvents:false)>, syncToken:6088, eventStatus:NORMAL)], syncToken:6088, continuationToken:null), e:null)
2022-06-30 10:57:23.963 2804-3234/? D/Line.ThriftHooks: TServiceClient(com.linecorp.square.protocol.thrift.SquareService$Client@f0ebda2) fetchMyEvents, args: fetchMyEvents_args(request:FetchMyEventsRequest(subscriptionId:0, syncToken:6088, limit:100, continuationToken:null))

I noticed that when the app cold start, the subscriptionId is is the timestamp, then it is 0. But i see you pass to it with 101.

@WEDeach
Copy link
Member

WEDeach commented Jun 30, 2022

Hi, @betteray

I've noticed the /PUSH endpoint since last year, but I haven't been able to do anything about it (yes, you can't get to it by capturing packets)

But I noticed in February of this year that it still has some pre-packages (StatusPacket), but then I was busy with other things and didn't delve into it.

The good news is that I received LINE will close ID OpenChat (Square) a few weeks ago, which probably means I'm running out of time, so I immediately started researching/PUSH.
I just decompile and find the meaning of StatusPacket to understand it, no hooks needed

I noticed that when the app cold start, the subscriptionId is is the timestamp, then it is 0. But i see you pass to it with 101.

It seems to be customizable, just let the server know you're subscribing to it maybe
0 is mean no any subscription or just fetch

@betteray
Copy link
Contributor Author

Ok. I see. Thank you @WEDeach.

@WEDeach WEDeach pinned this issue Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants