diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-21 14:37:31 -0700 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-21 14:37:31 -0700 |
commit | c211e361d29dbbb941a5aeb0c99fb4f30b76ca8f (patch) | |
tree | 064cbaf7c70cf729669c5fcdfa6ec5c99de78858 | |
parent | 8563b0b3b31486321d385733a3e9027be797a0ce (diff) | |
parent | 7863a552aab350202eb110bb7f319a210f085185 (diff) |
Merge pull request #76 from notadecent/master
Updated nTox.c (added timestamp)
-rw-r--r-- | testing/nTox.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/testing/nTox.c b/testing/nTox.c index ccb11a71..693e64aa 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -1,4 +1,6 @@ | |||
1 | #include "nTox.h" | 1 | #include "nTox.h" |
2 | #include <stdio.h> | ||
3 | #include <time.h> | ||
2 | 4 | ||
3 | #ifdef WIN32 | 5 | #ifdef WIN32 |
4 | #define c_sleep(x) Sleep(1*x) | 6 | #define c_sleep(x) Sleep(1*x) |
@@ -168,12 +170,12 @@ void do_refresh() | |||
168 | } | 170 | } |
169 | void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) | 171 | void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) |
170 | { | 172 | { |
171 | new_lines("Friend request"); | 173 | new_lines("[i] received friend request"); |
172 | do_refresh(); | 174 | do_refresh(); |
173 | if(memcmp(data , "Install Gentoo", sizeof("Install Gentoo")) == 0 ) | 175 | if(memcmp(data , "Install Gentoo", sizeof("Install Gentoo")) == 0 ) |
174 | //if the request contained the message of peace the person is obviously a friend so we add him. | 176 | //if the request contained the message of peace the person is obviously a friend so we add him. |
175 | { | 177 | { |
176 | new_lines("[i] friend request accepted."); | 178 | new_lines("[i] friend request accepted"); |
177 | do_refresh(); | 179 | do_refresh(); |
178 | int num = m_addfriend_norequest(public_key); | 180 | int num = m_addfriend_norequest(public_key); |
179 | char numchar[100]; | 181 | char numchar[100]; |
@@ -186,7 +188,11 @@ void print_message(int friendnumber, uint8_t * string, uint16_t length) | |||
186 | char *name = malloc(MAX_NAME_LENGTH); | 188 | char *name = malloc(MAX_NAME_LENGTH); |
187 | getname(friendnumber, (uint8_t*)name); | 189 | getname(friendnumber, (uint8_t*)name); |
188 | char msg[100+length+strlen(name)+1]; | 190 | char msg[100+length+strlen(name)+1]; |
189 | sprintf(msg, "[%d] <%s> %s", friendnumber, name, string); | 191 | time_t rawtime; |
192 | struct tm * timeinfo; | ||
193 | time ( &rawtime ); | ||
194 | timeinfo = localtime ( &rawtime ); | ||
195 | sprintf(msg, "[%d] %s <%s> %s", friendnumber, asctime (timeinfo), name, string); // someone please fix this | ||
190 | free(name); | 196 | free(name); |
191 | new_lines(msg); | 197 | new_lines(msg); |
192 | } | 198 | } |