1
0
mirror of https://github.com/deavmi/birchwood synced 2024-09-20 15:22:53 +02:00

Merge branch 'master' into ircv3

This commit is contained in:
Tristan B. Velloza Kildaire 2023-03-16 12:59:30 +02:00
commit c51d7f402f
2 changed files with 185 additions and 149 deletions

View File

@ -117,6 +117,10 @@ public class Client : Thread
logger.log("Generic("~message.getCommand()~", "~message.getFrom()~"): "~message.getParams()); logger.log("Generic("~message.getCommand()~", "~message.getFrom()~"): "~message.getParams());
} }
// TODO: Hook certain ones default style with an implemenation
// ... for things that the client can learn from
// TODO: comment
/** /**
* Called on command replies * Called on command replies
* *
@ -125,8 +129,18 @@ public class Client : Thread
*/ */
public void onCommandReply(Message commandReply) public void onCommandReply(Message commandReply)
{ {
// TODO: Add numeric response check here for CERTAIN ones which add to client
// ... state
/* Default implementation */ /* Default implementation */
logger.log("Response("~to!(string)(commandReply.getReplyType())~", "~commandReply.getFrom()~"): "~commandReply.toString()); logger.log("Response("~to!(string)(commandReply.getReplyType())~", "~commandReply.getFrom()~"): "~commandReply.toString());
import birchwood.protocol.constants : ReplyType;
if(commandReply.getReplyType() == ReplyType.RPL_BOUNCE)
{
logger.log("Take a look:\n\n"~commandReply.getParams());
}
} }
/** /**
@ -619,6 +633,9 @@ public class Client : Thread
// If the command is numeric then it is a reply of some sorts // If the command is numeric then it is a reply of some sorts
else if(ircMessage.isResponseMessage()) else if(ircMessage.isResponseMessage())
{ {
// TODO: Add numeric response check here for CERTAIN ones which add to client
// ... state
/* Call the command reply handler */ /* Call the command reply handler */
onCommandReply(ircMessage); onCommandReply(ircMessage);
} }

View File

@ -1,8 +1,14 @@
module birchwood.protocol.constants; module birchwood.protocol.constants;
/* Reply object */ /**
* The type of numeric response
*/
public enum ReplyType : ulong public enum ReplyType : ulong
{ {
/**
* rfc 1459
*/
/* Error replies */ /* Error replies */
ERR_NOSUCHNICK = 401, ERR_NOSUCHNICK = 401,
ERR_NOSUCHSERVER = 402, ERR_NOSUCHSERVER = 402,
@ -143,6 +149,15 @@ module birchwood.protocol.constants;
RPL_MYPORTIS = 384, RPL_MYPORTIS = 384,
ERR_BADCHANMASK = 476, ERR_BADCHANMASK = 476,
/**
* rfc 2812
*/
RPL_WELCOME = 001,
RPL_YOURHOST = 002,
RPL_CREATED = 003,
RPL_MYINFO = 004,
// RPL_BOUNCE = 005, // TODO: We care about the key-value pairs here in RPL_BOUNCE
ERR_NOCHANMODES = 477,
/** /**
* ircv3 * ircv3
@ -153,5 +168,9 @@ module birchwood.protocol.constants;
RPL_ISUPPORT = 005, // This overrides the old rfc2812 RPL_BOUNCE code (we can only support one of these) RPL_ISUPPORT = 005, // This overrides the old rfc2812 RPL_BOUNCE code (we can only support one of these)
/**
* If no code is matched then this is the default
*/
BIRCHWOOD_UNKNOWN_RESP_CODE = 0 BIRCHWOOD_UNKNOWN_RESP_CODE = 0
} }