kiwiirc / kiwibnc

Apache License 2.0
43 stars 14 forks source link

clientid support #131

Closed prawnsalad closed 3 years ago

prawnsalad commented 3 years ago

Supports a clientid in the auth username (eg. username@clientid) to identify the connecting client. Each individual buffer keeps a record of which clientid has seen which messages so that only unread messages can be delivered on non-bouncer supported clients. The default clientid is bnc.

Auth examples: Server password: prawnsalad@office:password

Username: prawnsalad@office & server password password

This also fixes reporting the correct time in non server-time supported clients.

ItsOnlyBinary commented 3 years ago

Seems you missed at least one place lastSeen needs reworking: https://github.com/kiwiirc/kiwibnc/blob/7747ad4e99c7732640f939174a7bc3681c076acc/src/extensions/bouncer/index.js#L150-L152

On a new user with just added network joining their first channel:

2021-06-13T15:38:55.908Z [worker] l_error TypeError: Cannot convert object to primitive value
    at new Date (<anonymous>)
    at handleBouncerCommand (C:\Users\Neil\Code\kiwiirc\kiwibnc\src\extensions\bouncer\index.js:152:41)
    at async EventEmitter.emit (C:\Users\Neil\Code\kiwiirc\kiwibnc\src\libs\eventemitter.js:83:13)
    at async runCommand (C:\Users\Neil\Code\kiwiirc\kiwibnc\src\worker\clientcommands.js:50:16)
    at async Object.run (C:\Users\Neil\Code\kiwiirc\kiwibnc\src\worker\clientcommands.js:46:12)
    at async ConnectionIncoming.messageFromClient (C:\Users\Neil\Code\kiwiirc\kiwibnc\src\worker\connectionincoming.js:395:28)
    at async Array.<anonymous> (C:\Users\Neil\Code\kiwiirc\kiwibnc\src\worker\worker.js:203:13)
    at async IpcQueue.emit (C:\Users\Neil\Code\kiwiirc\kiwibnc\src\libs\eventemitter.js:83:13)
    at async IpcQueue.triggerPayload (C:\Users\Neil\Code\kiwiirc\kiwibnc\src\libs\ipcqueue.js:172:17)

console.log('lastSeen', buffer.lastSeen) added before line 151:

lastSeen [Object: null prototype] {}
prawnsalad commented 3 years ago

Good shout, also fixed a missed spot further down also.

ItsOnlyBinary commented 3 years ago

Testing seems to have gone well and everything appears to be working as expected :)

One last minor thing the year is wrong on the schema

https://github.com/kiwiirc/kiwibnc/blob/9aa40aa0c348d7fe6beb5cc3f844ff03b39ee435/src/dbschemas/connections/20200612122400_clientid.js