- Timestamp:
- 2010-05-09T18:05:55Z (15 years ago)
- Branches:
- master
- Children:
- 3130e70
- Parents:
- 9ac3ed1
- Location:
- protocols
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/bee.c
r9ac3ed1 r7aadd71 72 72 set_del( &b->set, b->set->key ); 73 73 74 bee_group_free( b ); 75 74 76 g_free( b->user ); 75 77 g_free( b ); -
protocols/bee.h
r9ac3ed1 r7aadd71 35 35 36 36 GSList *users; 37 GSList *groups; 37 38 struct account *accounts; /* TODO(wilmer): Use GSList here too? */ 38 39 … … 60 61 char *handle; 61 62 char *fullname; 62 char*group;63 struct bee_group *group; 63 64 64 65 bee_user_flags_t flags; … … 69 70 void *ui_data; 70 71 } bee_user_t; 72 73 typedef struct bee_group 74 { 75 char *key; 76 char *name; 77 } bee_group_t; 71 78 72 79 typedef struct bee_ui_funcs … … 104 111 bee_user_t *bee_user_by_handle( bee_t *bee, struct im_connection *ic, const char *handle ); 105 112 int bee_user_msg( bee_t *bee, bee_user_t *bu, const char *msg, int flags ); 113 bee_group_t *bee_group_by_name( bee_t *bee, const char *name, gboolean creat ); 114 void bee_group_free( bee_t *bee ); 106 115 107 116 /* Callbacks from IM modules to core: */ -
protocols/bee_user.c
r9ac3ed1 r7aadd71 100 100 101 101 return st; 102 } 103 104 105 /* Groups */ 106 static bee_group_t *bee_group_new( bee_t *bee, const char *name ) 107 { 108 bee_group_t *bg = g_new0( bee_group_t, 1 ); 109 110 bg->name = g_strdup( name ); 111 bg->key = g_utf8_casefold( name, -1 ); 112 bee->groups = g_slist_prepend( bee->groups, bg ); 113 114 return bg; 115 } 116 117 bee_group_t *bee_group_by_name( bee_t *bee, const char *name, gboolean creat ) 118 { 119 GSList *l; 120 char *key; 121 122 if( name == NULL ) 123 return NULL; 124 125 key = g_utf8_casefold( name, -1 ); 126 for( l = bee->groups; l; l = l->next ) 127 { 128 bee_group_t *bg = l->data; 129 if( strcmp( bg->key, key ) == 0 ) 130 break; 131 } 132 g_free( key ); 133 134 if( !l ) 135 return creat ? bee_group_new( bee, name ) : NULL; 136 else 137 return l->data; 138 } 139 140 void bee_group_free( bee_t *bee ) 141 { 142 while( bee->groups ) 143 { 144 bee_group_t *bg = bee->groups->data; 145 g_free( bg->name ); 146 g_free( bg->key ); 147 g_free( bg ); 148 bee->groups = g_slist_remove( bee->groups, bee->groups->data ); 149 } 102 150 } 103 151 -
protocols/nogaim.c
r9ac3ed1 r7aadd71 389 389 390 390 bu = bee_user_new( bee, ic, handle ); 391 bu->group = g_strdup( group);391 bu->group = bee_group_by_name( bee, group, TRUE ); 392 392 } 393 393
Note: See TracChangeset
for help on using the changeset viewer.