mirror of https://github.com/deavminet/dnetd.git
Implemented 'list' command
This commit is contained in:
parent
af167f47e3
commit
7caf0aa22f
|
@ -237,6 +237,34 @@ public class DConnection : Thread
|
||||||
/* TODO: Implement me, use return value */
|
/* TODO: Implement me, use return value */
|
||||||
writeSocket(tag, reply);
|
writeSocket(tag, reply);
|
||||||
}
|
}
|
||||||
|
/* If `list` command (requires: authed) */
|
||||||
|
else if(commandByte == 6 && hasAuthed)
|
||||||
|
{
|
||||||
|
/* Get all channels */
|
||||||
|
DChannel[] channels = server.getChannels();
|
||||||
|
|
||||||
|
/* Generate a list of channel names (CSV) */
|
||||||
|
string channelList;
|
||||||
|
for(ulong i = 0; i < channels.length; i++)
|
||||||
|
{
|
||||||
|
if(i == channels.length-1)
|
||||||
|
{
|
||||||
|
channelList ~= channels[i].getName();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
channelList ~= channels[i].getName()~",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: Reply */
|
||||||
|
/* Encode the reply */
|
||||||
|
byte[] reply = [true];
|
||||||
|
reply ~= channelList;
|
||||||
|
|
||||||
|
/* TODO: Implement me, use return value */
|
||||||
|
writeSocket(tag, reply);
|
||||||
|
}
|
||||||
/* TODO: Handle this case */
|
/* TODO: Handle this case */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -147,4 +147,9 @@ public class DServer : Thread
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DChannel[] getChannels()
|
||||||
|
{
|
||||||
|
return channels;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue