git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Modules/UDI - Adding PCI and MEI headers
[tpg/acess2.git]
/
Usermode
/
Applications
/
irc_src
/
main.c
diff --git
a/Usermode/Applications/irc_src/main.c
b/Usermode/Applications/irc_src/main.c
index
f05d872
..
190f66d
100755
(executable)
--- 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; //!< Cano
n
ical server (can be NULL)
int ActivityLevel;
char Name[]; // Channel name / remote user
} tWindow;
@@
-104,7
+104,7
@@
int main(int argc, const char *argv[], const char *envp[])
atexit(ExitHandler);
if( _SysIOCtl(1, DRV_IOCTL_TYPE, NULL) != DRV_TYPE_TERMINAL ) {
- printf(stderr, "note: assuming 80x25, can't get terminal dimensions\n");
+
f
printf(stderr, "note: assuming 80x25, can't get terminal dimensions\n");
giTerminal_Width = 80;
giTerminal_Height = 25;
}
@@
-148,6
+148,8
@@
int main(int argc, const char *argv[], const char *envp[])
FD_ZERO(&errorfds);
FD_SET(0, &readfds); // stdin
+ fflush(stdout);
+
// Fill server FDs in fd_set
for( srv = gpServers; srv; srv = srv->Next )
{
@@
-173,12
+175,11
@@
int main(int argc, const char *argv[], const char *envp[])
free(cmd);
// Prompt
SetCursorPos(giTerminal_Height-1, 0);
- printf("\x1B[
K");
// Clear line
+ printf("\x1B[
2K");
// Clear line
if( gpCurrentWindow->Name[0] )
printf("[%s:%s] ", gpCurrentWindow->Server->Name, gpCurrentWindow->Name);
else
printf("[(status)] ");
- fflush(stdout);
}
}
@@
-227,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);
}
}
@@
-408,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
@@
-434,6
+438,8
@@
tMessage *Message_Append(tServer *Server, int Type, const char *Source, const ch
win = &gWindow_Status;
}
+ // Set source to the server name (instead of the hostname)
+ Source = Server->Name;
}
// Private message
else
@@
-468,18
+474,18
@@
tMessage *Message_Append(tServer *Server, int Type, const char *Source, const ch
if( win == gpCurrentWindow )
{
printf("\x1b[s");
+ printf("\x1b""D"); // Scroll down 1 (free space below)
SetCursorPos(giTerminal_Height-2, 0);
int prefixlen = strlen(Source) + 3;
int avail = giTerminal_Width - prefixlen;
int msglen = strlen(Message);
- printf("\x1B[T"); // Scroll down 1 (free space below)
- printf("[%s] %.*s\n", Source, avail, Message);
+ printf("[%s] %.*s", Source, avail, Message);
while( msglen > avail ) {
msglen -= avail;
Message += avail;
- printf("\x1
B[T
");
+ printf("\x1
b""D
");
SetCursorPos(giTerminal_Height-2, prefixlen);
- printf("%.*s
\n
", avail, Message);
+ printf("%.*s", avail, Message);
}
printf("\x1b[u");
}
@@
-564,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 == ':' )
@@
-673,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)
\n
", cmd, Line+pos);
+ Message_AppendF(Server, MSG_TYPE_SERVER, "", "", "Unknown message %s (%s)", cmd, Line+pos);
}
}
- else {
+ else {
cmd = GetValue(Line, &pos);
if( strcmp(cmd, "PING") == 0 ) {
UCC
git Repository :: git.ucc.asn.au