summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorJfreegman <Jfreegman@gmail.com>2013-08-01 15:27:08 -0400
committerJfreegman <Jfreegman@gmail.com>2013-08-01 15:27:08 -0400
commit8abc0a346209512901254f981dab62c67a632f4a (patch)
treefaf445c6c9f4f8596d56118a335e0d1858a6957b /testing
parenta604de901702eabcdc73507025e77e34db6a9266 (diff)
added error code for no message on friend add & updated nTox.c/nTox_win32.c
Diffstat (limited to 'testing')
-rw-r--r--testing/nTox.c34
-rw-r--r--testing/nTox_win32.c10
-rw-r--r--testing/toxic/prompt.c8
3 files changed, 30 insertions, 22 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index 17f4b0e7..f7d929f2 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -106,24 +106,28 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line)
106 char temp_id[128]; 106 char temp_id[128];
107 for (i = 0; i < 128; i++) 107 for (i = 0; i < 128; i++)
108 temp_id[i] = line[i+prompt_offset]; 108 temp_id[i] = line[i+prompt_offset];
109
109 int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo")); 110 int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo"));
110 char numstring[100]; 111 char numstring[100];
111 switch (num) { 112 switch (num) {
112 case -1: 113 case -1:
113 sprintf(numstring, "[i] Incorrect key length"); 114 sprintf(numstring, "[i] Message is too long.");
114 break; 115 break;
115 case -2: 116 case -2:
116 sprintf(numstring, "[i] That appears to be your own key"); 117 sprintf(numstring, "[i] Please add a message to your request.");
117 break; 118 break;
118 case -3: 119 case -3:
119 sprintf(numstring, "[i] Friend request already sent"); 120 sprintf(numstring, "[i] That appears to be your own ID.");
120 break; 121 break;
121 case -4: 122 case -4:
122 sprintf(numstring, "[i] Could not add friend"); 123 sprintf(numstring, "[i] Friend request already sent.");
123 break; 124 break;
124 default: 125 case -5:
125 sprintf(numstring, "[i] Added friend %d", num); 126 sprintf(numstring, "[i] Undefined error when adding friend.");
126 break; 127 break;
128 default:
129 sprintf(numstring, "[i] Added friend as %d.", num);
130 break;
127 } 131 }
128 new_lines(numstring); 132 new_lines(numstring);
129 do_refresh(); 133 do_refresh();
diff --git a/testing/nTox_win32.c b/testing/nTox_win32.c
index b9208d4f..8d9f3547 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 6970441f..21c1f52a 100644
--- a/testing/toxic/prompt.c
+++ b/testing/toxic/prompt.c
@@ -138,13 +138,15 @@ static void execute(ToxWindow* self, char* cmd) {
138 wprintw(self->window, "Message is too long.\n"); 138 wprintw(self->window, "Message is too long.\n");
139 break; 139 break;
140 case -2: 140 case -2:
141 wprintw(self->window, "Please add a message to your request.\n");
142 case -3:
141 wprintw(self->window, "That appears to be your own ID.\n"); 143 wprintw(self->window, "That appears to be your own ID.\n");
142 break; 144 break;
143 case -3: 145 case -4:
144 wprintw(self->window, "Friend request already sent.\n"); 146 wprintw(self->window, "Friend request already sent.\n");
145 break; 147 break;
146 case -4: 148 case -5:
147 wprintw(self->window, "Invalid ID.\n"); 149 wprintw(self->window, "[i] Undefined error when adding friend.\n");
148 break; 150 break;
149 default: 151 default:
150 wprintw(self->window, "Friend added as %d.\n", num); 152 wprintw(self->window, "Friend added as %d.\n", num);