From: John Hodge Date: Sat, 14 Sep 2013 01:39:17 +0000 (+0800) Subject: Usermode/IRC - Added JOIN/PART message suppor X-Git-Tag: rel0.15~220 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=83c4314c8c69495a071a4d656fe6a6f0659f6bde;p=tpg%2Facess2.git Usermode/IRC - Added JOIN/PART message suppor --- diff --git a/Usermode/Applications/irc_src/main.c b/Usermode/Applications/irc_src/main.c index a11487ff..190f66dc 100755 --- a/Usermode/Applications/irc_src/main.c +++ b/Usermode/Applications/irc_src/main.c @@ -32,7 +32,7 @@ typedef struct sWindow { struct sWindow *Next; tMessage *Messages; - tServer *Server; //!< Canoical server (can be NULL) + tServer *Server; //!< Canonical server (can be NULL) int ActivityLevel; char Name[]; // Channel name / remote user } tWindow; @@ -228,6 +228,8 @@ void Cmd_join(char *ArgString) if( gpCurrentWindow->Server ) { + gpCurrentWindow = Window_Create(gpCurrentWindow->Server, channel_name); + Redraw_Screen(); writef(gpCurrentWindow->Server->FD, "JOIN :%s\n", channel_name); } } @@ -409,7 +411,8 @@ tMessage *Message_Append(tServer *Server, int Type, const char *Source, const ch } } if( !win ) { - win = Window_Create(Server, Dest); + //win = Window_Create(Server, Dest); + win = &gWindow_Status; // Stick it in the status window, just in case } } #if 0 @@ -567,7 +570,7 @@ void ParseServerLine(tServer *Server, char *Line) int pos = 0; char *ident, *cmd; -// _SysDebug("[%s] %s", Server->Name, Line); + _SysDebug("[%s] %s", Server->Name, Line); // Message? if( *Line == ':' ) @@ -676,14 +679,24 @@ void ParseServerLine(tServer *Server, char *Line) { char *channel; channel = Line + pos + 1; - Window_Create(Server, channel); + + Message_AppendF(Server, MSG_TYPE_JOIN, "", channel, "%s has joined", ident); + //Window_Create(Server, channel); + } + else if( strcmp(cmd, "PART" ) == 0 ) + { + char *channel; + channel = Line + pos + 1; + + Message_AppendF(Server, MSG_TYPE_PART, "", channel, "%s has left", ident); + //Window_Create(Server, channel); } else { Message_AppendF(Server, MSG_TYPE_SERVER, "", "", "Unknown message %s (%s)", cmd, Line+pos); } } - else { + else { cmd = GetValue(Line, &pos); if( strcmp(cmd, "PING") == 0 ) {