Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sopel lacks the ability to send custom commands on connect #1455

Closed
dgw opened this issue Jan 23, 2019 · 1 comment
Closed

Sopel lacks the ability to send custom commands on connect #1455

dgw opened this issue Jan 23, 2019 · 1 comment

Comments

@dgw
Copy link
Member

dgw commented Jan 23, 2019

Think ZNC's perform module, but without the ability to add/remove/rearrange lines from an IRC query.

I noted this down a while ago, but forgot about it until someone asked how to do this in #sopel tonight.

We want to keep this in the existing config file, but slipping this into the existing config value types could prove to be interesting. A custom login command might contain, say, a comma, because special characters in passwords are encouraged by modern recommendations. ListAttribute (the most logical option) doesn't escape commas at all, so it would split the values incorrectly upon reading them back.

(A separate PR implementing such escaping would be welcomed, if anyone's interested in working on it.)

HumorBaby added a commit to HumorBaby/sopel that referenced this issue Jan 27, 2019
This is a first step towards completing sopel-irc#1455, since, as @dgw mentioned,
to do so would require accepting commas in a single entry of ListAttribute.

Items entered through the wizard do not need to be escaped manaully. Items
configured in the `.cfg` file manually require an escaped command, like '\,'.
The prompt has also been changed so that the items are now surrounded by quotes
so that one can differentiate items that may contains commas.

The following scenarios were tested (using the `url.py` module, specifically the
`exclude` setting):

1. Wizard, setting items when there is no default (pre-existing items); mix of w/ commas
and w/o commas
2. Wizard, replacing existing items when a default exists; mix of w/ commas and w/o commas
3. Wizard, extending the current default list; mix of w/ commas and w/o commas
4. Manual edit, setting items; w/ commas (manually escaped) and w/o commas
5. Wizard, setting items w/o default; no commas
HumorBaby added a commit to HumorBaby/sopel that referenced this issue Jan 28, 2019
This is a first step towards completing sopel-irc#1455, since, as @dgw mentioned,
to do so would require accepting commas in a single entry of ListAttribute.

Items entered through the wizard do not need to be escaped manaully. Items
configured in the `.cfg` file manually require an escaped command, like '\,'.
The prompt has also been changed so that the items are now surrounded by quotes
so that one can differentiate items that may contains commas.

The following scenarios were tested (using the `url.py` module, specifically the
`exclude` setting):

1. Wizard, setting items when there is no default (pre-existing items); mix of w/ commas
and w/o commas
2. Wizard, replacing existing items when a default exists; mix of w/ commas and w/o commas
3. Wizard, extending the current default list; mix of w/ commas and w/o commas
4. Manual edit, setting items; w/ commas (manually escaped) and w/o commas
5. Wizard, setting items w/o default; no commas
HumorBaby added a commit to HumorBaby/sopel that referenced this issue Jan 28, 2019
This is a first step towards completing sopel-irc#1455, since, as @dgw mentioned, to do so would require accepting commas in a single entry of `ListAttribute`.

Items entered through the wizard do not need to be escaped manually. Items configured in the `.cfg` file manually require an escaped command, like `\,`. The prompt has also been changed such that the items are now surrounded by quotes so that one can differentiate items that may contains commas.

The following scenarios were tested (using the `url.py` module, specifically the `exclude` setting):

1. Wizard, setting items when there is no default (preexisting items); mix of w/ commas and w/o commas
2. Wizard, replacing existing items when a default exists; mix of w/ commas and w/o commas
3. Wizard, extending the current default list; mix of w/ commas and w/o commas
4. Manual edit, setting items; w/ commas (manually escaped) and w/o commas
5. Wizard, setting items w/o default; no commas

Relevant tests have also been updated/added:

1. Item with comma remains single item:
    - `test_listattribute_with_value_containing_comma`
2. Item with backslash is correctly serialized/parsed:
    - `test_listattribute_with_value_containing_backslash`
    - `test_listattribute_with_value_ending_in_backslash`
HumorBaby added a commit to HumorBaby/sopel that referenced this issue Jan 28, 2019
This is a first step towards completing sopel-irc#1455, since, as @dgw mentioned, to do so would require accepting commas in a single entry of `ListAttribute`.

Items entered through the wizard do not need to be escaped manually. Items configured in the `.cfg` file manually require an escaped command, like `\,`. The prompt has also been changed such that the items are now surrounded by quotes so that one can differentiate items that may contains commas.

The following scenarios were tested (using the `url.py` module, specifically the `exclude` setting):

1. Wizard, setting items when there is no default (preexisting items); mix of w/ commas and w/o commas
2. Wizard, replacing existing items when a default exists; mix of w/ commas and w/o commas
3. Wizard, extending the current default list; mix of w/ commas and w/o commas
4. Manual edit, setting items; w/ commas (manually escaped) and w/o commas
5. Wizard, setting items w/o default; no commas

Relevant tests have also been updated/added:

1. Item with comma remains single item:
    - `test_listattribute_with_value_containing_comma`
2. Item with backslash is correctly serialized/parsed:
    - `test_listattribute_with_value_containing_backslash`
    - `test_listattribute_with_value_ending_in_backslash`
HumorBaby added a commit to HumorBaby/sopel that referenced this issue Jan 28, 2019
This is a first step towards completing sopel-irc#1455, since, as @dgw mentioned, to do so would require accepting commas in a single entry of `ListAttribute`.

Items entered through the wizard do not need to be escaped manually. Items configured in the `.cfg` file manually require an escaped command, like `\,`. The prompt has also been changed such that the items are now surrounded by quotes so that one can differentiate items that may contains commas.

The following scenarios were tested (using the `url.py` module, specifically the `exclude` setting):

1. Wizard, setting items when there is no default (preexisting items); mix of w/ commas and w/o commas
2. Wizard, replacing existing items when a default exists; mix of w/ commas and w/o commas
3. Wizard, extending the current default list; mix of w/ commas and w/o commas
4. Manual edit, setting items; w/ commas (manually escaped) and w/o commas
5. Wizard, setting items w/o default; no commas

Relevant tests have also been updated/added:

1. Item with comma remains single item:
    - `test_listattribute_with_value_containing_comma`
2. Item with backslash is correctly serialized/parsed:
    - `test_listattribute_with_value_containing_backslash`
    - `test_listattribute_with_value_ending_in_backslash`
HumorBaby added a commit to HumorBaby/sopel that referenced this issue Jan 28, 2019
This is a first step towards completing sopel-irc#1455, since, as @dgw mentioned, to do so would require accepting commas in a single entry of `ListAttribute`.

Items entered through the wizard do not need to be escaped manually. Items configured in the `.cfg` file manually require an escaped command, like `\,`. The prompt has also been changed such that the items are now surrounded by quotes so that one can differentiate items that may contain commas.

The following scenarios were tested (using the `url.py` module, specifically the `exclude` setting):

1. Wizard, setting items when there is no default (preexisting items); mix of w/ commas and w/o commas
2. Wizard, replacing existing items when a default exists; mix of w/ commas and w/o commas
3. Wizard, extending the current default list; mix of w/ commas and w/o commas
4. Manual edit, setting items; w/ commas (manually escaped) and w/o commas
5. Wizard, setting items w/o default; no commas

Relevant tests have also been updated/added:

1. Item with comma remains single item:
    - `test_listattribute_with_value_containing_comma`
2. Item with backslash is correctly serialized/parsed:
    - `test_listattribute_with_value_containing_backslash`
    - `test_listattribute_with_value_ending_in_backslash`
HumorBaby added a commit to HumorBaby/sopel that referenced this issue Feb 2, 2019
This is a first step towards completing sopel-irc#1455, since, as @dgw mentioned,
to do so would require accepting commas in a single entry of
`ListAttribute`.

The following tests are now added/updated for "`ListAttribute` items...":

- ... containing comma(s)
- ... with a non-escape backslash
- ... with escape sequences
- ... ending in special characters (escape character and delimiter)
- ... containing adjacent special characters
HumorBaby added a commit to HumorBaby/sopel that referenced this issue Feb 2, 2019
This is a first step towards completing sopel-irc#1455, since, as @dgw mentioned,
to do so would require accepting commas in a single entry of
`ListAttribute`.

The following tests are now added/updated for "`ListAttribute` items...":

- ... containing comma(s)
- ... with a non-escape backslash
- ... with escape sequences
- ... ending in special characters (escape character and delimiter)
- ... containing adjacent special characters
HumorBaby added a commit to HumorBaby/sopel that referenced this issue Mar 30, 2019
Adds a setting in `core` called `perform_commands` based on the updated
`ListAttribute` from sopel-irc#1460. This setting stores a comma separated list
of raw IRC commands (`\`-escaped commas in commands) to execute upon
successful connection to the server. As @dgw put it, "Think ZNC's
perform module, but without the ability to add/remove/rearrange lines
from an IRC query" in sopel-irc#1455.

The commands in the `perform_commands` list are executed at the end of
the `startup` procedure. They can also be called by a bot admin with the
`.execute` command.

Closes sopel-irc#1455
HumorBaby added a commit to HumorBaby/sopel that referenced this issue Apr 10, 2019
Adds a setting in `core` called `perform_commands` based on the updated
`ListAttribute` from sopel-irc#1460. This setting stores a comma separated list
of raw IRC commands (`\`-escaped commas in commands) to execute upon
successful connection to the server. As @dgw put it, "Think ZNC's
perform module, but without the ability to add/remove/rearrange lines
from an IRC query" in sopel-irc#1455.

The commands in the `perform_commands` list are executed at the end of
the `startup` procedure. They can also be called by a bot admin with the
`.execute` command.

Closes sopel-irc#1455
HumorBaby added a commit to HumorBaby/sopel that referenced this issue Aug 28, 2019
Adds a setting in `core` called `commands_on_connect` based on the updated
`ListAttribute` from sopel-irc#1460. This setting stores a comma separated list
of raw IRC commands (`\`-escaped commas in commands) to execute upon
successful connection to the server. As @dgw put it, "Think ZNC's
perform module, but without the ability to add/remove/rearrange lines
from an IRC query" in sopel-irc#1455.

The commands in the `commands_on_connect` list are executed at the end of
the `startup` procedure. They can also be called by a bot admin with the
`.execute` command.

Note: two `TODO`s were added to adjust docstrings and docs once sopel-irc#1628 is
accepted, since it will change the `ListAttribute` delimiter from
commas to newlines.

Closes sopel-irc#1455
@dgw dgw added this to the 7.0.0 milestone Nov 21, 2019
@dgw
Copy link
Member Author

dgw commented Nov 21, 2019

Milestoned to match the implementation, #1528. If the PR is deferred, this should be, too.

Exirel pushed a commit to Exirel/sopel that referenced this issue Dec 9, 2019
Adds a setting in `core` called `commands_on_connect` based on the updated
`ListAttribute` from sopel-irc#1460. This setting stores a comma separated list
of raw IRC commands (`\`-escaped commas in commands) to execute upon
successful connection to the server. As @dgw put it, "Think ZNC's
perform module, but without the ability to add/remove/rearrange lines
from an IRC query" in sopel-irc#1455.

The commands in the `commands_on_connect` list are executed at the end of
the `startup` procedure. They can also be called by a bot admin with the
`.execute` command.

Note: two `TODO`s were added to adjust docstrings and docs once sopel-irc#1628 is
accepted, since it will change the `ListAttribute` delimiter from
commas to newlines.

Closes sopel-irc#1455
@dgw dgw closed this as completed in 9889163 Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant