release-1.10release-1.8release-1.9
Last change
on this file since 42ee1be was
ddbbcffa,
checked in by Anders Kaseorg <andersk@mit.edu>, 14 years ago
|
Replace owl_free with g_free.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Karl Ramm <kcr@mit.edu>
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[dad943e] | 1 | #include "owl.h" |
---|
| 2 | |
---|
| 3 | void owl_zbuddylist_create(owl_zbuddylist *zb) |
---|
| 4 | { |
---|
| 5 | owl_list_create(&(zb->zusers)); |
---|
| 6 | } |
---|
| 7 | |
---|
[e19eb97] | 8 | int owl_zbuddylist_adduser(owl_zbuddylist *zb, const char *name) |
---|
[dad943e] | 9 | { |
---|
| 10 | int i, j; |
---|
| 11 | char *user; |
---|
| 12 | |
---|
| 13 | user=long_zuser(name); |
---|
| 14 | |
---|
| 15 | j=owl_list_get_size(&(zb->zusers)); |
---|
| 16 | for (i=0; i<j; i++) { |
---|
| 17 | if (!strcasecmp(user, owl_list_get_element(&(zb->zusers), i))) { |
---|
[ddbbcffa] | 18 | g_free(user); |
---|
[dad943e] | 19 | return(-1); |
---|
| 20 | } |
---|
| 21 | } |
---|
| 22 | owl_list_append_element(&(zb->zusers), user); |
---|
| 23 | return(0); |
---|
| 24 | } |
---|
| 25 | |
---|
[e19eb97] | 26 | int owl_zbuddylist_deluser(owl_zbuddylist *zb, const char *name) |
---|
[dad943e] | 27 | { |
---|
| 28 | int i, j; |
---|
| 29 | char *user, *ptr; |
---|
| 30 | |
---|
| 31 | user=long_zuser(name); |
---|
| 32 | |
---|
| 33 | j=owl_list_get_size(&(zb->zusers)); |
---|
| 34 | for (i=0; i<j; i++) { |
---|
| 35 | ptr=owl_list_get_element(&(zb->zusers), i); |
---|
| 36 | if (!strcasecmp(user, ptr)) { |
---|
| 37 | owl_list_remove_element(&(zb->zusers), i); |
---|
[ddbbcffa] | 38 | g_free(ptr); |
---|
| 39 | g_free(user); |
---|
[dad943e] | 40 | return(0); |
---|
| 41 | } |
---|
| 42 | } |
---|
[ddbbcffa] | 43 | g_free(user); |
---|
[dad943e] | 44 | return(-1); |
---|
| 45 | } |
---|
| 46 | |
---|
[b258c51] | 47 | int owl_zbuddylist_contains_user(const owl_zbuddylist *zb, const char *name) |
---|
[dad943e] | 48 | { |
---|
| 49 | int i, j; |
---|
| 50 | char *user; |
---|
| 51 | |
---|
| 52 | user=long_zuser(name); |
---|
| 53 | |
---|
| 54 | j=owl_list_get_size(&(zb->zusers)); |
---|
| 55 | for (i=0; i<j; i++) { |
---|
| 56 | if (!strcasecmp(user, owl_list_get_element(&(zb->zusers), i))) { |
---|
[ddbbcffa] | 57 | g_free(user); |
---|
[dad943e] | 58 | return(1); |
---|
| 59 | } |
---|
| 60 | } |
---|
[ddbbcffa] | 61 | g_free(user); |
---|
[dad943e] | 62 | return(0); |
---|
| 63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.