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