Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix status report for realname #1514

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/eggdrop.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@
* You should leave this at 32 characters and modify nick-len in the
* configuration file instead.
*/
#define CHANNELLEN 80 /* FIXME see issue #3 and issue #38 and rfc1459 <= 200 */
#define HANDLEN 32 /* valid values 9->NICKMAX */
#define NICKMAX 32 /* valid values HANDLEN->32 */
#define USERLEN 10
#define CHANNELLEN 80 /* FIXME see issue #3 and issue #38 and rfc1459 <= 200 */
#define HANDLEN 32 /* valid values 9->NICKMAX */
#define NICKMAX 32 /* valid values HANDLEN->32 */
#define USERLEN 10
#define REALNAMELEN 120
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the 120 limit come from?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

god gave it to me in my sleep. like he gave it to the coder that wrote the former value of 80 down. What limit do you propose?



/* Handy string lengths */
Expand Down
10 changes: 6 additions & 4 deletions src/mod/server.mod/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ static time_t lastpingcheck; /* set when i unidle myself, cleared when
static time_t server_online; /* server connection time */
static time_t server_cycle_wait; /* seconds to wait before
* re-beginning the server list */
static char botrealname[81]; /* realname of bot */
static char botrealname[REALNAMELEN + 1]; /* realname of bot */
static char onlinebotrealname[sizeof botrealname]; /* online realname of bot */
static int server_timeout; /* server timeout for connecting */
static struct server_list *serverlist; /* old-style queue, still used by
* server list */
Expand Down Expand Up @@ -1736,7 +1737,7 @@ static char *traced_nicklen(ClientData cdata, Tcl_Interp *irp,
static tcl_strings my_tcl_strings[] = {
{"botnick", NULL, 0, STR_PROTECT},
{"altnick", altnick, NICKMAX, 0},
{"realname", botrealname, 80, 0},
{"realname", botrealname, REALNAMELEN, 0},
{"init-server", initserver, 120, 0},
{"connect-server", connectserver, 120, 0},
{"stackable-commands", stackablecmds, 510, 0},
Expand Down Expand Up @@ -2160,7 +2161,7 @@ static void server_report(int idx, int details)

if (server_online) {
dprintf(idx, " Online as: %s%s%s (%s)\n", botname, botuserhost[0] ?
"!" : "", botuserhost[0] ? botuserhost : "", botrealname);
"!" : "", botuserhost[0] ? botuserhost : "", onlinebotrealname);
if (nick_juped)
dprintf(idx, " NICK IS JUPED: %s%s\n", origbotname,
keepnick ? " (trying)" : "");
Expand Down Expand Up @@ -2414,7 +2415,8 @@ char *server_start(Function *global_funcs)
lastpingcheck = 0;
server_online = 0;
server_cycle_wait = 60;
strcpy(botrealname, "A deranged product of evil coders");
botrealname[0] = 0;
onlinebotrealname[0] = 0;
server_timeout = 60;
serverlist = NULL;
cycle_time = 0;
Expand Down
10 changes: 6 additions & 4 deletions src/mod/server.mod/servmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ static int got311(char *from, char *msg)
static int gotsetname(char *from, char *msg)
{
fixcolon(msg);
strlcpy(botrealname, msg, sizeof botrealname);
strlcpy(onlinebotrealname, msg, sizeof onlinebotrealname);
return 0;
}

Expand Down Expand Up @@ -2313,9 +2313,11 @@ static void server_resolve_success(int servidx)
dprintf(DP_MODE, "NICK %s\n", botname);

rmspace(botrealname);
if (botrealname[0] == 0)
strcpy(botrealname, "/msg LamestBot hello");
dprintf(DP_MODE, "USER %s . . :%s\n", botuser, botrealname);
if (botrealname[0])
strcpy(onlinebotrealname, botrealname);
else
snprintf(onlinebotrealname, sizeof onlinebotrealname, "/msg %s hello", botname);
dprintf(DP_MODE, "USER %s . . :%s\n", botuser, onlinebotrealname);

/* Wait for async result now. */
}