Changeset 7ed9bc6
- Timestamp:
- Jun 25, 2011, 3:26:15 AM (13 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- eb897c6
- Parents:
- d191f45
- git-author:
- David Benjamin <davidben@mit.edu> (03/11/11 11:15:00)
- git-committer:
- David Benjamin <davidben@mit.edu> (06/25/11 03:26:15)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
owl.h
rd191f45 r7ed9bc6 512 512 513 513 typedef struct _owl_zbuddylist { 514 owl_listzusers;514 GPtrArray *zusers; 515 515 } owl_zbuddylist; 516 516 -
zbuddylist.c
rddbbcffa r7ed9bc6 3 3 void owl_zbuddylist_create(owl_zbuddylist *zb) 4 4 { 5 owl_list_create(&(zb->zusers));5 zb->zusers = g_ptr_array_new(); 6 6 } 7 7 8 8 int owl_zbuddylist_adduser(owl_zbuddylist *zb, const char *name) 9 9 { 10 int i , j;10 int i; 11 11 char *user; 12 12 13 13 user=long_zuser(name); 14 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))) { 15 for (i = 0; i < zb->zusers->len; i++) { 16 if (!strcasecmp(user, zb->zusers->pdata[i])) { 18 17 g_free(user); 19 18 return(-1); 20 19 } 21 20 } 22 owl_list_append_element(&(zb->zusers), user);21 g_ptr_array_add(zb->zusers, user); 23 22 return(0); 24 23 } … … 26 25 int owl_zbuddylist_deluser(owl_zbuddylist *zb, const char *name) 27 26 { 28 int i , j;29 char *user , *ptr;27 int i; 28 char *user; 30 29 31 30 user=long_zuser(name); 32 31 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); 38 g_free(ptr); 32 for (i = 0; i < zb->zusers->len; i++) { 33 if (!strcasecmp(user, zb->zusers->pdata[i])) { 34 g_free(g_ptr_array_remove_index(zb->zusers, i)); 39 35 g_free(user); 40 36 return(0); … … 47 43 int owl_zbuddylist_contains_user(const owl_zbuddylist *zb, const char *name) 48 44 { 49 int i , j;45 int i; 50 46 char *user; 51 47 52 48 user=long_zuser(name); 53 49 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))) { 50 for (i = 0; i < zb->zusers->len; i++) { 51 if (!strcasecmp(user, zb->zusers->pdata[i])) { 57 52 g_free(user); 58 53 return(1);
Note: See TracChangeset
for help on using the changeset viewer.