- Timestamp:
- 2011-01-02T02:32:39Z (14 years ago)
- Branches:
- master
- Children:
- fbb15f2
- Parents:
- 89d6845
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
skype/skype.c
r89d6845 r54ca269 277 277 } 278 278 279 static char *skype_group_by_username(struct im_connection *ic, char *username) 280 { 281 struct skype_data *sd = ic->proto_data; 282 int i, j; 283 284 /* NEEDSWORK: we just search for the first group of the user, multiple 285 * groups / user is not yet supported by BitlBee. */ 286 287 for (i = 0; i < g_list_length(sd->groups); i++) { 288 struct skype_group *sg = g_list_nth_data(sd->groups, i); 289 for (j = 0; j < g_list_length(sg->users); j++) { 290 if (!strcmp(g_list_nth_data(sg->users, j), username)) 291 return sg->name; 292 } 293 } 294 return NULL; 295 } 296 279 297 static void skype_parse_users(struct im_connection *ic, char *line) 280 298 { … … 308 326 return; 309 327 ptr = g_strdup_printf("%s@skype.com", user); 310 imcb_add_buddy(ic, ptr, NULL);328 imcb_add_buddy(ic, ptr, skype_group_by_username(ic, user)); 311 329 if (strcmp(status, "OFFLINE") && (strcmp(status, "SKYPEOUT") || 312 330 !set_getbool(&ic->acc->set, "skypeout_offline"))) … … 324 342 if (!strcmp(st, "3")) { 325 343 char *buf = g_strdup_printf("%s@skype.com", user); 326 imcb_add_buddy(ic, buf, NULL);344 imcb_add_buddy(ic, buf, skype_group_by_username(ic, user)); 327 345 g_free(buf); 328 346 } … … 771 789 } 772 790 791 /* Update the group of each user in this group */ 792 static void skype_group_users(struct im_connection *ic, struct skype_group *sg) { 793 int i; 794 795 for (i = 0; i < g_list_length(sg->users); i++) { 796 char *user = g_list_nth_data(sg->users, i); 797 char *buf = g_strdup_printf("%s@skype.com", user); 798 imcb_add_buddy(ic, buf, sg->name); 799 g_free(buf); 800 } 801 } 802 773 803 static void skype_parse_group(struct im_connection *ic, char *line) 774 804 { … … 815 845 } 816 846 g_strfreev(users); 847 skype_group_users(ic, sg); 817 848 } else 818 849 log_message(LOGLVL_ERROR, "No skype group with id %s. That's probably a bug.", id); … … 1040 1071 1041 1072 /* This will download all buddies and groups. */ 1042 st = skype_printf(ic, "SEARCH FRIENDS\n");1043 skype_printf(ic, "SEARCH GROUPS CUSTOM\n");1073 st = skype_printf(ic, "SEARCH GROUPS CUSTOM\n"); 1074 skype_printf(ic, "SEARCH FRIENDS\n"); 1044 1075 1045 1076 skype_printf(ic, "SET USERSTATUS ONLINE\n");
Note: See TracChangeset
for help on using the changeset viewer.