mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-05-17 13:11:00 +00:00
Compare commits
3 Commits
daef4d1cf8
...
7742e411e8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7742e411e8 | ||
|
|
7d89375d3a | ||
|
|
db0f660d08 |
@ -443,6 +443,7 @@ By default, recipients can select multiple options.
|
|||||||
*-o* OPTION [OPTION ...], *--option* OPTION [OPTION ...]*::
|
*-o* OPTION [OPTION ...], *--option* OPTION [OPTION ...]*::
|
||||||
The options for the poll.
|
The options for the poll.
|
||||||
Between 2 and 10 options must be specified.
|
Between 2 and 10 options must be specified.
|
||||||
|
Each option must be between 1 and 100 characters.
|
||||||
|
|
||||||
=== sendPollVote
|
=== sendPollVote
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ public class SendPollCreateCommand implements JsonRpcLocalCommand {
|
|||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SendPollCreateCommand.class);
|
private static final Logger logger = LoggerFactory.getLogger(SendPollCreateCommand.class);
|
||||||
private static final int MAX_POLL_OPTIONS = 10;
|
private static final int MAX_POLL_OPTIONS = 10;
|
||||||
|
private static final int MAX_POLL_OPTION_LENGTH = 100;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -76,6 +77,14 @@ public class SendPollCreateCommand implements JsonRpcLocalCommand {
|
|||||||
if (options.size() > MAX_POLL_OPTIONS) {
|
if (options.size() > MAX_POLL_OPTIONS) {
|
||||||
throw new UserErrorException("Poll cannot have more than " + MAX_POLL_OPTIONS + " options");
|
throw new UserErrorException("Poll cannot have more than " + MAX_POLL_OPTIONS + " options");
|
||||||
}
|
}
|
||||||
|
for (final var option : options) {
|
||||||
|
if (option.isEmpty()) {
|
||||||
|
throw new UserErrorException("Poll options must not be empty");
|
||||||
|
}
|
||||||
|
if (option.length() > MAX_POLL_OPTION_LENGTH) {
|
||||||
|
throw new UserErrorException("Poll option \"" + option + "\" exceeds the maximum length of " + MAX_POLL_OPTION_LENGTH + " characters");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var results = m.sendPollCreateMessage(question, !noMulti, options, recipientIdentifiers, notifySelf);
|
var results = m.sendPollCreateMessage(question, !noMulti, options, recipientIdentifiers, notifySelf);
|
||||||
|
|||||||
@ -2397,6 +2397,10 @@
|
|||||||
"name": "internal",
|
"name": "internal",
|
||||||
"parameterTypes": []
|
"parameterTypes": []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "isArchived",
|
||||||
|
"parameterTypes": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "isBlocked",
|
"name": "isBlocked",
|
||||||
"parameterTypes": []
|
"parameterTypes": []
|
||||||
@ -9807,4 +9811,4 @@
|
|||||||
"bundle": "net.sourceforge.argparse4j.internal.ArgumentParserImpl"
|
"bundle": "net.sourceforge.argparse4j.internal.ArgumentParserImpl"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user