mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Moved page off, and added search_attempts
This commit is contained in:
parent
b41808ae0f
commit
b22a7c5fda
@ -44,6 +44,7 @@ int process_input(char *inp)
|
||||
{
|
||||
int result = FALSE;
|
||||
|
||||
|
||||
if (strlen(inp) > 0)
|
||||
history_append(inp);
|
||||
|
||||
@ -60,6 +61,8 @@ int process_input(char *inp)
|
||||
}
|
||||
|
||||
inp_clear();
|
||||
reset_search_attempts();
|
||||
win_page_off();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ typedef struct _contact_list_t {
|
||||
} contact_list_t;
|
||||
|
||||
void contact_list_clear(void);
|
||||
void reset_search_attempts(void);
|
||||
int contact_list_add(const char * const name, const char * const show,
|
||||
const char * const status);
|
||||
int contact_list_remove(const char * const name);
|
||||
|
@ -53,7 +53,6 @@ void profanity_run(void)
|
||||
|
||||
inp[size++] = '\0';
|
||||
cmd_result = process_input(inp);
|
||||
win_page_off();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user