mirror of
https://github.com/deavminet/dnetd
synced 2024-09-21 09:43:37 +02:00
Added 'part' command
This commit is contained in:
parent
736304ed94
commit
9409cdf507
@ -207,6 +207,36 @@ public class DConnection : Thread
|
|||||||
/* TODO: Implement me, use return value */
|
/* TODO: Implement me, use return value */
|
||||||
writeSocket(tag, reply);
|
writeSocket(tag, reply);
|
||||||
}
|
}
|
||||||
|
/* If `part` command (requires: authed) */
|
||||||
|
else if(commandByte == 4 && hasAuthed)
|
||||||
|
{
|
||||||
|
/* Get the channel names */
|
||||||
|
string channelList = cast(string)message.data[1..message.data.length];
|
||||||
|
string[] channels = split(channelList, ",");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loop through each channel, check if it
|
||||||
|
* exists, if so leave it
|
||||||
|
*/
|
||||||
|
foreach(string channelName; channels)
|
||||||
|
{
|
||||||
|
/* Attempt to find the channel */
|
||||||
|
DChannel channel = server.getChannelByName(channelName);
|
||||||
|
|
||||||
|
/* Leave a channel the channel only if it exists */
|
||||||
|
if(!(channel is null))
|
||||||
|
{
|
||||||
|
channel.leave(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: Do reply */
|
||||||
|
/* Encode the reply */
|
||||||
|
byte[] reply = [true];
|
||||||
|
|
||||||
|
/* TODO: Implement me, use return value */
|
||||||
|
writeSocket(tag, reply);
|
||||||
|
}
|
||||||
/* TODO: Handle this case */
|
/* TODO: Handle this case */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user