diff options
author | Jfreegman <Jfreegman@gmail.com> | 2013-07-31 21:44:57 -0400 |
---|---|---|
committer | Jfreegman <Jfreegman@gmail.com> | 2013-07-31 21:44:57 -0400 |
commit | a604de901702eabcdc73507025e77e34db6a9266 (patch) | |
tree | 758f657a0817643a434870d717e7f7bae0d5b1c8 /testing/toxic | |
parent | d8867b95c5923802cc6957599c8909ce0e55805a (diff) |
fixed friend add bugs
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/prompt.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index e18bdff0..6970441f 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -133,10 +133,26 @@ static void execute(ToxWindow* self, char* cmd) { | |||
133 | } | 133 | } |
134 | 134 | ||
135 | num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1); | 135 | num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1); |
136 | 136 | switch (num) { | |
137 | wprintw(self->window, "Friend added as %d.\n", num); | 137 | case -1: |
138 | on_friendadded(num); | 138 | wprintw(self->window, "Message is too long.\n"); |
139 | break; | ||
140 | case -2: | ||
141 | wprintw(self->window, "That appears to be your own ID.\n"); | ||
142 | break; | ||
143 | case -3: | ||
144 | wprintw(self->window, "Friend request already sent.\n"); | ||
145 | break; | ||
146 | case -4: | ||
147 | wprintw(self->window, "Invalid ID.\n"); | ||
148 | break; | ||
149 | default: | ||
150 | wprintw(self->window, "Friend added as %d.\n", num); | ||
151 | on_friendadded(num); | ||
152 | break; | ||
153 | } | ||
139 | } | 154 | } |
155 | |||
140 | else if(!strcmp(cmd, "help")) { | 156 | else if(!strcmp(cmd, "help")) { |
141 | wattron(self->window, COLOR_PAIR(2) | A_BOLD); | 157 | wattron(self->window, COLOR_PAIR(2) | A_BOLD); |
142 | wprintw(self->window, "Commands:\n"); | 158 | wprintw(self->window, "Commands:\n"); |