Add a temporary kludge to work around the state struct not being
initialized properly.
This commit is contained in:
parent
2a49564ca9
commit
2904cd9426
@ -76,24 +76,24 @@ void interpretCommand(char *cmd)
|
|||||||
} else if (!strcmp(token1, "nick"))
|
} else if (!strcmp(token1, "nick"))
|
||||||
{
|
{
|
||||||
if (strlen(token2) > 0)
|
if (strlen(token2) > 0)
|
||||||
{
|
{
|
||||||
renameUserInList(sysState.myNick, token2, userList);
|
renameUserInList(sysState.myNick, token2, userList);
|
||||||
doNick(token2);
|
doNick(token2);
|
||||||
}
|
}
|
||||||
} else if (!strcmp(token1, "join"))
|
} else if (!strcmp(token1, "join"))
|
||||||
{
|
|
||||||
if (strlen(token2) > 0)
|
|
||||||
{
|
{
|
||||||
doJoin(token2);
|
if (strlen(token2) > 0)
|
||||||
}
|
{
|
||||||
} else if (!strcmp(token1, "ns"))
|
doJoin(token2);
|
||||||
{
|
}
|
||||||
|
} else if (!strcmp(token1, "ns"))
|
||||||
|
{
|
||||||
if (strlen(token2) > 0)
|
if (strlen(token2) > 0)
|
||||||
doPrivateMsg("nickserv", cmd+token2Start);
|
doPrivateMsg("nickserv", cmd+token2Start);
|
||||||
else
|
else
|
||||||
appendText("You fool, no message specified\n");
|
appendText("You fool, no message specified\n");
|
||||||
} else if (!strcmp(token1, "mode"))
|
} else if (!strcmp(token1, "mode"))
|
||||||
{
|
{
|
||||||
char token4[MAX_INPUT_LEN+1];
|
char token4[MAX_INPUT_LEN+1];
|
||||||
char token5[MAX_INPUT_LEN+1];
|
char token5[MAX_INPUT_LEN+1];
|
||||||
char token6[MAX_INPUT_LEN+1];
|
char token6[MAX_INPUT_LEN+1];
|
||||||
@ -102,7 +102,7 @@ void interpretCommand(char *cmd)
|
|||||||
token5[0] = '\0';
|
token5[0] = '\0';
|
||||||
token6[0] = '\0';
|
token6[0] = '\0';
|
||||||
if (strlen(token2) > 0)
|
if (strlen(token2) > 0)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
l = 0;
|
l = 0;
|
||||||
cmdCursor++;
|
cmdCursor++;
|
||||||
@ -113,7 +113,7 @@ void interpretCommand(char *cmd)
|
|||||||
printf("token3: %s\n", token3);
|
printf("token3: %s\n", token3);
|
||||||
#endif
|
#endif
|
||||||
if (cmdCursor < cmdLen)
|
if (cmdCursor < cmdLen)
|
||||||
{
|
{
|
||||||
cmdCursor++;
|
cmdCursor++;
|
||||||
l = 0;
|
l = 0;
|
||||||
while (cmdCursor < cmdLen && cmd[cmdCursor] != ' ')
|
while (cmdCursor < cmdLen && cmd[cmdCursor] != ' ')
|
||||||
@ -173,7 +173,7 @@ void interpretCommand(char *cmd)
|
|||||||
}
|
}
|
||||||
} else if (!strcmp(token1, "user"))
|
} else if (!strcmp(token1, "user"))
|
||||||
{
|
{
|
||||||
doUser(sysState.myUnixname, sysState.myHostName, sysState.serverName, sysState.myName);
|
doUser(sysState.myUnixname, sysState.myHostName, sysState.serverName, sysState.myName);
|
||||||
} else if (!strcmp(token1, "whois"))
|
} else if (!strcmp(token1, "whois"))
|
||||||
{
|
{
|
||||||
if (strlen(token2) > 0)
|
if (strlen(token2) > 0)
|
||||||
|
10
src/main.c
10
src/main.c
@ -230,6 +230,16 @@ int main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
strcpy(sysState.myUnixname, tempName);
|
strcpy(sysState.myUnixname, tempName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
/* We need to replace this with code to load the user's nickname as specified in the configuration file. */
|
||||||
|
/* We also need to do this for realname, and (perhaps) other elements of the struct, as well. */
|
||||||
|
/* What a pain. */
|
||||||
|
/* For now we're going to set the nickname to the user's unix username. */
|
||||||
|
strcpy(sysState.myNick, getenv("USER"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* create unmanaged dialogs */
|
/* create unmanaged dialogs */
|
||||||
createAboutBox(mainWindow);
|
createAboutBox(mainWindow);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include <sys/param.h> /* for MAXHOSTNAMELEN */
|
#include <sys/param.h> /* for MAXHOSTNAMELEN */
|
||||||
|
#include <netdb.h>
|
||||||
|
|
||||||
#define PREF_FILE_NAME ".nebula.rc"
|
#define PREF_FILE_NAME ".nebula.rc"
|
||||||
|
|
||||||
|
@ -77,8 +77,9 @@ int connectToServer(char *servName, int port)
|
|||||||
/* we add our socket to the select file descriptors as an Event source for X */
|
/* we add our socket to the select file descriptors as an Event source for X */
|
||||||
nebulaNetworkEventId = XtAppAddInput(nebulaIrcAppContext, sysState.socket, (XtPointer)(XtInputReadMask), readLine, NULL);
|
nebulaNetworkEventId = XtAppAddInput(nebulaIrcAppContext, sysState.socket, (XtPointer)(XtInputReadMask), readLine, NULL);
|
||||||
|
|
||||||
doNick(sysState.myNick);
|
|
||||||
doUser(sysState.myUnixname, sysState.myHostName, sysState.serverName, sysState.myName);
|
doUser(sysState.myUnixname, sysState.myHostName, sysState.serverName, sysState.myName);
|
||||||
|
printf("nick: %s\n", sysState.myNick);
|
||||||
|
doNick(sysState.myNick);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +322,17 @@ void doUser(char *username, char *hostname, char *servername, char *realname)
|
|||||||
strcat(outBuff, " ");
|
strcat(outBuff, " ");
|
||||||
strcat(outBuff, servername);
|
strcat(outBuff, servername);
|
||||||
strcat(outBuff, " :");
|
strcat(outBuff, " :");
|
||||||
strcat(outBuff, realname);
|
/* Right now, realname is never set. We need to fix that in main(). */
|
||||||
|
/* Anyway, using the user's username as a realname when realname isn't set should be fine. */
|
||||||
|
/* It's a hell of a lot better than fighting with cryptic error messages, that's for sure. */
|
||||||
|
if(strlen(realname))
|
||||||
|
{
|
||||||
|
strcat(outBuff, realname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcat(outBuff, username);
|
||||||
|
}
|
||||||
printf("sending: %s\n", outBuff);
|
printf("sending: %s\n", outBuff);
|
||||||
sendLine(outBuff);
|
sendLine(outBuff);
|
||||||
}
|
}
|
||||||
|
@ -57,22 +57,29 @@ void okButtStartupCbk()
|
|||||||
if (strlen(nick) > 0 && strlen(nick) <= MAX_NICK_LEN)
|
if (strlen(nick) > 0 && strlen(nick) <= MAX_NICK_LEN)
|
||||||
strcpy(sysState.myNick, nick);
|
strcpy(sysState.myNick, nick);
|
||||||
else
|
else
|
||||||
strcpy(sysState.myNick, "");
|
strcpy(sysState.myNick, "johndoe");
|
||||||
if (strlen(name) > 0 && strlen(name) <= MAX_NAME_LEN)
|
if (strlen(name) > 0 && strlen(name) <= MAX_NAME_LEN)
|
||||||
strcpy(sysState.myName, name);
|
{
|
||||||
|
printf("first branch of name set: %s\n", name);
|
||||||
|
strcpy(sysState.myName, name);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
strcpy(sysState.myName, "noname");
|
{
|
||||||
|
printf("second branch of name set: %s\n", name);
|
||||||
|
strcpy(sysState.myName, "John Doe");
|
||||||
|
}
|
||||||
if (strlen(server) > 0 &&strlen(server) <= MAX_SERVERNAME_LEN)
|
if (strlen(server) > 0 &&strlen(server) <= MAX_SERVERNAME_LEN)
|
||||||
strcpy(theServer, server);
|
strcpy(theServer, server);
|
||||||
else
|
else
|
||||||
strcpy(theServer, "");
|
strcpy(theServer, "*");
|
||||||
printf("port: %s, %d\n", port, atoi(port));
|
printf("port: %s, %d\n", port, atoi(port));
|
||||||
if (strlen(port) > 0 && strlen(port) <= 5)
|
if (strlen(port) > 0 && strlen(port) <= 5)
|
||||||
{
|
{
|
||||||
sysState.port = atoi(port);
|
sysState.port = atoi(port);
|
||||||
if (sysState.port <= 0)
|
if (sysState.port <= 0)
|
||||||
sysState.port = 6666;
|
sysState.port = 6666;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
sysState.port = 6666;
|
sysState.port = 6666;
|
||||||
|
|
||||||
connectToServer(theServer, sysState.port);
|
connectToServer(theServer, sysState.port);
|
||||||
|
Loading…
Reference in New Issue
Block a user