1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-26 22:13:26 +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 229d334b75
commit 73cfe94eb2
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; return;
} }
size_t i; for (size_t i = 0; i < TOX_GROUP_CHAT_ID_SIZE; ++i) {
for (i = 0; i < TOX_GROUP_CHAT_ID_SIZE; ++i) {
char xx[3]; char xx[3];
snprintf(xx, sizeof(xx), "%02X", chat_public_key[i] & 0xff); snprintf(xx, sizeof(xx), "%02X", chat_public_key[i] & 0xff);
strcat(chatid, xx); strcat(chatid, xx);
@ -105,6 +103,11 @@ void cmd_ignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
return; 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: { default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to toggle ignore on %s (error %d).", nick, err); line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to toggle ignore on %s (error %d).", nick, err);
return; return;
@ -152,6 +155,11 @@ void cmd_kick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
return; 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: { default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to kick %s from the group (error %d).", nick, line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to kick %s from the group (error %d).", nick,
err); err);
@ -234,6 +242,11 @@ void cmd_mod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
return; 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: { default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to promote peer to moderator (error %d).", err); line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to promote peer to moderator (error %d).", err);
return; return;
@ -287,6 +300,11 @@ void cmd_unmod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
return; 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: { default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to revoke moderator powers from %s (error %d).", nick, line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to revoke moderator powers from %s (error %d).", nick,
err); err);
@ -476,7 +494,7 @@ void cmd_set_topic_lock(WINDOW *window, ToxWindow *self, Tox *m, int argc, char
} }
default: { 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; return;
} }
} }
@ -528,6 +546,11 @@ void cmd_silence(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)
return; 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: { default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to silence %s (error %d).", nick, err); line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to silence %s (error %d).", nick, err);
return; return;
@ -586,6 +609,11 @@ void cmd_unsilence(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
return; 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: { default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to unsilence %s (error %d).", nick, err); line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to unsilence %s (error %d).", nick, err);
return; return;
@ -656,6 +684,11 @@ void cmd_set_topic(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
return; 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: { default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to set the topic (error %d).", err); line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to set the topic (error %d).", err);
return; return;
@ -699,6 +732,11 @@ void cmd_unignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
return; 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: { default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to toggle ignore on %s (error %d).", nick, err); line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to toggle ignore on %s (error %d).", nick, err);
return; return;