1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 04:03:02 +01:00

Add more descriptive errors to some moderation commands

This commit is contained in:
jfreegman 2021-12-20 14:05:05 -05:00
parent 2ef3d68173
commit 3ff3516e42
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -44,9 +44,7 @@ void cmd_chatid(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
return;
}
size_t i;
for (i = 0; i < TOX_GROUP_CHAT_ID_SIZE; ++i) {
for (size_t i = 0; i < TOX_GROUP_CHAT_ID_SIZE; ++i) {
char xx[3];
snprintf(xx, sizeof(xx), "%02X", chat_public_key[i] & 0xff);
strcat(chatid, xx);
@ -105,6 +103,11 @@ void cmd_ignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
return;
}
case TOX_ERR_GROUP_TOGGLE_IGNORE_PEER_NOT_FOUND: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "The specified nick or public key is invalid.");
return;
}
default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to toggle ignore on %s (error %d).", nick, err);
return;
@ -152,6 +155,11 @@ void cmd_kick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
return;
}
case TOX_ERR_GROUP_MOD_KICK_PEER_PEER_NOT_FOUND: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Specified nick or public key is invalid.");
return;
}
default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to kick %s from the group (error %d).", nick,
err);
@ -234,6 +242,11 @@ void cmd_mod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
return;
}
case TOX_ERR_GROUP_MOD_SET_ROLE_PEER_NOT_FOUND: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "The specified nick or public key is invalid.");
return;
}
default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to promote peer to moderator (error %d).", err);
return;
@ -287,6 +300,11 @@ void cmd_unmod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
return;
}
case TOX_ERR_GROUP_MOD_SET_ROLE_PEER_NOT_FOUND: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "The specified nick or public key is invalid.");
return;
}
default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to revoke moderator powers from %s (error %d).", nick,
err);
@ -476,7 +494,7 @@ void cmd_set_topic_lock(WINDOW *window, ToxWindow *self, Tox *m, int argc, char
}
default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Error setting topic lock (error %d).", err);
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Error setting topic lock (%d).", err);
return;
}
}
@ -528,6 +546,11 @@ void cmd_silence(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)
return;
}
case TOX_ERR_GROUP_MOD_SET_ROLE_PEER_NOT_FOUND: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "The specified nick or public key is invalid.");
return;
}
default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to silence %s (error %d).", nick, err);
return;
@ -586,6 +609,11 @@ void cmd_unsilence(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
return;
}
case TOX_ERR_GROUP_MOD_SET_ROLE_PEER_NOT_FOUND: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "The specified nick or public key is invalid.");
return;
}
default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to unsilence %s (error %d).", nick, err);
return;
@ -656,6 +684,11 @@ void cmd_set_topic(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
return;
}
case TOX_ERR_GROUP_TOPIC_SET_DISCONNECTED: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "You are disconnected from the group.");
return;
}
default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to set the topic (error %d).", err);
return;
@ -699,6 +732,11 @@ void cmd_unignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
return;
}
case TOX_ERR_GROUP_TOGGLE_IGNORE_PEER_NOT_FOUND: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "The specified nick or public key is invalid.");
return;
}
default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to toggle ignore on %s (error %d).", nick, err);
return;