mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-28 13:46:21 +00:00
Moved page off, and added search_attempts
This commit is contained in:
@@ -35,6 +35,9 @@ struct _contact_node_t {
|
||||
// the contact list
|
||||
static struct _contact_node_t *_contact_list = NULL;
|
||||
|
||||
// number of tabs pressed whilst searching
|
||||
static int _search_attempts = 0;
|
||||
|
||||
static struct _contact_node_t * _make_contact_node(const char * const name,
|
||||
const char * const show, const char * const status);
|
||||
static contact_t * _new_contact(const char * const name, const char * const show,
|
||||
@@ -57,6 +60,11 @@ void contact_list_clear(void)
|
||||
}
|
||||
}
|
||||
|
||||
void reset_search_attempts(void)
|
||||
{
|
||||
_search_attempts = 0;
|
||||
}
|
||||
|
||||
int contact_list_remove(const char * const name)
|
||||
{
|
||||
if (!_contact_list) {
|
||||
@@ -173,9 +181,13 @@ char * find_contact(const char * const search_str)
|
||||
} else {
|
||||
while(curr) {
|
||||
contact_t *curr_contact = curr->contact;
|
||||
|
||||
// match found
|
||||
if (strncmp(curr_contact->name, search_str, strlen(search_str)) == 0) {
|
||||
char *result =
|
||||
(char *) malloc((strlen(curr_contact->name) + 1) * sizeof(char));
|
||||
|
||||
// return the contact, must be free'd by caller
|
||||
strcpy(result, curr_contact->name);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user