86 Commits

Author SHA1 Message Date
Steven Leibrock
ae585079e7 host.go: avoiding motd output if bot mode set 2022-07-29 21:57:49 -04:00
mik2k2
621ae1b0d3
Add /allowlist command (#399)
* move loading whitelist+ops from file to auth and save the loaded files fro reloading

* add /whitelist command with lots of open questions

* add test for /whitelist

* gofmt

* use the same auth (the tests don't seem to care, but htis is more right)

* mutex whitelistMode and remove some deferred TODOs

* s/whitelist/allowlist/ (user-facing); move helper functions outside the handler function

* check for ops in Auth.CheckPublicKey and move /allowlist handling to helper functions

* possibly fix the test timeout in HostNameCollision

* Revert "possibly fix the test timeout in HostNameCollision" (didn't work)

This reverts commit 664dbb0976f8f10ea7a673950a879591c2e7c320.

* managed to reproduce the timeout after updating, hopefully it's the same one

* remove some unimportant TODOs; add a message when reverify kicks people; add a reverify test

* add client connection with key; add test for /allowlist import AGE

* hopefully make test less racy

* s/whitelist/allowlist/

* fix crash on specifying exactly one more -v flag than the max level

* use a key loader function to move file reading out of auth

* add loader to allowlist test

* minor message changes

* add --whitelist with a warning; update tests for messages

* apparently, we have another prefix

* check names directly on the User objects in TestHostNameCollision

* not allowlisted -> not allowed

* small message change

* update test
2022-01-06 09:09:51 -05:00
Akshay Shekher
e1e534344e
Fix SSHCHAT_TIMESTAMP env variables (#392)
* Fixes Env Vars to pass config to ssh-chat.

The env vars were beign parsed and set to the host
before the user was even added to the host and
hence ignored. This change moves the env var parsing
to after initializing the user.

TODO: tests, completeness+reliability

* cleaned up the test

* reduced test flakyness by adding wait instead of being optimistic

Co-authored-by: Akshay <akshay.shekher@gmail.com>
2021-05-02 12:18:31 -04:00
Andrey Petrov
b73b45640c host: Fix /msg vs /reply message formatting
Closes #382
2021-04-06 09:28:48 -04:00
Andrey Petrov
8257ada10d host: Factor out PM code, add away status 2021-03-15 11:07:52 -04:00
Akshay
0338cb824d chat: Added support for user away status, fixes #377
made away toggle status, like irc

updated /away feature

* added away message
* added broadcast away message as emote
* updated names list to show away users on the same line, with colors

added /away -> back message

Update away time to be time since marked away

reverted changes made for /list
2021-03-15 10:30:54 -04:00
Abdelkader Bouadjadja
ebbbc3b6d9 Fix ~ Reply to user with symbol returning Err user not found 2021-03-13 14:56:36 +04:00
Andrey Petrov
4fe43746fe main: /rename should not complain when symbol is set and name is unchanged 2020-08-03 14:13:51 -04:00
Andrey Petrov
53ae43fb1b /motd: Add reload functionality when msg is @ 2020-08-03 13:26:12 -04:00
Andrey Petrov
e0ab53500e
Merge branch 'master' into sponsor-prefix 2020-08-03 11:41:19 -04:00
Pavel Zaitsev
5885f7fbdd updated tests, moved code closer to the caller.
* addded condition for zero time on lastMsg.

* removed extra paramter in NamePrefix
* moved code from NamePrefix to completeName
* removed extra parameter in tests calling to NamePrefix
2020-07-29 18:23:34 -04:00
Pavel Zaitsev
5ff2ea085b in autocomplete list moves your name to last item in the list of sorted current users 2020-07-24 10:16:29 -04:00
Pavel Zaitsev
b6a8763f3b updated in line with comments in PR
* reduce change footprint to parameter list
* moved Op flag display to last line as to not break bots
2020-07-16 20:57:48 -04:00
Pavel Zaitsev
5f201e0f20 now if both are ops it will be reflected in output of whois command 2020-07-07 23:24:25 -04:00
Andrey Petrov
ced5767bbb main: Add symbol support 2020-06-24 13:53:24 -04:00
Andrey Petrov
36843252b4 chat, main: Add /rename op command 2020-06-24 12:36:02 -04:00
Andrey Petrov
a3f41865fd main: Skip prompt, highlight, autocomplete in bot mode 2020-04-13 11:33:12 -04:00
Andrey Petrov
cce7defd5e main: Add TERM=bot handling for Host 2020-04-13 11:23:11 -04:00
Andrey Petrov
fdfdcf96b7 main, sshd: Add comments and TODOs 2020-04-12 13:04:53 -04:00
Chris Miller
dd2fadd6c1 Apply env vars SSHCHAT_TIMESTAMP and SSHCHAT_THEME 2020-04-12 12:37:55 -04:00
Andrey Petrov
67163a93a8 sshchat: term.Write on empty lines to fix prompt reset bug 2019-03-29 17:26:23 -04:00
Andrey Petrov
6acb0bf809 sshchat, host: Switch to new terminal clearline api 2019-03-21 15:33:18 -04:00
Andrey Petrov
8653f0a730 sshchat: Replace terminal echo hack with our forked terminal 2019-03-18 10:08:39 -04:00
Andrey Petrov
b8fb704c8f sshchat: Fix empty messages borking rendering 2019-03-17 16:10:16 -04:00
Andrey Petrov
9c3db55c83 sshchat: Echo command messages with the new timestamp code. 2019-03-17 13:50:01 -04:00
Andrey Petrov
eb10bad08e sshchat, chat: Override terminal echo and do our own echo 2019-03-16 11:52:07 -04:00
Andrey Petrov
6d3fce47cc Revert "host: Add timestamps into prompt when enabled"
This reverts commit 6ce14bfc33e5a5aeb6003cdec9a873588eabe8f0.

We're going to do another approach.
2019-03-16 11:52:07 -04:00
Andrey Petrov
4188a3bdac host: Add timestamps into prompt when enabled 2019-03-16 11:52:07 -04:00
Andrey Petrov
3f0faf761e main: Skip command autocomplete if space-prefixed
Fixes #300
2019-03-15 18:39:53 -04:00
Andrey Petrov
ae46a91e0f /reply: Set reply target properly
Fixes #299
2019-03-15 18:32:46 -04:00
Andrey Petrov
60701198fc /op: Fix room op being tied to the nick, add remove option
Closes #301
2019-03-15 18:18:20 -04:00
UlisseMini
a1b891aae2 host.go: drop = 0 from declaration; it is the zero value (golint) 2019-02-24 09:40:47 -06:00
Robert Hailey
40bf204058 chat: When a user leaves, add time since they joined to the exit message.
* Show the connection duration upon departure

* humantime: ugly sub-second precision replaces grammatically incorrect "1 seconds" message

* simplify function name

* humantime: repair unit test

* move: util/humantime -> internal/humantime

* go fmt everything
2019-01-02 15:46:21 -05:00
Andrey Petrov
903d6c9420
/ban query support (#286)
For #285 

Turns out there were some bugs in Set, and I was using it incorrectly too.

The query syntax is a little awkward but couldn't find a nicer easy to parse format that worked with quoted string values.
2018-12-25 14:29:19 -05:00
Andrey Petrov
3572c4674c main: Add /banned command to list banned entries for ops. 2018-12-15 19:04:42 -05:00
Andrey Petrov
66fee99a81 /uptime and /whois relative timestamps made more precise
Replaced go-humanize dependency with our own logic.

Fixes #259.
2018-01-19 12:35:45 -05:00
Steven L
e800c88a56 Fixed /reply bug (#230) 2017-04-27 21:04:37 -04:00
Andrey Petrov
cdcc4a9931 refactor: User.Config -> User.Config() and User.SetConfig(UserConfig) 2016-08-29 10:11:39 -04:00
Andrey Petrov
d950112dd9 refactor: Id -> ID 2016-08-24 13:54:20 -04:00
Andrey Petrov
0fcc076c74 set: Switch to a common set implementation 2016-08-24 13:54:20 -04:00
Greg Wedow
a67a9d115b /uptime: Format output to be more human-friendly 2016-08-21 12:20:53 -04:00
Andrey Petrov
47607af729 /reply: Enabled again.
Fixes #202
2016-08-16 14:20:51 -04:00
Andrey Petrov
398cd75c5e logging: Add [RemoteAddr] prefix to connection-related messages 2016-08-13 16:22:43 -04:00
Andrey Petrov
cfa86b3e2e /motd: Fixed set message and actual motd coming out of order.
Fixes #165
2016-08-12 16:35:00 -04:00
Micheal Winger
91c62966fa /msg: Send SystemMsg confirmation with each PM 2016-08-06 23:56:24 -04:00
Dmitri Shuralyov
66adee6f9a /whois: Hide IP if user isn't admin; display client and time joined. (#192)
Resolves #170.
2016-08-06 18:20:34 -04:00
Andrey Petrov
c8661e6883 motd: Allow for reading the current motd when no additional args given.
Closes #155, merges #157

Squashed commit of the following:

commit bcb0810637c99223753629a2e55169b07ee9fe51
Author: Andrey Petrov <andrey.petrov@shazow.net>
Date:   Wed Aug 3 17:58:37 2016 -0400

    motd: Refactor inner conditions

commit ac28c8cb4e8dc2a0d23abe3dcf52b69175cde51b
Author: Aaron <aaron.ounn@gmail.com>
Date:   Tue Aug 2 09:38:36 2016 +0300

    Fix small issues with the help message

commit a80ae77e1d691a4ec7125be5441d4f6eea767a75
Author: Aaron <aaron.ounn@gmail.com>
Date:   Tue Aug 2 09:30:21 2016 +0300

    Print the motd if no parameters are passed

commit 2db1b3c123661cdbd622d5ba2ff81ede8cb8a951
Author: Aaron <aaron.ounn@gmail.com>
Date:   Tue Aug 2 09:29:41 2016 +0300

    Update the motd command's description
2016-08-03 17:58:49 -04:00
Andrey Petrov
13ea34b912 Fixed autocomplete crashing bug (#166) 2016-08-03 17:42:53 -04:00
Andrey Petrov
c4604fde94 Disabled autocomplete due to #166.
Also added mutex for user replyTo pointer, since that's being set by
both the host and user.
2016-08-03 12:19:33 -04:00
Andrey Petrov
2abe368022 style: Fix gofmt and vet complaints 2016-07-31 12:18:06 -04:00