|
|
@ -2,6 +2,7 @@ package proto; |
|
|
|
|
|
|
|
import java.io.DataInputStream; |
|
|
|
import java.nio.charset.Charset; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
public class ProtoIn |
|
|
|
{ |
|
|
@ -34,9 +35,23 @@ public class ProtoIn |
|
|
|
switch (id) |
|
|
|
{ |
|
|
|
case 3: |
|
|
|
short nlen = dis.readShort(); |
|
|
|
String username = readname(); |
|
|
|
|
|
|
|
if (length == 0) |
|
|
|
{ |
|
|
|
Thread t = new Thread(() -> handler.handleListingRequest(username)); |
|
|
|
t.start(); |
|
|
|
} else |
|
|
|
{ |
|
|
|
ArrayList<String> names = new ArrayList<>(); |
|
|
|
int a = 0; |
|
|
|
while (a < length) |
|
|
|
{ |
|
|
|
String name = readname(); |
|
|
|
a += name.length(); |
|
|
|
names.add(name); |
|
|
|
} |
|
|
|
handler.handleListing(username, (String[]) names.toArray()); |
|
|
|
} |
|
|
|
break; |
|
|
|
default: |
|
|
|
Thread t = new Thread(() -> handler.handleUnknownCommand(id)); |
|
|
|