delthas / JavaSkype

A lightweight, comprehensive Java API for Skype using MSNP24
MIT License
72 stars 28 forks source link

group.getUsers function always return 0 #40

Open biopowder opened 6 years ago

biopowder commented 6 years ago

Hi,

I think code will explain everything.

Skype skype = new Skype("bot", "xxx"); skype.connect(); System.out.println("Bot is connected"); List groups = skype.getGroups(); // I have 2 groups System.out.println(groups.size()); for (Group group : groups) { List<Pair<User, Role>> usersWithRoles = group.getUsersWithRoles(); System.out.println(usersWithRoles.size()); List users = group.getUsers(); System.out.println(users.size()); } System.out.println("Bot is disconnected");

output is: Bot is connected 2 0 0 0 0 Bot is disconnected

biopowder commented 6 years ago

Update: getUsers returns 0, only is group topic is not changed, once it is changed, getUsers returns correct value

delthas commented 6 years ago

Hello, thanks for the issue.

Please send me the debug logs for an example session of this happening. For example, run the following program:

Skype skype = new Skype("bot", "xxx");
Skype.setDebug(Paths.get("logfile.txt")); // notice the setDebug call to produce a log file
skype.connect();
System.out.println("Bot is connected");
List<Group> groups = skype.getGroups();
// I have 2 groups
System.out.println("count of groups: "+groups.size());
System.out.println("printing the groups user count...");
for (Group group : groups) {
List<Pair<User, Role>> usersWithRoles = group.getUsersWithRoles();
System.out.println(usersWithRoles.size());
List<User> users = group.getUsers();
System.out.println(users.size());
}
System.out.println("changing the groups topic...");
for (Group group : groups) {
group.changeTopic("dummy test topic");
}
System.out.println("printing the new groups user count...");
for (Group group : groups) {
List<Pair<User, Role>> usersWithRoles = group.getUsersWithRoles();
System.out.println(usersWithRoles.size());
List<User> users = group.getUsers();
System.out.println(users.size());
}
System.out.println("Bot is disconnected");

It will produce a logfile.txt file which you can then send me so that I can investigate the issue. Thanks.

metasonic commented 6 years ago

@delthas First run result: Bot is connected count of groups: 3 printing the groups user count... 4 4 0 0 0 0 changing the groups topic... printing the new groups user count... 4 4 0 0 0 0 Bot is disconnected Logs: https://pastebin.com/kFyq9rdx

Seconds run result: Bot is connected count of groups: 3 printing the groups user count... 4 4 3 3 3 3 changing the groups topic... printing the new groups user count... 4 4 3 3 3 3 Bot is disconnected Logs: https://pastebin.com/vE47HYYC