1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-29 11:56:44 +02:00

make friend add fail if friend is in the block list

This commit is contained in:
jfreegman
2019-11-16 01:55:47 -05:00
parent 4b5a9abbd4
commit 127f9462e0
3 changed files with 33 additions and 1 deletions

View File

@ -133,7 +133,7 @@ void cmd_add_helper(ToxWindow *self, Tox *m, const char *id_bin, const char *msg
/* fallthrough */
default:
errmsg = "Faile to add friend: Unknown error.";
errmsg = "Failed to add friend: Unknown error.";
break;
}
@ -193,6 +193,11 @@ void cmd_add(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
id_bin[i] = x;
}
if (friend_is_blocked(id_bin)) {
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Friend is in your block list.");
return;
}
cmd_add_helper(self, m, id_bin, msg);
} else { /* assume id is a username@domain address and do http name server lookup */
name_lookup(self, m, id_bin, id, msg);