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

Commit

Permalink
close #260
Browse files Browse the repository at this point in the history
close #261
  • Loading branch information
takayama-lily committed Dec 8, 2021
1 parent 231641b commit 98558ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
9 changes: 4 additions & 5 deletions lib/core/base-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ function lostListener(this: BaseClient) {
}

async function parseSso(buf: Buffer) {
const headlen = buf.readUInt32BE()
const seq = buf.readInt32BE(4)
const retcode = buf.readInt32BE(8)
if (retcode !== 0)
Expand All @@ -598,15 +599,13 @@ async function parseSso(buf: Buffer) {
len = buf.readUInt32BE(offset) // length of session_id
offset += len
const flag = buf.readInt32BE(offset)
len = buf.readInt32BE(offset) // unknown data (2021.12.8)
offset += len
let payload
if (flag === 0)
payload = buf.slice(offset + 8)
payload = buf.slice(headlen + 4)
else if (flag === 1)
payload = await unzip(buf.slice(offset + 8))
payload = await unzip(buf.slice(headlen + 4))
else if (flag === 8)
payload = buf.slice(offset + 4)
payload = buf.slice(headlen)
else
throw new Error("unknown compressed flag: " + flag)
return {
Expand Down
6 changes: 5 additions & 1 deletion lib/internal/listeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ type Client = import("../client").Client

async function pushNotifyListener(this: Client, payload: Buffer) {
if (!this._sync_cookie) return
const nested = jce.decodeWrapper(payload.slice(15))
try {
var nested = jce.decodeWrapper(payload.slice(4))
} catch {
var nested = jce.decodeWrapper(payload.slice(15))
}
switch (nested[5]) {
case 33: //群员入群
case 38: //建群
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oicq",
"version": "2.1.5",
"upday": "2021/12/04",
"version": "2.1.6",
"upday": "2021/12/08",
"description": "QQ protocol!",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down

0 comments on commit 98558ae

Please sign in to comment.