1
0
mirror of https://github.com/deavmi/birchwood synced 2024-09-20 05:43:52 +02:00

Added missing documentation header

Implemented `channelMessage(string, string[])` and `channelMessage(string, string)`
This commit is contained in:
Tristan B. Velloza Kildaire 2022-11-06 11:38:02 +02:00
parent d7375b85a5
commit 3e01ef17d6

View File

@ -380,6 +380,13 @@ public class Client : Thread
} }
} }
/**
* Sends a direct message to the intended recipient
*
* Params:
* message = The message to send
* recipients = The receipient of the message
*/
public void directMessage(string message, string recipient) public void directMessage(string message, string recipient)
{ {
//TODO: Add check on recipient //TODO: Add check on recipient
@ -388,6 +395,51 @@ public class Client : Thread
sendMessage("PRIVMSG "~recipient~" "~message); sendMessage("PRIVMSG "~recipient~" "~message);
} }
/**
* Sends a channel message to the intended recipients
*
* Params:
* message = The message to send
* recipients = The receipients of the message
* Throws:
* BirchwoodException if the channels list is empty
*/
public void channelMessage(string message, string[] channels)
{
/* If single channel */
if(channels.length == 1)
{
/* Send to a single channel */
leaveChannel(channels[0]);
}
/* If multiple channels */
else if(channels.length > 1)
{
string channelLine = channels[0];
for(ulong i = 1; i < channels.length; i++)
{
string currentChannel = channels[i];
if(i == channels.length-1)
{
channelLine~=currentChannel;
}
else
{
channelLine~=currentChannel~",";
}
}
/* Send to multiple channels */
sendMessage("PRIVMSG "~channelLine~" "~message);
}
/* If no channels provided at all (error) */
else
{
throw new BirchwoodException(BirchwoodException.ErrorType.EMPTY_PARAMS);
}
}
/** /**
* Sends a message to a given channel * Sends a message to a given channel
* *
@ -395,10 +447,12 @@ public class Client : Thread
* message = The message to send * message = The message to send
* channel = The channel to send the message to * channel = The channel to send the message to
*/ */
@disable
public void channelMessage(string message, string channel) public void channelMessage(string message, string channel)
{ {
//TODO: Add check on recipient
//TODO: Implement //TODO: Implement
sendMessage("PRIVMSG "~channel~" "~message);
} }
/** /**