diff options
author | irungentoo <irungentoo@gmail.com> | 2013-08-01 17:38:29 -0700 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-08-01 17:38:29 -0700 |
commit | af8e84345171538e70e2e3562e1c51da32e306df (patch) | |
tree | bf683baa454e74241ead3f319105e3490c965481 /testing | |
parent | 276e3f9271241839083bfa22a4ba422c4b28785d (diff) | |
parent | 8abc0a346209512901254f981dab62c67a632f4a (diff) |
Merge pull request #229 from JFreegman/master
fixed friend add bugs and gave no message its own error
Diffstat (limited to 'testing')
-rw-r--r-- | testing/nTox.c | 34 | ||||
-rw-r--r-- | testing/nTox_win32.c | 10 | ||||
-rw-r--r-- | testing/toxic/prompt.c | 24 |
3 files changed, 46 insertions, 22 deletions
diff --git a/testing/nTox.c b/testing/nTox.c index 34d74d5a..81cac0b6 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -111,24 +111,28 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) | |||
111 | char temp_id[128]; | 111 | char temp_id[128]; |
112 | for (i = 0; i < 128; i++) | 112 | for (i = 0; i < 128; i++) |
113 | temp_id[i] = line[i+prompt_offset]; | 113 | temp_id[i] = line[i+prompt_offset]; |
114 | |||
114 | int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo")); | 115 | int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo")); |
115 | char numstring[100]; | 116 | char numstring[100]; |
116 | switch (num) { | 117 | switch (num) { |
117 | case -1: | 118 | case -1: |
118 | sprintf(numstring, "[i] Incorrect key length"); | 119 | sprintf(numstring, "[i] Message is too long."); |
119 | break; | 120 | break; |
120 | case -2: | 121 | case -2: |
121 | sprintf(numstring, "[i] That appears to be your own key"); | 122 | sprintf(numstring, "[i] Please add a message to your request."); |
122 | break; | 123 | break; |
123 | case -3: | 124 | case -3: |
124 | sprintf(numstring, "[i] Friend request already sent"); | 125 | sprintf(numstring, "[i] That appears to be your own ID."); |
125 | break; | 126 | break; |
126 | case -4: | 127 | case -4: |
127 | sprintf(numstring, "[i] Could not add friend"); | 128 | sprintf(numstring, "[i] Friend request already sent."); |
128 | break; | 129 | break; |
129 | default: | 130 | case -5: |
130 | sprintf(numstring, "[i] Added friend %d", num); | 131 | sprintf(numstring, "[i] Undefined error when adding friend."); |
131 | break; | 132 | break; |
133 | default: | ||
134 | sprintf(numstring, "[i] Added friend as %d.", num); | ||
135 | break; | ||
132 | } | 136 | } |
133 | new_lines(numstring); | 137 | new_lines(numstring); |
134 | do_refresh(); | 138 | do_refresh(); |
diff --git a/testing/nTox_win32.c b/testing/nTox_win32.c index 2394877f..42780923 100644 --- a/testing/nTox_win32.c +++ b/testing/nTox_win32.c | |||
@@ -132,13 +132,15 @@ void line_eval(char* line) | |||
132 | printf(numstring); | 132 | printf(numstring); |
133 | } | 133 | } |
134 | else if (num == -1) | 134 | else if (num == -1) |
135 | printf("\nWrong key size\n\n"); | 135 | printf("\n[i] Message is too long.\n\n"); |
136 | else if (num == -2) | 136 | else if (num == -2) |
137 | printf("\nYou can't add yourself\n\n"); | 137 | printf("\n[i] Please add a message to your friend request.\n\n"); |
138 | else if (num == -3) | 138 | else if (num == -3) |
139 | printf("\nYou already have this person added\n\n"); | 139 | printf("\n[i] That appears to be your own ID.\n\n"); |
140 | else if (num == -4) | 140 | else if (num == -4) |
141 | printf("\nUndefined error when adding friend"); | 141 | printf("\n[i] Friend request already sent.\n\n"); |
142 | else if (num == -5) | ||
143 | printf("\n[i] Undefined error when adding friend\n\n"); | ||
142 | } | 144 | } |
143 | 145 | ||
144 | else if (inpt_command == 'r') { | 146 | else if (inpt_command == 'r') { |
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index a3cf2d94..b0f83811 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -134,10 +134,28 @@ static void execute(ToxWindow* self, char* cmd) { | |||
134 | } | 134 | } |
135 | 135 | ||
136 | num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1); | 136 | num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1); |
137 | 137 | switch (num) { | |
138 | wprintw(self->window, "Friend added as %d.\n", num); | 138 | case -1: |
139 | on_friendadded(num); | 139 | wprintw(self->window, "Message is too long.\n"); |
140 | break; | ||
141 | case -2: | ||
142 | wprintw(self->window, "Please add a message to your request.\n"); | ||
143 | case -3: | ||
144 | wprintw(self->window, "That appears to be your own ID.\n"); | ||
145 | break; | ||
146 | case -4: | ||
147 | wprintw(self->window, "Friend request already sent.\n"); | ||
148 | break; | ||
149 | case -5: | ||
150 | wprintw(self->window, "[i] Undefined error when adding friend.\n"); | ||
151 | break; | ||
152 | default: | ||
153 | wprintw(self->window, "Friend added as %d.\n", num); | ||
154 | on_friendadded(num); | ||
155 | break; | ||
156 | } | ||
140 | } | 157 | } |
158 | |||
141 | else if(!strcmp(cmd, "help")) { | 159 | else if(!strcmp(cmd, "help")) { |
142 | print_usage(self); | 160 | print_usage(self); |
143 | } | 161 | } |