3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-30 14:52:16 +00:00

Fix IrcDiscovery to not expect the IRC server to return the user list when joining the server automatically. This does not happen for all IRC server implementations. Rather the NAMES command should be sent to ensure that the user list is returned. It also fixes that the returned lines start with a colon that has to be removed before sending the line to the parseUserList method. Patch from Wolfgang Nagele. Resolves issue 50.

This commit is contained in:
Mike Hearn 2011-07-18 20:39:00 +00:00
parent c3933a7773
commit 440b2d28ac
2 changed files with 6 additions and 3 deletions

View File

@ -6,4 +6,5 @@ Micheal Swiggs <bobby.simpson87@gmail.com>
Gary Rowe <g.rowe@froot.co.uk>
Noa Resare <noa@resare.com>
John Sample <jwsample@gmail.com>
Jan Møller <jan.moller@gmail.com>
Jan Møller <jan.moller@gmail.com>
Wolfgang Nagele <wolfgang.nagele@gmail.com>

View File

@ -104,9 +104,11 @@ public class IrcDiscovery implements PeerDiscovery {
// Join the channel.
logAndSend("JOIN " + channel);
// List users in channel.
logAndSend("NAMES " + channel);
writer.flush();
// A list of the users should be returned when we join. Look for code 353 and parse until code 366.
// A list of the users should be returned. Look for code 353 and parse until code 366.
while ((currLine = reader.readLine()) != null) {
onIRCReceive(currLine);
if (checkLineStatus("353", currLine)) {
@ -117,7 +119,7 @@ public class IrcDiscovery implements PeerDiscovery {
}
String spacedList = currLine.substring(currLine.indexOf(":", subIndex));
addresses.addAll(parseUserList(spacedList.split(" ")));
addresses.addAll(parseUserList(spacedList.substring(1).split(" ")));
} else if (checkLineStatus("366", currLine)) {
// End of user list.
break;