mirror of
https://github.com/deavmi/birchwood
synced 2024-09-20 08:43:05 +02:00
- Implemented directMessage(string, string[])
and removed the @disable annotation
- Implemented `directMessage(string,s tring)`
This commit is contained in:
parent
83e900834f
commit
d7375b85a5
@ -282,7 +282,7 @@ public class Client : Thread
|
|||||||
* Params:
|
* Params:
|
||||||
* channels = the list of channels to part from
|
* channels = the list of channels to part from
|
||||||
* Throws:
|
* Throws:
|
||||||
* BirchwoodException if the list is empty
|
* BirchwoodException if the channels list is empty
|
||||||
*/
|
*/
|
||||||
public void leaveChannel(string[] channels)
|
public void leaveChannel(string[] channels)
|
||||||
{
|
{
|
||||||
@ -320,7 +320,6 @@ public class Client : Thread
|
|||||||
{
|
{
|
||||||
throw new BirchwoodException(BirchwoodException.ErrorType.EMPTY_PARAMS);
|
throw new BirchwoodException(BirchwoodException.ErrorType.EMPTY_PARAMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -343,11 +342,50 @@ public class Client : Thread
|
|||||||
* Params:
|
* Params:
|
||||||
* message = The message to send
|
* message = The message to send
|
||||||
* recipients = The receipients of the message
|
* recipients = The receipients of the message
|
||||||
|
* Throws:
|
||||||
|
* BirchwoodException if the recipients list is empty
|
||||||
*/
|
*/
|
||||||
@disable
|
|
||||||
public void directMessage(string message, string[] recipients)
|
public void directMessage(string message, string[] recipients)
|
||||||
{
|
{
|
||||||
//TODO: Implement
|
//TODO: Add check on recipients
|
||||||
|
|
||||||
|
/* Single recipient */
|
||||||
|
if(recipients.length == 1)
|
||||||
|
{
|
||||||
|
/* Send a direct message */
|
||||||
|
directMessage(message, recipients[0]);
|
||||||
|
}
|
||||||
|
/* Multiple recipients */
|
||||||
|
else if(recipients.length > 1)
|
||||||
|
{
|
||||||
|
string recipientLine = recipients[0];
|
||||||
|
for(ulong i = 1; i < recipients.length; i++)
|
||||||
|
{
|
||||||
|
string currentRecipient = recipients[i];
|
||||||
|
|
||||||
|
if(i == recipients.length-1)
|
||||||
|
{
|
||||||
|
recipientLine~=currentRecipient;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
recipientLine~=currentRecipient~",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* If no recipients provided at all (error) */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new BirchwoodException(BirchwoodException.ErrorType.EMPTY_PARAMS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void directMessage(string message, string recipient)
|
||||||
|
{
|
||||||
|
//TODO: Add check on recipient
|
||||||
|
|
||||||
|
/* Send the message */
|
||||||
|
sendMessage("PRIVMSG "~recipient~" "~message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user