Changeset 46e9822
- Timestamp:
- 2011-01-03T02:47:40Z (14 years ago)
- Branches:
- master
- Children:
- 46641bf
- Parents:
- a5e6aa1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
skype/skype.c
ra5e6aa1 r46e9822 291 291 return sg->name; 292 292 } 293 } 294 return NULL; 295 } 296 297 static struct skype_group *skype_group_by_name(struct im_connection *ic, char *name) 298 { 299 struct skype_data *sd = ic->proto_data; 300 int i; 301 302 for (i = 0; i < g_list_length(sd->groups); i++) { 303 struct skype_group *sg = g_list_nth_data(sd->groups, i); 304 if (!strcmp(sg->name, name)) 305 return sg; 293 306 } 294 307 return NULL; … … 998 1011 } 999 1012 1013 static void skype_parse_alter_group(struct im_connection *ic, char *line) 1014 { 1015 char *id = line + strlen("ALTER GROUP"); 1016 1017 if (!++id) 1018 return; 1019 1020 char *info = strchr(id, ' '); 1021 1022 if (!info) 1023 return; 1024 *info = '\0'; 1025 info++; 1026 1027 if (!strncmp(info, "ADDUSER ", 8)) { 1028 struct skype_group *sg = skype_group_by_id(ic, atoi(id)); 1029 1030 info += 8; 1031 if (sg) { 1032 char *buf = g_strdup_printf("%s@skype.com", info); 1033 sg->users = g_list_append(sg->users, g_strdup(info)); 1034 imcb_add_buddy(ic, buf, sg->name); 1035 g_free(buf); 1036 } else 1037 log_message(LOGLVL_ERROR, 1038 "No skype group with id %s. That's probably a bug.", id); 1039 } 1040 } 1041 1000 1042 typedef void (*skype_parser)(struct im_connection *ic, char *line); 1001 1043 … … 1024 1066 { "CHATS ", skype_parse_chats }, 1025 1067 { "GROUPS ", skype_parse_groups }, 1068 { "ALTER GROUP ", skype_parse_alter_group }, 1026 1069 }; 1027 1070 … … 1270 1313 char *nick, *ptr; 1271 1314 1272 /* Unused parameter */1273 group = group;1274 1275 1315 nick = g_strdup(who); 1276 1316 ptr = strchr(nick, '@'); 1277 1317 if (ptr) 1278 1318 *ptr = '\0'; 1279 skype_printf(ic, "SET USER %s BUDDYSTATUS 2 Please authorize me\n", 1280 nick); 1281 g_free(nick); 1319 1320 if (!group) { 1321 skype_printf(ic, "SET USER %s BUDDYSTATUS 2 Please authorize me\n", 1322 nick); 1323 g_free(nick); 1324 } else { 1325 struct skype_group *sg = skype_group_by_name(ic, group); 1326 1327 if (!sg) { 1328 // TODO 1329 /* No such group, we need to create it, then have to 1330 * add the user once it's created. */ 1331 //skype_printf(ic, "CREATE GROUP %s", group); 1332 } else { 1333 skype_printf(ic, "ALTER GROUP %d ADDUSER %s", sg->id, nick); 1334 } 1335 } 1282 1336 } 1283 1337
Note: See TracChangeset
for help on using the changeset viewer.