\r
// HACK: Static server entry\r
// UCC (University [of Western Australia] Computer Club) IRC Server\r
-// gWindow_Status.Server = Server_Connect( "UCC", "130.95.13.18", 6667 );\r
- gWindow_Status.Server = Server_Connect( "Freenode", "89.16.176.16", 6667 );\r
+ gWindow_Status.Server = Server_Connect( "UCC", "130.95.13.18", 6667 );\r
+ // Freenode (#osdev)\r
+// gWindow_Status.Server = Server_Connect( "Freenode", "89.16.176.16", 6667 );\r
// gWindow_Status.Server = Server_Connect( "Host", "10.0.2.2", 6667 );\r
-// gWindow_Status.Server = Server_Connect( "BitlBee", "192.168.1.34", 6667 );\r
+ // Local server\r
+// gWindow_Status.Server = Server_Connect( "BitlBee", "192.168.1.39", 6667 );\r
\r
if( !gWindow_Status.Server )\r
return -1;\r
return 0;\r
}\r
\r
+/**\r
+ * \brief Handle a line from the prompt\r
+ */\r
int ParseUserCommand(char *String)\r
{\r
if( String[0] == '/' )\r
int pos = 0;\r
char *ident, *cmd;\r
\r
- _SysDebug("Server %s: Line = %s", Server->Name, Line); \r
+ _SysDebug("[%s] %s", Server->Name, Line); \r
\r
// Message?\r
if( *Line == ':' )\r
{\r
+ pos ++;\r
ident = GetValue(Line, &pos); // Ident (user or server)\r
cmd = GetValue(Line, &pos);\r
\r
\r
switch(num)\r
{\r
+ case 332: // Topic\r
+ user = message; // Channel\r
+ message = Line + pos + 1; // Topic\r
+ Message_AppendF(Server, MSG_TYPE_SERVER, user, user, "Topic: %s", message);\r
+ break;\r
+ case 333: // Topic set by\r
+ user = message; // Channel\r
+ message = GetValue(Line, &pos); // User\r
+ GetValue(Line, &pos); // Timestamp\r
+ Message_AppendF(Server, MSG_TYPE_SERVER, user, user, "Set by %s", message);\r
+ break;\r
case 353: // /NAMES list\r
// <user> = <channel> :list\r
-// GetValue(Line, &pos); // '='\r
+ // '=' was eaten in and set to message\r
user = GetValue(Line, &pos); // Actually channel\r
message = Line + pos + 1; // List\r
- Message_AppendF(Server, MSG_TYPE_SERVER, user, "", "Names: %s", message);\r
+ Message_AppendF(Server, MSG_TYPE_SERVER, user, user, "Names: %s", message);\r
break;\r
case 366: // end of /NAMES list\r
// <user> <channel> :msg\r
user = message;\r
message = Line + pos + 1;\r
- Message_Append(Server, MSG_TYPE_SERVER, user, "", message);\r
+ Message_Append(Server, MSG_TYPE_SERVER, user, user, message);\r
break;\r
case 372: // MOTD Data\r
case 376: // MOTD End\r
else {\r
message = GetValue(Line, &pos);\r
}\r
+\r
+ // TODO: Catch when the privmsg is addressed to the user\r
+\r
// Cmd_PRIVMSG(Server, dest, ident, message);\r
+ *strchr(ident, '!') = '\0'; // Hello SIGSEGV\r
Message_Append(Server, MSG_TYPE_STANDARD, ident, dest, message);\r
}\r
else if( strcmp(cmd, "JOIN" ) == 0 )\r
{\r
char *channel;\r
- channel = GetValue(Line, &pos) + 1;\r
+ channel = Line + pos + 1;\r
Window_Create(Server, channel);\r
}\r
else\r