ncurses test now tells you when you connect to the DHT.

This commit is contained in:
irungentoo 2013-07-16 19:45:20 -04:00
parent bec416a050
commit ffa809b379
3 changed files with 28 additions and 0 deletions

View File

@ -1017,3 +1017,19 @@ int DHT_load(uint8_t * data, uint32_t size)
}
return 0;
}
//returns 0 if we are not connected to the DHT
//returns 1 if we are
int DHT_isconnected()
{
uint32_t i;
uint32_t temp_time = unix_time();
for(i = 0; i < LCLIENT_LIST; i++)
{
if(close_clientlist[i].timestamp + BAD_NODE_TIMEOUT > temp_time)
{
return 1;
}
}
return 0;
}

View File

@ -86,5 +86,8 @@ void DHT_save(uint8_t * data);
//return 0 if success
int DHT_load(uint8_t * data, uint32_t size);
//returns 0 if we are not connected to the DHT
//returns 1 if we are
int DHT_isconnected();
#endif

View File

@ -169,6 +169,7 @@ int main(int argc, char *argv[])
exit(0);
}
int c;
int on = 0;
initMessenger();
m_callback_friendrequest(print_request);
m_callback_friendmessage(print_message);
@ -219,6 +220,14 @@ int main(int argc, char *argv[])
break;
}
}
if(on == 0)
{
if(DHT_isconnected())
{
new_lines("You are now connected to the DHT.");
on = 1;
}
}
doMessenger();
c_sleep(1);
do_refresh();