CVS log for epic4/source/server.c |
![]() |
Request diff between arbitrary revisions
Fix crash when doing /nick <unique id> on ircnet.
* Fix error messages when you /exec -direct asdf, from epic5. * Add more gracious support for unique id's and nickname 0, from epic5.
* Fix 'get_local_server_port', add $serverctl(GET * LOCALPORT). (fudd)
* Allow /userhost <uniqueid> for ircnet. * Allow 'epic 0 <servername' for ircnet.
* Implement "unique id" support for ircnet (042 numeric) * You can /nick 0 or /nick <unique_id> * You can use $servertctl([SET|GET] <refnum> UNIQUE_ID)
* Patch from |Rain| which fixes the SSL bug he reported to the list.
Changes agreed to in principle by: ce * Make /server <host> honor server groups if can't connect to <host> * Make reconnects use the server group of NEW server not OLD server.
Clean up after the server lists upon exit, for valgrind users.
* Allow $serverctl(SET <refnum> UMODES)
Fix panic caused by accidentally allowing the user to /server -delete all their servers. (fix is to not allow them to delete the last server)
* Fix buffer overrun crash with CTCP UTC.
Overhaul of malloced string handling functions: * Convert m_[s]c3cat[_s]() to malloc_strcat_wordlist_c() * Nix m_e3cat(), m_s3cat(), m_s3cat_s(), m_3cat() * Nix m_ec3cat(), m_sc3cat(), m_sc3cat_s(), m_c3cat(). * Convert m_dupchar() to malloc_dupchar(). * Convert m_strndup() to malloc_strndup(). * Make malloc_strcpy/malloc_strcat/malloc_strcat2/malloc_strcat_wordlist macros * Convert m_2dup() to malloc_strdup2(). * Convert m_3cat() to malloc_strcat2[_c](). * Convert m_3dup() to malloc_strdup3(). * Convert m_ec3cat() to malloc_strcat2_c() * Use strlcat_c() in $repeat() instead of strlcpy(). whee! * Sanity check first arg to $regcomp(), to avoid crashes. * Don't pass NULL to bsearch(), even if 'nmem' is 0 [$remws()] * Nix the original malloc_strcpy (supplanted by malloc_strcpy_c) * Comment out all the deprecated functions
Convert m_strdup() to malloc_strdup().
Fix bug where /away <new reason> would not overwrite previous reason. Reported by hsoc.
* Rename 'dcc()' to 'dcc_cmd()' so we can use dcc as variable
* Garbage collect unused 'irc_path' global variable.
* Add --with-warns to configure to do FreeBSD "WARNS" like compiler checks
* Many hundreds of changes to improve the "quality of code" in epic, including:
* - Treat all literal strings as (const char *) and fix const correctness.
* - Mopping up all remaining const-correctness issues
* - Do not "launder" a (const char *) to a (char *) in string searches, (ala
strchr) but rather return a ssize_t offset value.
* - Particular, MatchingBracket() returns (ssize_t) and not (char *).
* - Eliminate all "shadow" variable names by changing them to something else.
* - Eliminate most function decls that do not include a prototype list.
* - Add prototypes for all extern functions that are missing them.
* - Ensure most function pointers include a prototype list.
* - In term.c, most of those (char *)'s are really (const char *)'s.
* - Explicitly specify 'static' functions as 'static'
* - Ensure every function is either 'static' or has a prototype.
* - Eliminate (unsigned) < (signed) type comparisons.
* Hopefully you should not notice any changes!
These are relatively minor changes except for the $prefix() fix. * commandqueues as per UPDATES. * $prefix() fix and regression test as per KNOWNBUGS. * /exec and nick rolling as per KNOWN bugs.
Nominally remove all uses of "unsafe" functions: (Commit 506)
* Convert all uses of strcpy() to strlcpy()
* Convert all uses of strcat() to strlcat()
* Convert all uses of strmcpy() to strlcpy()
* Convert all uses of strmcat() to strlcat()
* Convert all uses of sprintf() to snprintf()
* As much as possible, use 'sizeof var' in snprintf/strlcpy/strlcat.
* Qualify the size of some global vars so we can sizeof() them.
* Nuke strmcpy(), strmcat(), strmcat_ue(), strmccat(),
* Change strmopencat() to strlopencat().
* Change strmpcat() to strlpcat().
* Fix switch_hostname so it doesn't return a (const) string.
* Fix TimerTimeout so it doesn't return a (const) Timeval.
* Change things like (ret) to do ret while (0); for when "ret" is "{}".
* Fix initialization for load_level
* Stop passing in static strings into io(), so we can modify them.
* Make messages passed to io() more informative to the user.
* Fix CTCP FINGER handler not to assume (struct pw) strings can be overwritten.
* Use (socklen_t) and not an (int) for socket sizes.
* Don't return a value in a void function...
* Don't use return value of process_dcc_chat_ctcps() for assignment.
* Don't put semicolons after function bodies
* Fix $getopt() to save 'input_size' so we can use it with strl*().
* Convert all uses of stpcpy() to strlcat() and strlopencat().
* Nix checks for stpcpy() in configure -- regen configure.
* New /set, /SET SWITCH_CHANNELS_BETWEEN_WINDOWS * C language issues (const correctness, integer size correctness) * Revamp channel structure to hold window refnum and not window pointer * Add "current channel counter" to channel structure. * Determine "current channel" by election. * Garbage collect a lot of now unnecessary code. * Add get_echannel_by_refnum(), returns window's "elected" current channel * Add internal function is_waiting_for_channel() * Add internal function move_waiting_channel() * Add internal function get_winref_by_bound_channel() * Add internal function get_bound_channel_by_refnum() * Convert uses of get_channel_by_refnum() to get_echannel_by_refnum() * Fix $winbound() to work when given a window refnum * Fix valgrind issue with $regcomp() * Remove sanity checks from traverse_all_channels(); handled elsewhere now * Change traverse_all_channels() with "this server" or "not this server" arg * Nuke (Window *)->current_channel. Handled by channels now. HUZZAH! * Implement /ON SWITCH_WINDOWS again.
Okay. User input is now handled specially, and parse_command() will not accept incomplete command names anymore. -wd
Another merge.
Whooo! I'm on a roll! Commit #487
* Add /timer -delete_for_window <winref> to delete window's timer.
* Enhance my_strerror() to take an EPIC Network Error and an errno.
* Enhance Getaddrinfo() to use AF_UNIX path as 'path' not 'host'.
* Confirmed that $match("\\[s s1 "s *"\\]" "s s") works like it should now.
* Store a "current window priority" number in each window.
* Add get_winref_by_servref() returns highest "priority" window for a server
* Have /defer track server, use server's "current window" (per above)
* I'd like to have other things use this, like maybe /xeval -s.
* Move add_user_who, add_user_end from parse.c to numbers.c * Add (set|get)_server_max_cached_chan_size(), max chan size for u@h caching. * Add $serverctl(SET|GET <refnum> MAXCACHESIZE), largest channel we do WHO for. * Move 'whobase' call from /on join to /on 324. * Don't call 'whobase' (userhost caching) if too many users on channel.
Fix various specious warnings from gcc, also, don't test for "sun_len" in configure; use "sa_len" test for that.
* Reorganize param list to dgets() to include a length argument * Add (set|get)_server_line_length(), the maximum size of an irc protocol line. * Convert dgets() callers to the new calling style.
* $dccctl() changes as per UPDATES. * Misc bug fixes as per KNOWNBUGS.
Yikes. Merged to become consistent with HEAD. Sorry for all the commits, I'll be quiet again soon. :) -wd
* "Word Philosophy" alterations, /alias leak, flood checking, $glob(),
tabkey.ce, regression tests, autoget, /fe, /fec, safe_new_next_arg, as
per KNOWNBUGS.
* $findws(), functions (script), ${i}finditems(), $dccctl(), as per
UPDATES.
* New aliases for script/functions as per UPDATES. * A tentative solution for the $glob() problem as per KNOWNBUGS. * A leak fix for /list as per KNOWNBUGS. * $timerctl() tuning as per UPDATES.
Commit 443 * Uniformly use 32 bit file sizes in dcc. That's the way it has to be. * Split process_incoming_chat into modular functions. It's an experiment. * Remove the old, #if 0'd dcc_getfile_resume. * Remove the second, redundant warning from /window refnum(_or_swap). * Make the ArgList portion of server messages const. All const! Huzzah! * Roll /names, /list, and /mode numeric handlers into numbers.c * Roll "funny" global variables into server-specific variables * Nuke funny.c and funny.h -- huzzah! * /on window_kill provides two args now, $0 is refnum, $1 is name/refnum. * Rename "numeric_banner" to "banner" * Rename "parse_notice" to "p_notice" * In /xecho, rename 'banner' local var to 'want_banner'. * Revamp p_notice to look like and act like p_privmsg as much as possible. * Finish the rest of the larnifications. Done with phase 1. Huzzah!
* Whoops, two mistakes.. Forgot to swap $serverctl() UMODE and UMODES, and also forgot to commit it afterwards. :-)
* Added Tyraks /stack patch as per KNOWNBUGS. * $afterw(), $beforew(), $fromw(), $tow() as per UPDATES. *potential bug* * Regress tests as per KNOWNBUGS. * ERROR hook fix as per KNOWNBUGS. * autoget script as per KNOWNBUGS. * $serverctl() as per UPDATES. * $writeb() as per UPDATES. * /sleep as per UPDATES.
Fixed a bug where epic would crash if you tried to connect to a non-ssl server using ssl. -wd
Commit 436 This commit is deceptive because it is huge in scope but can be explained pretty simply. * Const correctness improvements. * Invert the meaning of 'new_check_flooding' to return TRUE if flooding. * Revamp funny.c, /list, /names, /mode reply handling. * Remove unused joined_nick, public_nick * Change got_initial_version_28() arguments singly and not an array * Change signature of protocol handling to take "command" as an argument * The above change cascades to a lot of other changes. * Allow the /msg'ing of @W<refnum> to msg a window's refnum. * First round of larnification (Protection against unexpected server data) * This involved substantial rewrites of parse.c, and numbers.c * Now "fake" stuff goes through /on odd_server_stuff. * Fix /on invite so it takes 3 arguments, not 2.
Commit #430 Fix bug when you're connected to two servers in two windows, each with channels, and you /server from one over to the other. The bug was a panic caused by me changing a -2 into NOSERV instead of into a -3. Doh.
Fix all the rest of the compile issues. bleh.
* Fixed a leak in /window channel. * Fixed a couple of leaks in /server -d. * Added $finditems() but it isn't finished yet, so it's #ifed out.
* Fix minor bug with /xquote * Fix minor bug with reconnecting after server write failed. * Set input idle timer better. * Rewrite /stack (push|pop) set so they actually work now.
* Remove colon at end of RETURN_MSTR so it is like others. * Unify dgets() and SSL_dgets() * Add a 4th argument to dgets(), an (SSL *) for ssl reads, NULL for normals * Integrate SSL stuff more tightly by removing unecessary #ifdef's * Change 'enable_ssl' to 'try_ssl' to avoid confusion with 'ssl_enabled' * Remove uneccesary members of (Window) * #include "functions.h" in any file implementing built in functions. * panic if ssl op attempted on non-ssl connection. * Don't call functions in RETURN_* macros. (they're evaled twice) * Nuke #ifdef 0'd uses of 'ceiling_of_display'
Fix bugs with send_to_aserver().
Don't throw a random number into /ON SEND_TO_SERVER.
* Use server_list_size() and not number_of_servers outside of server.c * Use NOSERV and not -1 for "no server" * Use (Timeval) and not (struct timeval) * Fix (get|set)_server_sent_*() et al to take server refnum. * Use parse_server_index() and not my_atol() to parse server refnums * re-indent quotecmd * Rename is_server_connected() to is_server_registered * Make /quote work as long as server is open (not registered) * Use send_to_aserver() when it can avoid setting from_server unecessarily * Change sent_to_server and clear_sent_to_server to (set|get)server_sent(). * Change doing_* to get_server_doing_*. * Use (unsigned short) and not (u_short) * Use (unsigned long) and not (u_long) * Make output_reject_ctcp() take a refnum * Lock a dcc while we are connecting it, just in case. ;-) * Fix /dcc send -p <port> * Store protocol enforcements as (get|set)_server_protocol_state(). * Use (Stat) and not (struct stat) * Rewrite $timerctl() so it works like $logctl() * Rename is_server_connected() to is_server_registered() * Fix an off-by-one error with /FOR ... IN ... * Keep track of both readable and writable fd's with newio stuff. * Convert server_list to an array of pointers * When user /server -delete's, leave a gap, don't change refnums around. * Nix code that handles deleting server refnums. * New function, new_open_for_writing(), for when we do nonblocking connects. * Change new_open() to deregister fd as "writable" * Renovate the notify stuff to take refnums and not just use from_server. * Renovate /WHO, /ISON, /USERHOST to take refnums and not just use from_server. * Make everything that uses server_list[] use get_server() instead. * Make everything capable of dealing with "gaps" in server_list[]. * Use a bunch of macros, to handle with getting and setting server attrs. * Make as much as possible use refnums as params and not from_server. * And a lot of other stuff...
* Added functions $asciiq() $chrq() $exec() $timerctl() $tcl() $winline() and $floodinfo(). * Altered the two argument version of $read() to ctcp quote the strings it returns. * Added sets FLOOD_RATE_PER and FLOOD_MASKUSER. * Altered the "accept" mode of the dcc_raw and dcc_connect hooks to refer to the local port instead of the remote port. * Added a "-closein %proc" switch to /exec. * Altered the arg list mode of /alias to use extractw instead of next_arg. * Added the documented "words" argument to the above. * Tuned autoget, mudirc, tabkey.ce and commandqueues. * Altered /pretend to not chop the string. * Set about rewriting the flood detection and then decided that it's better off being a script. * Moved the function macros to their own file (functions.h) and replaced all the copies that are strewn throughout the source with an #include. The exception is array.c which broke when I tried it. * Moved the ctcp enquoting/dequoting functions to ircaux.c. * Added some command/function ordering checks to funcs/regress, and a check for all the functions that are undocumented. * Rewrote function chanmodetype() so that it doesn't have all those flakey buffering things. Hopefully it's readable now. The significant change is that if a mode character appears twice in CHANMODES, the first one is returned instead of the last. * Added EPIC::call() in the perl routines and an equivalent under tcl. this is designed to call a $function() directly, but it isn't really that fast, so I might rip them out again. * The /wait internals used to store a few other settings, which were taken out, so I put them back. * Fixed a few problems with normalize_filename() around the place. * Fixed a bug with /timer in which it would never show the timers after a callback.
* Fix /wait (server_hard_wait()) so it tracks/resets from_server (fb CE) * Fix /timer so it tracks from_server properly (fb CE)
* Change do_input_timeouts() to a timer callback. * Nuke the now unused global /wait stuff * Revamp timer.c so you can add/change/delete/update timers during a timer * Change add_timer() so it takes a winref not a window pointer. * Make the "key timeout" thing happen on demand instead of a recurring timer * Remove the recurring "key timeout" timer. * Remove the 'key timeout' thing from io(), also 'first time' stuff. * Call get_time() after select() in io(). * Fix two compile bugs found by larne. * Fix bug when you did /flush on a /clear window.
Another round of epic5 changes... * Make $B, $., $,, $:, $;, $I, /WAIT stuff server specific, from epic5 * Make tracking of doing_(privmsg|notice|ctcp) server specific, from epic5 * Fixes for Const Correctness.
* Remove /set suppress_server_motd which didn't really work anyways. * Add function decls for bsd_arc4* to ircaux.c * Always check (window->hold_mode || window->autohold) together! * Unhold_window()s only if both hold_mode and autohold are off! * unhold_window()s instead of doing scrollback_end for robustness. * Attempt to recover from the "output is below bottom of window" bug, whine.
* Add checks/workaround for linux's broken realpath(). Bleh. * Add arc4random stuff to compat.c -- will be used later! * Fix $realpath() to use normalize_filename() so it gets realpath() fix. * Add $serverctl(SET <refnum> PRIMARY) to set primary server. User beware!
* Change expand_twiddle(), path_search() to take results as params, int retval * Add normalize_filename(), to do job expand_twiddle() used to do. * Add isdir(), just because * Change /CD, /LOAD, /SAVE, /DCC SEND, /DCC GET, to use normalize_filename. * Change /DCC RESUME, $open(), $which(), $unlink() to use normalize_filename. * Change $rename(), $rmdir(), $fexist(), $fsize() to use normalize_filename. * Change $glob(), $globi(), $mkdir(), $chmod() to use normalize_filename. * Change $ftime(), $randread(), and uzfopen() to use normalize_filename. * Change /LOG, /SET LOGFILE, servers file to use normalize_filename. * Fix /LOG so maximum number of targets per log is a compile time #define. * Revamp expand_twiddle() and uzfopen(). * Fix uzfopen() to look for 'bunzip2' in addition to 'bunzip'. * Fix bug with /QUEUE -delete * Remove unused variable in window_scroll().
Ach. Here goes nothing. Major commit which does many things, but the most prominent of which is the final integration of the scrollback buffer with the hold buffer. This fixes several annoying "features" and introduces a small truckload of new features which have been requested recently. Please see the KNOWNBUGS or UPDATES file for more info, since I don't want this message to be ridiculously long.
* Fix expand_twiddle to take a (const char *) * Fix do_log and set_log_file to take a (const char *) * Remove a couple of no-ops in keys.c * Revamp do_log into two parts; open_log and close_log; do_log now a wrapper. * Fix a string that had a newline in it. spotted by Szabolcs Rumi.
Cleaned up a few -Wall warnings.
Reword the /set dcc_use_gateway_addr warning to make it clear that this warning is only for IPv4 addresses.
Fix $ischannel() (actually, is_channel()) to return 0 if a NULL or empty_string is passed. Also fixed a typo inre serverctl comments. -wd
* Added support for CHANMODES, PREFIX and CHANTYPES in the processing of modes. If the server doesn't support these, then hopefuly sane default strings are chosen, and these _don't_ include the wacky extensions that have been added over the years, so conceivably, this could break things like halfops and ban/invite exemptions. * Stored the UMODES field from the 004 numeric in the server data. Can be retrieved with $serverctl(get x umodes). * Altered "/msg @$fd" so that $fd must be a number, otherwise, it will be treated as a privmsg. * Added $xdebug() which returns all single bit flags with + or - added as appropriate. /xdebug $xdebug() is a no-op. * Fixed an /xdebug bug in which - would cause all subsequent flags to be switched off. For bug compatibility, it still works this way, but you can specify + to turn all subsequent values on. * Altered m_sc3cat_s() to call m_sc3cat rather than m_c3cat, which results in a cleaner string. Examination of the uses of this function showed that they all dealt with this bug in some way. * Altered $which() to call path_search() directly, rather than uzfopen(). It may be useful to add a flag to path_search indicating which attributes we are searching for. This could cause problems since the old method would skip over a file if it wasn't readable. * Added clue variables for $unsplit().
Updated comment field for serverctl() -wd
Update copyright notices and copyright dates.
* Added 005 framework. The internal interfaces to this are get_server_005() and set_server_005(). The scripting interface is $serverctl([gs]et [ref] 005 [set] [[value]]). Unsetting is done by setting a null value, and $serverctl(..set..) will return 1 for set or 0 for unset. All values are reset upon successful reconnect. * Altered $rand() to be more conservative when drawing on the random data source. It should be faster for lower max-values now. * Altered $splice() somehow. I think it was for the clue variables. It didn't improve the speed due to other problems, but it still works.
* Add Getnameinfo(), front end to getnameinfo() takes GNI_INTEGER for DCC use * Fix inet_ntostr() to use Getnameinfo() instead of getnameinfo() directly. * Fix inet_ntostr() to return int for success/failure, not hostname. * Fix the DCC handshake generator to use inet_ntostr(). * Fix callers of inet_ntostr() to handle integer return values.
* Allow $listen() to take a family argument, like $connect(). * Add some V6 macros in ircaux.h, modeled after V4 macros. * Add a "family" member to the dcc structure. Default to AF_INET for now. * Start fetching ports by calling inet_ntostr() instead of peeking directly -- into the sockaddr. This yields protocol independance. * Fix bug where $listen() or /dcc send w/o a virtual host caused NULL deref.
Due to the way the new attribute parser works, mangle_line needs a destination buffer that is at least eleven times as large as the original string. Change all uses of mangle_line to pass in 11 times as much as necessary. This avoids uneccesary truncation of input lines with excessive attribute changes in them.
Technically speaking, a zero-length format is considered bad style, but not illegal. Anyhow, printf() in an empty_string to satisfy pedantry.
* Fix for an SSL problem where SSL fails to negotiate. It will bail to non-encrytion in this case now. * Fix for splitw() which is used by $uniq() and other functions where some of the elements could be null pointers due to its use of new_next arg. This would cause qsort() to coredump. Switched to safe_new_next_arg which seems to have a performance penalty of about 4%. * Added an "OTHER" flag to $stripcrap() and the mangle settings, which catches all characters that other flags don't. It isn't included in the ALL flag.
* Fix parse_server_info() to properly handle ipv6 p-addrs * Add support for [<ipv6 p-addr>] to parse_server_info(). * Fix an off-by-one error in Getaddrinfo. Bleh. * Fix a malloc() size mistake in Getaddrinfo.
Try to support [<ipv6 p-addr>] for rain in /server.
Fix some function names that I didn't like after sleeping on them. Add extra argument to inet_ntostr() which is passed to getaddrinfo().
Huge major commit #1 in the great IPv6 support addition... Rather than include all of the changes here, read KNOWNBUGS changes.
No functional changes, just removal of unecessary whitespace at the end of lines. From adm.
* Applied patch from Kurt Roeckx which does better SSL detection.
* New /fe and /fec functionality which allows it to work much like perls
map command. The form is "fe var tmpvar ... {code}".
The difference between it and the "fe (list) tmpvar {code}" form is that the value of var is taken for the list, and more importantly, the value of tmpvar is retrieved after each iteration and string appended to
a new value for var. This is subject to the following caveats:
* The new value of var is written back only after the fe/fec exits.
* /break will cut the variable short _after_ the current value.
This was designed at least in part to make it possible for scripts to
make use of the extended strcat functionality and indeed, this works in
linear time which makes it useful for very large strings/values.
* Fixed the default bailout return value in get_server_port() to return
the value from server_list.
Functionally complete the protocol independance of DCC. There are no more ISA's in server code or dcc. To phrase that differently, every IPv4 assumption in the server code or dcc has been identified and conditionalized. Adding support for ipv6 is now simply a matter of adding the conditionals to make it happen. Now we need to test what we have here and see how badly i've broken things. The only remaining IPv4 customers are /WINDOW CREATE (which is likely to stay ipv4 only for the time being) and $iptolong() and $longtoip() which clearly are IPv4 only concepts.
Move the transition macros into ircaux.h. Migrate the server over into protocol independance. That was pretty painless. If you're reading this with rapt attention, please understand that 'protocol independance' does not mean "multi-protocol support". What it means is that instead of using (struct sockaddr_in)s, we're using (struct sockaddr_storage)s, and we conditionalize all IPv4 specific code to work only on (struct sockaddr_storage)s whose family has been set to AF_INET (ipv4). Once total protocol independance has been acheived, adding support for IPv6 will be a matter of adding conditionals to handle it in the same manner IPv4 is already supported. So the current project i'm working on is the protocol independance of epic. Multi-protocol support comes later.
Nuke "local_addr" in server struct in favor of "local_sockname" Convert server to use "connectory" Convert wserv to use "connectory" Nuke connect_by_number() Reorder functions in network.c
Fixes inspired by first wave of testers 1) Fix casts to inet_anytop() 2) Fix configure to check for socklen_t, default to 'int'.
This is a huge monster commit -- I put the particulars of the commit in KNOWNBUGS. I will only say here that this fixes a lot of issues with DCC and introduces a lot of protocol independance into the networking API that epic works with. Good things will continue to come in the future!
The last round of changes for tonight. More of the same... I promise! I'll document the user visible parts of this soon! Really! =) I mean it!
Milestone #2!
EPIC now does non-blocking connects (sort of). But you are not given
the opportunity to "do what you want" during the non-blocking connect.
EPIC sits in a select() call until the connect() succeeds or fails. But
you can hit ^C and reliably cancel the connection-in-progress. This is
an improvement because we don't have to hack up connect timeouts using
alarm() any more.
Also...
-- Output an error/warning message if you try to create a unix domain
socket and your system doesn't have UDS's.
-- Change /set max_reconnects the way everybody has been insisting I do.
Basically, the new semantics are:
/set auto_reconnect 0
-- No reconnects EVER for ANY reason
/set auto_reconnect 1
-- One reconnect, before failure
/set auto_reconnect N
-- N reconnects, before failure.
No more "freebies", which everybody seemed to hate. Oh well.
Yet another swath of changes in The Great IPv4 Cleanup. This time I took a broad hatchet to the resolver-assistant functions in network.c. Using modern techniques really increases readability and makes it look less like a hack. Making good progress!
* Applied Ay-Ars SSL patch:
* Copyright notices added to ssl code files.
* --ssl-ver switch removed (configure script hasn't been rebuilt).
* Code changes/cleanups which I haven't checked, but which seem to work
well.
* Documentation changes.
* Fix for a memory leak in foreach when continue or break are used.
* Moved the server_established hook into register_server so that it is not
triggered when an unsuccessful attempt to connect is made.
* Feeble stab at fixing an intermittent server related coredump.
* Cleaned commandqueues script up a bit.
* Rolled the $getsets() and $getcommands() code into macros and added $getfunctions(). * Added a server_established hook. This is called before anything is sent to the server, and it is intended that for ssl connections, stuff can be quoted and hooked in plain text until the hook returns, although, it is difficult to verify that this will actually work. * Made it so that when all variables are erased, the low level array that contains the variables is erased. This is intended to make it easier to profile the memory use. * Copyright notice added to perl.c. * Minor stuff for tabkey.ce.
* Applied patch from Stephanie M Rogerson to fix compile errors with --without-ssl flag. * Updated tabkey.ce script (work in progress).
First run at a $serverctl() function. This is entirely untested. Please expect bugs. Feel free to report (and fix) bugs. I'll document this once we get it fleshed out. Suggestions/improvements are welcome.
* Applied Ay-Ars patch (with a few modifications) which fully melds ssl into the server spec, which is now server:port:pass:nick:group:proto where proto currently is "irc" or "irc-ssl". * Removed -ssl flags from "/window server" and /server. * Ay-Ars patch also includes a new function, $servertype() which returns the proto field by way of extrapolation, (it is not the exact text entered into that field). * Entering a server spec in a /server or "/window server" that currently exists, but which has different additional field values normally alters the current spec to conform to the new spec. This doesn't work with the proto field. This is probably a bug. I am somewhat uncomfortable with all of this. I would like to alter add_to_server_list to be the one true reference for decoding the server spec and simplify the other functions to only breaking it into server, port and "additional". This may be too big a change currently.
Don't use 'findchr' in the server-info-parser, as \'s are legal nickname characters. Take out the debugging code.
This is my first go at supporting embedded colons in server specs. You can use double-quoted words now in your server spec. Man, I Hope this doesn't break anything (famous last words). Here's an example: /server /tmp/.ircd/6667::"tmp:pass":hop:groovy Would add "/tmp/.ircd/6667" as a server, with the group "groovy" using the nickname "hop" and the password "tmp:pass", all without the double quotes, of course. Using double-quotes to surround arguments like this will protect colons inside from being mistaken. I would like to support backslashed colons at some point, but since backslshes are perfectly legal nickname characters, I can't see a way to do this without hackery. :/ I added a "findchar" function in ircaux.c to find the next instance of a character that isn't backslashed.
Bulk commit:
1) Fix typos in KNOWNBUGS
2) Flesh out the things in UPDATES that need documenting
3) Add target_file_write() to files.[ch] for send_text()'s use.
4) Create "reg.h", to hold protos for reg.c
5) Add some missing protos.
6) If /redirect'ing to 0 or to @<fd>, don't output to the screen.
7) Messages sent to target 0 are dropped (/redirect 0 now actually sends
to target 0, and epic drops it.) You can /query 0 now if you want.
8) Messages sent to @NUMBER get sent to the NUMBER file, where NUMBER is
returned by $open(). For example, to paste stuff to log but not to screen:
@fd = open(FILE w)
query @$fd
<paste some stuff>
query
@close($fd)
or
@fd = open(FILE w)
redirect @$fd lastlog foo
@close($fd)
9) Add a function to reg.c to compile a pattern into a regex -- experimental.
10) Fix some compile warnings regarding ssl.
Moved some server attribute altering stuff to server.c.
Applied the SSL patch from ay-ar. Details are in README.SSL. This works well at this point, but there may be teething problems.
* Added a url encoded message switch to /xquote, designed with socks proxy scripts in mind. eg: "xquote -u $urlencode(ISON xxx)%0a" works. One problem with this is that the last command works, and can be used to get around the built in barriers for such things. Is this good or bad? * -- and any other invalid option will end /xquote switch processing now. * Added $servergroup() and $serverourname(). These were copied from $servername() and behave in much the same way, differing in their return values.
Fixed another bug with "server -d". One thing I left off the list for the last patch was that $unsplit() had a leak too.
Fixed a bunch of memory leaks: * In /alias with no args, one leak for each line printed. * If an /on would clober another /on, there would be a leak. * In "/timer -ref xxx", if xxx existed and therefore blocked the timer, there would be a leak. * "/server -d" wouldn't erase the notify list and one or two other things for the server * And the last one I am _not_ sure about. prepare_display() had a leak, however, this does appear to be a work in progress, and the pointer in question points to a strange combination of static, dynamic and alloca() variables. I made the smallest possible patch which seems to work, however, its quality may be questionable.
added server's group to /SAVE -SERVER
Implement the "redirect sink", which instead of sending all output to another irc server, drops the output entirely. This is used by /flush (which is now safe to use again) and can be used by the user via /redirect 0 to execute a server query but suppress it's output.
Actually implement the code to use the translation stuff. This means the translation stuff is now functional. THIS IS NOT DONE THE SAME WAY AS IRCII DOES IT. ircII implements translation on the output side of the equation, from which our code has deviated significantly. Upon reflection, the most common request for translation was not for OUTPUT translation, but for SERVER translation. Therefore, I have implemented translation's operations on the server side of the equation instead of the server side. If this ends up being the wrong thing, I reserve the right to go back and "fix" this later. Anyhow, the translation(s) in force will occur when data is recieved or transmitted to the server, and not otherwise. Feedback is appreciated.
* Miscelaneous 3cat updates.
* History expansion copies the history buffer verbatim now.
* Bugfix: /!0 would not retrieve the first command entered.
* Bugfix: Negative numbers not found would be display the
incorrect number in the error message. eg: /!-4444
* Alterations to remove_trailing_spaces interface.
* $igetrmatches() was defined, but inaccessible.
Make sure 'group' is always something, even if it's null.
Oh you didn't know? Server groups, try one!
Removed a check in close_server() that stopped clean-up code from being run on a disconnected server. Also call destroy_waiting_channels() when a servers channels are being thrown away.
* Fix reconnect() to call window_check_servers() before it returns. This should fix a number of places where windows are not properly informed that their server has gone away, meaning that they may be left holding the bag with a current channel that no longer exists. * Not sure what to do about window_change_servers() which really should support changing to new_server == -1. *sigh* I can't wait for output rules to moot all this. * Fix /window discon and /window noserv, which just blithely set the window's server to -1 without bothering to tell anyone, like say, the channels, or calling the servers via window_check_servers() or any of that, you know, important stuff. /window noserv is now a strict alias for /window discon.
Fix a bug with /disconnect sending QUIT to the server rather than calling close_server(), which causes all sorts of mayhem. This was reported by Robohak, by way of felony (i believe) Fix a bug with fudge_nickname() not calling nick_command_is_pending(0) when a 433 numeric (Nick is in use) happens, which causes any further 433 numerics to fail to fudge the nickname! D'oh! This was reported by Q.
Use FD_CLR to prevent multiple hits on a file descriptor between select calls. Discovered by Q when he was testing the 010 redirect handler.
Aha! This time for sure! Passworded-server connectinos prompt correctly.
Try to handle passworded servers a little better.
Fix a typo in the 477 numeric handler (spotted by robohak) Fix reconnect stuff so it's done right. Hopefully Q will accept this. ;-) I'm hoping that channels are now saved properly, or at least that we can arrange for them to be. Watch out for the new panic i put in there!
Commit #51 -- save channels when server drops our connection. I guess this got overlooked. Q is responsible for pestering me into fixing this. ;-)
Commit #47
* /window server resets the "reconnect attempt" counter ala /server
* /for i in <pattern> {...} now reserved, and emits an error.
* "make depend" done again.
* "my_next_expr" revamped, extra argument added
* "next_expr_with_type" like "next_expr" but first char is "type".
* The /for i in (list) and /for i from x to y commands now use the
above cruft.
* This is epic4-0.9.16-10
* "break_args" now uses "next_expr_with_type"
* "do_log" should use localtime(3) and not gmtime(3), duh.
* "clear_reconnect_counts" is now an extern function from server.c
Commit #44 -- oops!
Commit #43 -- reword the error message in create_server_list so that it explains to the user what went wrong -- 'itsname' being NULL is not bad, it just means registration is still pending. Warn the user that we cannot give them the server's canonical name.
Commit #38 -- From Robohak (thanks!) Fix /server <N> where you are already connected to <N> to output the customary "Connected to port %d of server %s" message rather than reconnecting to the server (oops!) Fix /reconnect to honor arguments as a reason for reconnecting, or use "Reconnecting" as the default message if none is given.
close_server() needs to be called before reconnect() in the EOF handler for servers -- this is commit #26.
It would be appropriate to initialize 'save_server_channels' rather than just hoping it gets a value of 0.
Roll get_connected() into reconnect() and abolish all uses of get_connected(). Things are starting to look good here!
Add "set|get_server_quit_message" and start using it. This permits us to actually send meaningful quit messages for /quit and /reconnect and /disconnect and the like.
Fix dumb bug with /reconnect.
Fix some bugs with the last round of commits.
Fix some "issues" with compilation.
Stage 2 -- what am i getting into? This is the second stage of the server connection closed coping mechanism. This will be tested, bugs may ensue!
Add a "reconnect_to" feature to the servers. The idea is that instead of closing the server when we recieve a 465 or 010 numeric, instead we should stash the refnum of the server we want to connect to in the server's data, and then when we recieve the EOF from the server, at that point do the reconnect. This saves users pain and suffering when there is important data after those numerics. Thus, we only ever drop our connection to the server when the user does /server + or /server -.