summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
...
* deprecate `std/threadpool`; use `malebolgia`, `weave`, `nim-taskpool` instead...ringabout2023-08-292-1/+3
* clearer error for different size int/float cast in VM (#22582)metagn2023-08-292-3/+14
* fixes #22555; implements `newStringUninit` (#22572)ringabout2023-08-293-22/+49
* fixes broken nightlies; follow up #22544 (#22585)ringabout2023-08-291-1/+1
* minor style changes in the compiler (#22584)ringabout2023-08-291-3/+2
* properly fold constants for dynlib pragma (#22575)metagn2023-08-281-1/+1
* correct logic for qualified symbol in templates (#22577)metagn2023-08-282-1/+8
* define toList procs after add for lists [backport] (#22573)metagn2023-08-281-22/+22
* newStringOfCap now won't initialize all elements anymore (#22568)ringabout2023-08-281-2/+3
* `initCandidate` and friends now return values (#22570)ringabout2023-08-283-42/+32
* add test case for #19095 (#22566)Bung2023-08-281-0/+35
* close #9334 (#22565)Bung2023-08-271-0/+19
* fix #22548;environment misses for type reference in iterator access n… (#22...Bung2023-08-273-5/+62
* test case haul for old generic/template/macro issues (#22564)metagn2023-08-279-34/+248
* Improve compiler cli args (#22509)Juan Carlos2023-08-251-4/+10
* fix generic param substitution in templates (#22535)metagn2023-08-253-2/+93
* follow up #22549 (#22551)ringabout2023-08-254-4/+7
* Add `cursor` to lists iterator variables (#22531)Amjad Ben Hedhili2023-08-241-3/+3
* fixes a strictdef ten years long vintage bug, which counts the same thing twi...ringabout2023-08-243-10/+23
* Fix `getAppFilename` exception handling (#22544)Jacek Sieka2023-08-241-5/+10
* fixes #22541; peg matchLen can raise an unlisted exception: Exception (#22545)ringabout2023-08-241-1/+1
* round out tuple unpacking assignment, support underscores (#22537)metagn2023-08-247-33/+60
* make jsffi properly gensym (#22539)metagn2023-08-232-22/+35
* don't render underscore identifiers with id (#22538)metagn2023-08-231-3/+5
* Fix #21532: Check if template return is untyped (#22517)SirOlaf2023-08-232-0/+11
* allow tuples and procs in 'toTask' + minor things (#22530)Andreas Rumpf2023-08-222-3/+3
* fix #22492 (#22511)Hamid Bluri2023-08-2211-20/+22
* allow non-pragma special words as user pragmas (#22526)metagn2023-08-213-11/+29
* fix getNullValue for cstring in VM, make other VM code aware of nil cstring (...metagn2023-08-214-6/+53
* use old typeinfo generation for hot code reloading (#22518)metagn2023-08-203-3/+7
* Fix #21722 (#22512)SirOlaf2023-08-191-6/+8
* #22514 expand testament option docs (#22516)PhilippMDoerner2023-08-191-6/+55
* Markdown code blocks migration part 9 (#22506)Amjad Ben Hedhili2023-08-196-91/+91
* replace getOpt with getopt (#22515)Nan Xiao2023-08-196-6/+6
* Remove Deprecated Babel (#22507)Juan Carlos2023-08-191-4/+2
* Fix #22366 by making nimlf_/nimln_ part of the same line (#22503)Alberto Torres2023-08-181-2/+2
* Add staticFileExists and staticDirExists (#22278)Tomohiro2023-08-184-0/+27
* make float32 literals stringifying behave in JS the same as in C (#22500)ringabout2023-08-172-5/+9
* cascade tyFromExpr in type conversions in generic bodies (#22499)metagn2023-08-172-5/+15
* bump checksums (#22497)ringabout2023-08-171-1/+1
* fixes syncio document (#22498)Nan Xiao2023-08-171-2/+2
* fixes #22441; build documentation for more modules in the checksums (#22453)ringabout2023-08-171-0/+3
* close #22748; cursorinference + -d:nimNoLentIterators results in err… (#22495)ringabout2023-08-171-0/+46
* updates manual with codegenDecl on params docs (#22333)Juan M Gómez2023-08-171-3/+2
* Fix `seq.capacity` (#22488)Amjad Ben Hedhili2023-08-171-2/+2
* fixes #22357; don't sink elements of var tuple cursors (#22486)ringabout2023-08-161-1/+3
* fixes #22481; fixes `card` undefined misalignment behavior (#22484)ringabout2023-08-151-1/+3
* When in object handles procedure call again, fixes #22474 (#22480)Jason Beetham2023-08-152-1/+33
* update test command of important packages (#22485)ringabout2023-08-151-6/+6
* Markdown code blocks migration part 8 (#22478)Andrey Makarov2023-08-1546-630/+726
mes Booth <boothj5@gmail.com> 2012-03-08 00:46:24 +0000 Added basic online list' href='/danisanti/profani-tty/commit/contact_list.c?id=78bd151c486626f79ea7dcb9189591d121e822b6'>78bd151c ^
7a9d127a ^
279737ba ^

f23f768d ^
b02b52d8 ^
b1bf0540 ^
e486114e ^















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90





















                                                                       

                   
                    
                              
 
                        
 

                       
 
                                                          
                                                      
                                                                  
                                                            
 
 

                        
 
                             

 

                           
 
                             

 

                                            
 
                                           
 
 

                                                                   
                              
 
                                                                     

 

                      
 
                                       
 
 

                              
 
                                                   
 















                                                        
/* 
 * contact_list.c
 *
 * Copyright (C) 2012 James Booth <boothj5@gmail.com>
 * 
 * This file is part of Profanity.
 *
 * Profanity is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Profanity is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Profanity.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include <string.h>

#include "contact.h"
#include "prof_autocomplete.h"

static PAutocomplete ac;

void
contact_list_init(void)
{
    ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, 
                            (PCopyFunc)p_contact_copy,
                            (PEqualDeepFunc)p_contacts_equal_deep,
                            (GDestroyNotify)p_contact_free);
}

void
contact_list_clear(void)
{
    p_autocomplete_clear(ac);
}

void
reset_search_attempts(void)
{
    p_autocomplete_reset(ac);
}

gboolean
contact_list_remove(const char * const name)
{
    return p_autocomplete_remove(ac, name);
}

gboolean
contact_list_add(const char * const name, const char * const show, 
    const char * const status)
{
    return p_autocomplete_add(ac, p_contact_new(name, show, status));
}

GSList *
get_contact_list(void)
{
    return p_autocomplete_get_list(ac);
}

char *
find_contact(char *search_str)
{
    return p_autocomplete_complete(ac, search_str);
}

PContact
contact_list_get_contact(const char const *jid)
{
    GSList *contacts = get_contact_list();
    
    while (contacts != NULL) {
        PContact contact = contacts->data;
        if (strcmp(p_contact_name(contact), jid) == 0) {
            return contact;
        }
        contacts = g_slist_next(contacts);
    }

    return NULL;
}