diff -rcN ircii-EPIC3.001/KNOWNBUGS ircii-EPIC3.002/KNOWNBUGS *** ircii-EPIC3.001/KNOWNBUGS Sun Oct 13 20:17:33 1996 --- ircii-EPIC3.002/KNOWNBUGS Thu Oct 24 14:23:05 1996 *************** *** 1,132 **** ! BUGS REPORTED, OUTSTANDING, OR FIXED SINCE LAST RELEASE (EPIC3.000) PENDING THINGS: -------------- - LOOK FOR IN EPIC4 - ----------------- - * Some kind of better mail checking (ugh) - * Lastlog lines might be flagged with DISPLAY_ANSI bit. - * Windows logically seperated from screens. - * Userhost caching - * Whole new DCC mechanism, more generalized, more secure, faster. - * Talk support - * $ignore() function for getting ignore list - * Customizable highlight string for /IGNORE + - * Nonblocking connections - * Better X Window support - * Judicious use of mmap() might be appropriate. - * Passive callback looping might end deadlocks - * Figure some way to allow DCC when using unix domain sockets. - * AUTO_REJOIN delay time, /set-able. - * Crimedog wants channels to be able to be ``hidden'' (never current) - BUGS FIXED/CHANGES MADE SINCE THE LAST RELEASE ---------------------------------------------- ! * Fixed memory leak genesisk reported in function_jot() ! * Fixed core archon reported when $winsize() given garbage input. ! * Fixed bug colten reported about /redirect's usage msg. ! * Fixed bug colten reported about /redirect send_to_server lossage. ! * Fixed bug genesisk reported about dcc send/get output reversed ! * Fixed bug with /notify -foo -bar only showing "foo removed ...." ! * Added /server -add ! * Implemented encryption over dcc send/get/chat ! * Trimmed away the excess in newio.c ! * Twiddled a bit with parse.c to make more efficient. ! * Included strtoul() for sunos4 users. ! * Fixed dependancies with 'wterm.o' and 'wterm.c' ! * Added /HOSTNAME for dynamic ip'ers ! * Fixed memory leak in find_alias_with_args(). ! * Fixed memory leak in remove_brackets(). ! * New, more efficient, my_stricmp, my_strnicmp. ! * Much needed efficiency cleanup in ircaux.c (memory allocators) ! * Integrated James's compile-options addition to $info(). ! * Added my_isspace() macro to get around library lossage. ! * Fixed 8 bit character bug James found. ! * Profiling and efficiency enhancements cut down on CPU usage. ! * Fiddled with the Makefile to make 'make install' less painful. ! * Fixed botched handling of free() with getcwd() with $W. ! * Fixed botched handling of free() with scandir() stuff. ! * Fixed memory leak with /help LOG ! * Reworked some of the help handler for clarity. ! * Added /timer -delete all ! * Fixed reference to S_ISLNK in glob.c for brain dead unixware ! * Fixed #include of so we can get ULONG_MAX reasonably. ! * Fixed bugs found in help.c by Colten. ! * Fixed bug in get_server_itsname found by Colten. ! * Changed DCC address used to one getpeername() returns (Stefan Berndtsson) ! * Fixed /redirect so it doesnt get stuck ! * Fixed bug with referencing $0 on rhs of expression, found by Colten ! * Fixed bug that doing /DCC crashed client. ! * Fixed bug with /echo $f[e][ locking up client, found by colten ! * Fixed bug with /bind meta1. found by colten ! * Fixed bug where brain-dead clients could crash us using DCC ! * Fixed bug with /dcc list. Help from wc ! * Fixed bug with /window remove. ! * Fixed bug with loading menus ! * Fixed bug when /oper-ing with wrong password ! * Fixed $read() to not return gibberish when EOF occurs. ! * Merged /FEC into /FE, now they both have the same semantics. ! * /WINDOW scroll depreciated ! * Fixed /me so output goes to correct window. ! * Fixed it so subsequent pages of /HELP go to the right screen. ! * Fixed bug that caused packet count to go nuts on DCC GET. ! * Added channel ignores from panasync. ! * Fixed bug with /encrypt-ion attempting to free() a static buffer. ! * Fixed a lot of addresses in info(). ! * Fixed gratuitous incompatability in ef2.9 servers with p_join(). ! * Allow new argument to /dcc send to specify local portnum ! * Added socks support from ircii-2.9 ! * Added support for CTCP PING to work to microsecond resolution. ! * Fixed /ignore #channel none to work right ! * Fixed $foo[$bar] when $bar is a lowercase value. ! * Major rewrite of CTCP and send_text subsystems with work on DCC too: ! * Can now send CTCPs over DCC CHAT reliably ! -- That means you can /encrypt =nick now ! * Can now encrypt CTCPs reliably, regular or DCC CHAT messages ! -- That means you can do CTCPs while /encrypt is on and theyll ! be encrypted (IE, CTCP DCC SENDs). ! * Now does sane pooling of targets ! -- That means those lame Write-all-channel-ops use 1 privmsg. ! * CTCP flood protection is more sane -- only one reply per privmsg. ! * Fixed bug with /PING not working ! * Fixed bug with calling passing retval from new_next_arg() to atol(). (Colten) ! * Fixed infinite recursion bug with /on send_*, found by electel. ! * Fixed bug with /msg %process found by Colten ! * Fixed incorrect levels with send_text(). Erf. ! * Fixed weakness with /eval (...[$0]) ! * Fixed /dcc send bug with sending multiple files (Colten) ! * Fixed bug where ignored text caused doing_notice to not get reset. ! * Fixed bug with /window bind (found by Kanan) ! * Fixed bugs with CTCP UTC overflowing buffer deficiency. ! * Fixed /window level to display level on no argument specified ! * Fixed it so publics should all go to the right window now. ! * Implemented /set DCC_SLIDING_WINDOW, sliding windows for dcc send's. ! * Fixed bug that kept us from recognizing simultaneous DCC GETs ! * Fixed /window add and /window remove to support nicks starting with '^' ! * Fixed 'away' script to not choke on nicks with '-' in them. ! * Fixed /msg . so it works again. ! * Fixed 'fe', 'ls' and 'tls' scripts (Archon) ! * Fixed AUTO_REJOIN so it rejoins in the correct window. ! * Implemented /xecho -current. ! * Fixed memory leak that Kanan reported. ! * Fixed windowing system's more obvious failures (with wc and Kanan) ! * Fixed /msg !... (history recall) ! * Added support for "recycle time" to the away script (for kanan) ! * Encrypting DCC sends should work if both peers are current epic clients. ! * Fixed infinite cycle with send_text() and add_to_window() (/redirect) ! * Fixed it so /exec -close twice didnt crash. ! * Fixed bug colten found in ctcp.c ! * Added support for /server host:port to save my sanity (and Nexx) ! * Implemented /call and script-level stack tracing ! * Implemented /set dcc_store_path, kanan asked for it ! * Implemented /set comment_hack to make it configurable at runtime ! * Applies patches from Yoshi for DCC RESUME so it works with braindead mirc ! * Increased the size of user mode status line field. ! * Put back the ``topic'' alias apparantly lost in 2.8script ! * Fixed obscure bug with /stack push on XXX when no /on's are present. ! * Fixed bug that upper()d variables before expansion rather than after. ! * Fixed a memory leak in new_key when /bind'ing parse_command. ! * Fixed bug when you do /disconnect twice. ! * Remove the ``option'' for COMMENT_HACK ! * Support both host:port:password:nick and ``host port password nick'' --- 1,11 ---- ! BUGS REPORTED, OUTSTANDING, OR FIXED SINCE LAST RELEASE (EPIC3.001) PENDING THINGS: -------------- BUGS FIXED/CHANGES MADE SINCE THE LAST RELEASE ---------------------------------------------- ! * Fixed $uniq(), i think ! * Fixed $numsort(), i hope ! * /ignore * crap -- /ignore * -crap -- doesnt remove the ignore. ! use /ignore * none to remove it totaly. (this is a ``feature''). diff -rcN ircii-EPIC3.001/UPDATES ircii-EPIC3.002/UPDATES *** ircii-EPIC3.001/UPDATES Mon Oct 14 07:29:37 1996 --- ircii-EPIC3.002/UPDATES Tue Oct 29 15:38:18 1996 *************** *** 1,3 **** --- 1,54 ---- + EPIC3.002 [[MINOR RELEASE]] + + *** News 10/29/96 -- New functionality to /timer + You may now specify any arbitrary string (up to 10 characters) + as the refnum for /timer. Example: + /timer -refnum foobar 10 echo booya booya booya boo! + + *** News 10/28/96 -- New script ``fake-dcc'' + I wrote a new script to demonstrate the two features below. + It allows the client to (at random) substitute any word out + of a list for the word ``DCC'' in a DCC handshake. The + reciever, if they have the same list of words, will then be + able to decode it using this script. + + *** News 10/28/96 -- New /on, /ON SEND_TO_SERVER + Any time anything is sent to a server, this will be hooked. It + takes three (or more) arguments: + + $0 - the server refnum + $1 - the unix filedescriptor + $2- - what is being sent + + Note that using this /on is very expensive -- expensive along the + same lines as /on raw_irc. So please use with discernment. + If you hook this SILENTLY, you will inhibit the sending of the + message to the server. You can then use /QUOTE to send a new + message. Please note that use of /QUOTE in /ON SEND_TO_SERVER + can cause an infinitely loop that will crash your client if you + are not careful. It is up to you to not do that. + + on ^send_to_server "% % % PRIVMSG % :$chr(1)DCC*" { + quote PRIVMSG $4 :$chr(1)$getrandword($fake_dcc) $6- + } + + + *** News 10/28/96 -- New command, /PRETEND + The pretend command allows you to ``pretend'' that a line has come + from the CURRENT server. Use of this command where the current + server is undefined results in undefined behavior. Use of this + command is expensive and can lead to convoluted scripting. You + (of course) can use it however you wanted, but i had in mind a way + to fake out the client when there is no other way to get around + some client limitation. See the ``fake-dcc'' script for an example + of such a case. + + on ^raw_irc "% PRIVMSG % :$chr(1)\\[$fake_dcc\\]*" { + pretend $0 $1 $2 :$chr(1)DCC $4- + } + + + EPIC3.001 [[FINAL PUBLIC RELEASE]] *** News 10/12/96 -- Solidified syntax for /SERVER diff -rcN ircii-EPIC3.001/doc/EPIC_ABOUT ircii-EPIC3.002/doc/EPIC_ABOUT *** ircii-EPIC3.001/doc/EPIC_ABOUT Tue Sep 17 14:32:43 1996 --- ircii-EPIC3.002/doc/EPIC_ABOUT Fri Nov 1 19:09:17 1996 *************** *** 25,34 **** ftp.neato.org /pub/irc hop ftp.crystalis.com /pub/EPIC Yoshi ftp.acronet.net /pub/ircii hop ftp.cs.vu.nl /pub/aradael/irc/client *Niels - ftp.undernet.org /pub/irc/clients *Mmmm lori.albany.net /pub/users/khuon/irc/clients *Wintrhawk - sphinx.punk.net /pub/irc/clients/unix/epic **CrowMan * -- means that as of my last check, site was not mirroring current client. ** -- means not being actively maintained --- 25,34 ---- ftp.neato.org /pub/irc hop ftp.crystalis.com /pub/EPIC Yoshi ftp.acronet.net /pub/ircii hop + ftp.cdc.net /pub/users/crimedog/irc/epic Crimedog + ftp.undernet.org /pub/irc/clients Mmmm ftp.cs.vu.nl /pub/aradael/irc/client *Niels lori.albany.net /pub/users/khuon/irc/clients *Wintrhawk * -- means that as of my last check, site was not mirroring current client. ** -- means not being actively maintained diff -rcN ircii-EPIC3.001/doc/EPIC_VERSIONS ircii-EPIC3.002/doc/EPIC_VERSIONS *** ircii-EPIC3.001/doc/EPIC_VERSIONS Sat Oct 12 21:56:21 1996 --- ircii-EPIC3.002/doc/EPIC_VERSIONS Fri Nov 1 19:16:23 1996 *************** *** 36,38 **** --- 36,39 ---- EPIC3pre8 - 02/28/96 8th Beta version - more of the same EPIC3 - 04/21/96 EPIC client V3.0 EPIC3.001 - 10/14/96 Major enhancements, efficiency, bugs. + EPIC3.002 - 11/01/96 Minor enhancements, bug fixes diff -rcN ircii-EPIC3.001/include/edit.h ircii-EPIC3.002/include/edit.h *** ircii-EPIC3.001/include/edit.h Fri Aug 9 22:27:32 1996 --- ircii-EPIC3.002/include/edit.h Mon Oct 14 13:00:49 1996 *************** *** 51,56 **** --- 51,58 ---- extern void oh_my_wait _((void)); extern int parse_command _((char *, int, char *)); extern void parse_line _((char *, char *, char *, int, int)); + extern void destroy_call_stack _((void)); + extern void panic_dump_call_stack _((void)); extern void load _((char *, char *, char *)); extern void query _((char *, char *, char *)); diff -rcN ircii-EPIC3.001/include/hook.h ircii-EPIC3.002/include/hook.h *** ircii-EPIC3.001/include/hook.h Thu Aug 1 23:24:29 1996 --- ircii-EPIC3.002/include/hook.h Mon Oct 28 06:35:30 1996 *************** *** 123,128 **** --- 123,129 ---- SEND_MSG_LIST, SEND_NOTICE_LIST, SEND_PUBLIC_LIST, + SEND_TO_SERVER_LIST, SERVER_NOTICE_LIST, SIGNOFF_LIST, SILENCE_LIST, diff -rcN ircii-EPIC3.001/include/server.h ircii-EPIC3.002/include/server.h *** ircii-EPIC3.001/include/server.h Sun Oct 13 20:09:56 1996 --- ircii-EPIC3.002/include/server.h Mon Oct 14 13:07:42 1996 *************** *** 129,134 **** --- 129,135 ---- extern void close_all_server _((void)); extern void disconnectcmd _((char *, char *, char *)); extern char *get_umode _((int)); + extern int find_server_refnum _((char *, char **)); /* server_list: the list of servers that the user can connect to,etc */ extern Server *server_list; diff -rcN ircii-EPIC3.001/include/timer.h ircii-EPIC3.002/include/timer.h *** ircii-EPIC3.001/include/timer.h Wed Mar 6 13:08:58 1996 --- ircii-EPIC3.002/include/timer.h Tue Oct 29 14:59:08 1996 *************** *** 9,16 **** /* functions that may be called by others */ extern void timercmd _((char *, char *, char *)); extern void ExecuteTimers _((void)); ! extern int add_timer _((long, long, int (*) (void *), char *, char *)); ! extern int delete_timer _((int)); extern time_t TimerTimeout _((void)); #endif /* _TIMER_H_ */ --- 9,16 ---- /* functions that may be called by others */ extern void timercmd _((char *, char *, char *)); extern void ExecuteTimers _((void)); ! extern char * add_timer _((char *, long, int (*) (void *), char *, char *)); ! extern int delete_timer _((char *)); extern time_t TimerTimeout _((void)); #endif /* _TIMER_H_ */ diff -rcN ircii-EPIC3.001/script/fake-dcc ircii-EPIC3.002/script/fake-dcc *** ircii-EPIC3.001/script/fake-dcc Wed Dec 31 18:00:00 1969 --- ircii-EPIC3.002/script/fake-dcc Mon Oct 28 07:04:29 1996 *************** *** 0 **** --- 1,32 ---- + /* + * Ok. Here is the plan: + * + * We have a variable, $fake_dcc, that contains a list of words that can + * be substituted for ``DCC'' as a CTCP. + * + * The sender randomly picks a word off that list and uses it. + * The reciever then reparses the handshake if its on his list. + * + * Don't be fooled. This script is not nearly as useful as it + * might be made to be. Its just a contrived example. + */ + + @ fake_dcc = [FOO BAR GOOTCHIE] + + /* + * Sender's side + */ + on ^send_to_server "% % % PRIVMSG % :$chr(1)DCC*" { + quote PRIVMSG $4 :$chr(1)$getrandword($fake_dcc) $6- + } + + /* + * Reciever's side + */ + on ^raw_irc "% PRIVMSG % :$chr(1)\\[$fake_dcc\\]*" { + pretend $0 $1 $2 :$chr(1)DCC $4- + } + + alias getrandword @ function_return = word($rand($numwords($*)) $*) + + #jfn'96 diff -rcN ircii-EPIC3.001/source/alias.c ircii-EPIC3.002/source/alias.c *** ircii-EPIC3.001/source/alias.c Fri Oct 11 22:38:09 1996 --- ircii-EPIC3.002/source/alias.c Wed Oct 23 23:35:20 1996 *************** *** 5831,5837 **** while (*oneptr && *twoptr) { ! while (*oneptr && *twoptr && !isdigit(*oneptr) && !isdigit(*twoptr)) { if (*oneptr != *twoptr) return (*oneptr - *twoptr); --- 5831,5837 ---- while (*oneptr && *twoptr) { ! while (*oneptr && *twoptr && !(my_isdigit(oneptr)) && !(my_isdigit(twoptr))) { if (*oneptr != *twoptr) return (*oneptr - *twoptr); *************** *** 5991,5996 **** --- 5991,5998 ---- { char **list = NULL, *booya = NULL; int listc, listi; + char *tval; + int val1; listc = splitw(word, &list); *************** *** 6008,6014 **** strcat(rmatch_input, " "); strcat(rmatch_input, booya); ! if (!function_rmatch(rmatch_input)) m_s3cat(&booya, space, list[listi]); free(rmatch_input); --- 6010,6020 ---- strcat(rmatch_input, " "); strcat(rmatch_input, booya); ! tval = function_rmatch(rmatch_input); ! val1 = atoi(tval); ! new_free(&tval); ! ! if (!val1) m_s3cat(&booya, space, list[listi]); free(rmatch_input); diff -rcN ircii-EPIC3.001/source/dcc.c ircii-EPIC3.002/source/dcc.c *** ircii-EPIC3.001/source/dcc.c Thu Oct 10 00:22:13 1996 --- ircii-EPIC3.002/source/dcc.c Mon Oct 14 12:58:51 1996 *************** *** 401,407 **** --- 401,409 ---- struct in_addr myip; int rl = sizeof(remaddr); int old_server; + #ifdef MIRC_BROKEN_DCC_RESUME char buf[10]; + #endif user = Client->user; old_server = from_server; diff -rcN ircii-EPIC3.001/source/edit.c ircii-EPIC3.002/source/edit.c *** ircii-EPIC3.001/source/edit.c Sat Oct 12 18:58:22 1996 --- ircii-EPIC3.002/source/edit.c Sat Nov 2 21:38:16 1996 *************** *** 142,147 **** --- 142,148 ---- static void oper _((char *, char *, char *)); static void pingcmd _((char *, char *, char *)); static void pop_cmd _((char *, char *, char *)); + static void pretend_cmd _((char *, char *, char *)); static void push_cmd _((char *, char *, char *)); static void quote _((char *, char *, char *)); static void realname_cmd _((char *, char *, char *)); *************** *** 236,242 **** { "FLUSH", NULL, flush, 0 }, { "FOR", NULL, forcmd, 0 }, /* if.c */ { "FOREACH", NULL, foreach, 0 }, /* if.c */ - { "HASH", "HASH", send_comm, 0 }, { "HELP", NULL, help, 0 }, /* help.c */ { "HISTORY", NULL, history, 0 }, /* history.c */ { "HOOK", NULL, hook, 0 }, --- 237,242 ---- *************** *** 278,283 **** --- 278,284 ---- { "PART", "PART", send_channel_com, 0 }, { "PING", NULL, pingcmd, 0 }, { "POP", NULL, pop_cmd, 0 }, + { "PRETEND", NULL, pretend_cmd, 0 }, { "PUSH", NULL, push_cmd, 0 }, { "QUERY", NULL, query, 0 }, { "QUEUE", NULL, queuecmd, 0 }, /* queue.c */ *************** *** 723,729 **** */ sprintf(temp, "ircII %s didn't want to be here!", irc_version); #else ! sprintf(temp, "ircII%s --- This is the last release! I promise!", irc_version); #endif Reason = (*args ? args : temp); max = server_list_size(); --- 724,730 ---- */ sprintf(temp, "ircII %s didn't want to be here!", irc_version); #else ! sprintf(temp, "ircII%s --- Bloatware at its finest.", irc_version); #endif Reason = (*args ? args : temp); max = server_list_size(); *************** *** 1520,1525 **** --- 1521,1532 ---- new_free(&blah); } + BUILT_IN_COMMAND(pretend_cmd) + { + parse_server(args); + } + + BUILT_IN_COMMAND(push_cmd) { char *blah = function_push(args); *************** *** 1598,1604 **** !in_on_who && !doing_privmsg && #endif args && *args) ! send_to_server("%s", args); } /* This code is courtesy of Richie B. (richie@morra.et.tudelft.nl) */ --- 1605,1611 ---- !in_on_who && !doing_privmsg && #endif args && *args) ! send_to_server("%1024s", args); } /* This code is courtesy of Richie B. (richie@morra.et.tudelft.nl) */ diff -rcN ircii-EPIC3.001/source/hook.c ircii-EPIC3.002/source/hook.c *** ircii-EPIC3.001/source/hook.c Wed Sep 18 21:32:25 1996 --- ircii-EPIC3.002/source/hook.c Mon Oct 28 06:37:48 1996 *************** *** 113,118 **** --- 113,119 ---- { "SEND_MSG", (Hook *) 0, 2, 0, HF_NORECURSE }, { "SEND_NOTICE", (Hook *) 0, 2, 0, HF_NORECURSE }, { "SEND_PUBLIC", (Hook *) 0, 2, 0, HF_NORECURSE }, + { "SEND_TO_SERVER", (Hook *) 0, 3, 0, 0 }, { "SERVER_NOTICE", (Hook *) 0, 1, 0, 0 }, { "SIGNOFF", (Hook *) 0, 1, 0, 0 }, { "SILENCE", (Hook *) 0, 2, 0, 0 }, diff -rcN ircii-EPIC3.001/source/irc.c ircii-EPIC3.002/source/irc.c *** ircii-EPIC3.001/source/irc.c Fri Oct 11 23:28:18 1996 --- ircii-EPIC3.002/source/irc.c Fri Nov 1 19:15:12 1996 *************** *** 13,25 **** /* * irc_version is what $J returns, its the common-name for the version. */ ! const char irc_version[] = "2.8.2-EPIC3.001"; /* * internal_version is what $V returns, its the integer-id for the * version, and corresponds to the date of release, YYYYMMDD. */ ! const char internal_version[] = "19961014"; #include --- 13,25 ---- /* * irc_version is what $J returns, its the common-name for the version. */ ! const char irc_version[] = "2.8.2-EPIC3.002"; /* * internal_version is what $V returns, its the integer-id for the * version, and corresponds to the date of release, YYYYMMDD. */ ! const char internal_version[] = "19961101"; #include diff -rcN ircii-EPIC3.001/source/server.c ircii-EPIC3.002/source/server.c *** ircii-EPIC3.001/source/server.c Mon Oct 14 07:27:45 1996 --- ircii-EPIC3.002/source/server.c Mon Oct 28 06:53:09 1996 *************** *** 36,42 **** static void add_to_server_buffer _((int, char *)); static char * do_umode (int du_index); - extern int find_server_refnum _((char *, char **)); /* * Don't want to start ircserv by default... --- 36,41 ---- *************** *** 907,913 **** if (refnum == -1) { say ("Connecting to refnum -1. That makes no sense."); ! return; /* XXXX */ } attempting_to_connect++; --- 906,912 ---- if (refnum == -1) { say ("Connecting to refnum -1. That makes no sense."); ! return -1; /* XXXX */ } attempting_to_connect++; *************** *** 1194,1204 **** char *subargs; #endif { ! char *server = NULL, ! *port = NULL; ! char *pass = NULL; ! int port_num = irc_port, ! i; if ((server = next_arg(args, &args)) != NULL) { --- 1193,1200 ---- char *subargs; #endif { ! char *server = NULL; ! int i; if ((server = next_arg(args, &args)) != NULL) { *************** *** 1854,1860 **** strmcat(buffer, "\n", IRCD_BUFFER_SIZE); if (x_debug) yell("[%d] -> [%s]", des, buffer); ! send(des, buffer, strlen(buffer), 0); } else { --- 1850,1857 ---- strmcat(buffer, "\n", IRCD_BUFFER_SIZE); if (x_debug) yell("[%d] -> [%s]", des, buffer); ! if (do_hook(SEND_TO_SERVER_LIST, "%d %d %s", server, des, buffer)) ! send(des, buffer, strlen(buffer), 0); } else { diff -rcN ircii-EPIC3.001/source/timer.c ircii-EPIC3.002/source/timer.c *** ircii-EPIC3.001/source/timer.c Sat Oct 12 21:05:58 1996 --- ircii-EPIC3.002/source/timer.c Tue Oct 29 14:59:54 1996 *************** *** 29,43 **** #ifdef __STDC__ void timercmd (char *command, char *args, char *subargs) #else ! void timercmd(command, args, subargs) ! char *command; ! char *args; ! char *subargs; #endif { char *waittime, *flag; ! int want = -1; char *ptr; if (*args == '-' || *args == '/') --- 29,41 ---- #ifdef __STDC__ void timercmd (char *command, char *args, char *subargs) #else ! void timercmd (command, args, subargs) ! char *command,*args,*subargs; #endif { char *waittime, *flag; ! char *want = empty_string; char *ptr; if (*args == '-' || *args == '/') *************** *** 53,75 **** if (!my_strnicmp(ptr, "A", 1)) delete_all_timers(); else ! delete_timer(atoi(ptr)); } return; } else if (!my_strnicmp(flag+1, "R", 1)) /* REFNUM */ { ! char *dammit = next_arg(args, &args); ! if (dammit) ! { ! if ((want = atol(dammit)) < 0) ! { ! say("%s: Illegal refnum %s", command, ltoa(want)); ! return; ! } ! } ! else { say("%s: Missing argument to -REFNUM", command); return; --- 51,65 ---- if (!my_strnicmp(ptr, "A", 1)) delete_all_timers(); else ! delete_timer(ptr); } return; } else if (!my_strnicmp(flag+1, "R", 1)) /* REFNUM */ { ! want = next_arg(args, &args); ! if (!want || !*want) { say("%s: Missing argument to -REFNUM", command); return; *************** *** 96,104 **** * This is put here on purpose -- we dont want any of the above functions * to have any knowledge of this struct. */ typedef struct timerlist_stru { ! int ref; int in_on_who; time_t time; int (*callback) _((void *)); --- 86,95 ---- * This is put here on purpose -- we dont want any of the above functions * to have any knowledge of this struct. */ + #define REFNUM_MAX 10 typedef struct timerlist_stru { ! char ref[REFNUM_MAX + 1]; int in_on_who; time_t time; int (*callback) _((void *)); *************** *** 108,114 **** } TimerList; static TimerList *PendingTimers; ! static int current_exec_timer = -1; /* * ExecuteTimers: checks to see if any currently pending timers have --- 99,105 ---- } TimerList; static TimerList *PendingTimers; ! static char *current_exec_timer = empty_string; /* * ExecuteTimers: checks to see if any currently pending timers have *************** *** 118,124 **** * * changed the behavior: timers will not hook while we are waiting. */ ! extern void ExecuteTimers _((void)) { time_t current; TimerList *next; --- 109,115 ---- * * changed the behavior: timers will not hook while we are waiting. */ ! void ExecuteTimers (void) { time_t current; TimerList *next; *************** *** 157,163 **** new_free(&PendingTimers->subargs); } ! current_exec_timer = -1; next = PendingTimers->next; new_free((char **)&PendingTimers); PendingTimers = next; --- 148,154 ---- new_free(&PendingTimers->subargs); } ! current_exec_timer = empty_string; next = PendingTimers->next; new_free((char **)&PendingTimers); PendingTimers = next; *************** *** 173,180 **** #ifdef __STDC__ static void show_timer (char *command) #else ! static void show_timer(command) ! char *command; #endif { TimerList *tmp; --- 164,171 ---- #ifdef __STDC__ static void show_timer (char *command) #else ! static void show_timer (command) ! char *command; #endif { TimerList *tmp; *************** *** 194,200 **** time_left = tmp->time - current; if (time_left < 0) time_left = 0; ! say("%-5d %-10d %s", tmp->ref, time_left, tmp->command); } } --- 185,191 ---- time_left = tmp->time - current; if (time_left < 0) time_left = 0; ! say("%-10s %-10d %s", tmp->ref, time_left, tmp->command); } } *************** *** 208,267 **** * which should elicit an error, not be silently punted. */ #ifdef __STDC__ ! static int create_timer_ref (int want) #else ! static int create_timer_ref(want) ! int want; #endif { TimerList *tmp; ! int ref = 1; ! int done = 0; ! /* ! * Please dont define this except for when you absolutely need it ! * for backwards compatability and the script cannot possibly be ! * fixed to circumvent this. ! * The use of timer refnum 0 should be deprecated since it is ! * impossible to differentiate it from a real error *sigh* ! */ ! #ifndef USE_TIMER_REFNUM_ZERO ! if (want == 0) ! ref = -1; ! else ! #endif ! if (want == -1) { ! while (!done) { ! done = 1; ! for (tmp = PendingTimers; tmp; tmp = tmp->next) ! { ! if (ref == tmp->ref) ! { ! ref++; ! done = 0; ! break; ! } ! } } } - else { ! ref = want; for (tmp = PendingTimers; tmp; tmp = tmp->next) { ! if (ref == tmp->ref) ! { ! ref = -1; ! break; ! } } } ! return (ref); } /* --- 199,240 ---- * which should elicit an error, not be silently punted. */ #ifdef __STDC__ ! static int create_timer_ref (char *refnum_want, char *refnum_gets) #else ! static int create_timer_ref (refnum_want, refnum_gets) ! char *refnum_want, *refnum_gets; #endif { TimerList *tmp; ! int refnum = 0; ! /* Max of 10 characters. */ ! if (strlen(refnum_want) > REFNUM_MAX) ! refnum_want[REFNUM_MAX] = 0; ! /* If the user doesnt care */ ! if (!strcmp(refnum_want, empty_string)) { ! /* Find the lowest refnum available */ ! for (tmp = PendingTimers; tmp; tmp = tmp->next) { ! if (refnum < atoi(tmp->ref)) ! refnum = atoi(tmp->ref); } + strncpy(refnum_gets, ltoa(refnum+1), REFNUM_MAX); } else { ! /* See if the refnum is available */ for (tmp = PendingTimers; tmp; tmp = tmp->next) { ! if (!my_stricmp(tmp->ref, refnum_want)) ! return -1; } + strncpy(refnum_gets, refnum_want, REFNUM_MAX); } ! return 0; } /* *************** *** 272,286 **** * handle it. Probably will be that way in a future release. */ #ifdef __STDC__ ! extern int delete_timer (int ref) #else ! extern int delete_timer (ref) int ref; #endif { TimerList *tmp, *prev; ! if (current_exec_timer != -1) { say("You may not remove a TIMER from itself"); return -1; --- 245,260 ---- * handle it. Probably will be that way in a future release. */ #ifdef __STDC__ ! int delete_timer (char *ref) #else ! int delete_timer (ref) ! char *ref; #endif { TimerList *tmp, *prev; ! if (current_exec_timer != empty_string) { say("You may not remove a TIMER from itself"); return -1; *************** *** 289,295 **** for (prev = tmp = PendingTimers; tmp; prev = tmp, tmp = tmp->next) { /* can only delete user created timers */ ! if (tmp->ref == ref) { if (tmp == prev) PendingTimers = PendingTimers->next; --- 263,269 ---- for (prev = tmp = PendingTimers; tmp; prev = tmp, tmp = tmp->next) { /* can only delete user created timers */ ! if (!my_stricmp(tmp->ref, ref)) { if (tmp == prev) PendingTimers = PendingTimers->next; *************** *** 305,315 **** return 0; } } ! say("TIMER: Can't delete %d, no such refnum", ref); return -1; } ! static void delete_all_timers _((void)) { while (PendingTimers) delete_timer(PendingTimers->ref); --- 279,289 ---- return 0; } } ! say("TIMER: Can't delete (%s), no such refnum", ref); return -1; } ! static void delete_all_timers (void) { while (PendingTimers) delete_timer(PendingTimers->ref); *************** *** 339,367 **** * subargs: should be NULL, its ignored anyhow. */ #ifdef __STDC__ ! int add_timer(long refnum_want, long when, int (callback) (void *), char *what, char *subargs) #else ! int add_timer (refnum_want, when, callback, what, subargs) ! long refnum_want, when; int (callback) (); ! char *what, *subargs; #endif { TimerList **slot, *ntimer; ntimer = (TimerList *) new_malloc(sizeof(TimerList)); ntimer->in_on_who = in_on_who; ntimer->time = time(NULL) + when; - ntimer->ref = create_timer_ref(refnum_want); ! if (ntimer->ref == -1) { ! say("TIMER: Refnum %d already exists", refnum_want); new_free((char **)&ntimer); ! return -1; } ! ntimer->callback = callback; if (callback) { --- 313,342 ---- * subargs: should be NULL, its ignored anyhow. */ #ifdef __STDC__ ! char *add_timer(char *refnum_want, long when, int (callback) (void *), char *what, char *subargs) #else ! char *add_timer(refnum_want, when, callback, what, subargs) ! char *refnum_want, what, subargs; int (callback) (); ! long when; #endif { TimerList **slot, *ntimer; + char refnum_got[REFNUM_MAX + 1]; ntimer = (TimerList *) new_malloc(sizeof(TimerList)); ntimer->in_on_who = in_on_who; ntimer->time = time(NULL) + when; ! if (create_timer_ref(refnum_want, refnum_got) == -1) { ! say("TIMER: Refnum '%s' already exists", refnum_want); new_free((char **)&ntimer); ! return NULL; } ! ! strcpy(ntimer->ref, refnum_got); ntimer->callback = callback; if (callback) { *************** *** 390,396 **** * TimerTimeout: Called from irc_io to help create the timeout * part of the call to select. */ ! time_t TimerTimeout _((void)) { time_t current; time_t timeout_in; --- 365,371 ---- * TimerTimeout: Called from irc_io to help create the timeout * part of the call to select. */ ! time_t TimerTimeout (void) { time_t current; time_t timeout_in;