summaryrefslogtreecommitdiff
path: root/testing/nTox.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-07-31 15:06:40 -0700
committerirungentoo <irungentoo@gmail.com>2013-07-31 15:06:40 -0700
commitb81dc5508c7f5250a8c7fb8a934a86f9ef6217e5 (patch)
tree43b93f959924737d053b307b8561c65a9d604729 /testing/nTox.c
parentc558cb63f6db35bd51f2f2331e21df03105ee82a (diff)
parent52ddf5ec4372298fe794eeaff039ab365e1530ae (diff)
Merge pull request #219 from JFreegman/master
Partially fixed friend add bug
Diffstat (limited to 'testing/nTox.c')
-rw-r--r--testing/nTox.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index 7c84871f..17f4b0e7 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -97,17 +97,34 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line)
97{ 97{
98 if (line[0] == '/') { 98 if (line[0] == '/') {
99 char inpt_command = line[1]; 99 char inpt_command = line[1];
100 char prompt[STRING_LENGTH + 2] = "> "; 100 char prompt[STRING_LENGTH+2] = "> ";
101 int prompt_offset = 3;
101 strcat(prompt, line); 102 strcat(prompt, line);
102 new_lines(prompt); 103 new_lines(prompt);
103 if (inpt_command == 'f') { // add friend command: /f ID 104 if (inpt_command == 'f') { // add friend command: /f ID
104 int i; 105 int i;
105 char temp_id[128]; 106 char temp_id[128];
106 for (i = 0; i < 128; i++) 107 for (i = 0; i < 128; i++)
107 temp_id[i] = line[i+3]; 108 temp_id[i] = line[i+prompt_offset];
108 int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo")); 109 int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo"));
109 char numstring[100]; 110 char numstring[100];
110 sprintf(numstring, "[i] added friend %d", num); 111 switch (num) {
112 case -1:
113 sprintf(numstring, "[i] Incorrect key length");
114 break;
115 case -2:
116 sprintf(numstring, "[i] That appears to be your own key");
117 break;
118 case -3:
119 sprintf(numstring, "[i] Friend request already sent");
120 break;
121 case -4:
122 sprintf(numstring, "[i] Could not add friend");
123 break;
124 default:
125 sprintf(numstring, "[i] Added friend %d", num);
126 break;
127 }
111 new_lines(numstring); 128 new_lines(numstring);
112 do_refresh(); 129 do_refresh();
113 } 130 }