CVS log for epic5/source/ctcp.c |
![]() |
Request diff between arbitrary revisions
* Support /ignore nick|#chan ACTION
* Roll in a bunch of changes from larne to make epic5 more vms-friendly * Rename if.h -> ifcmd.h (larne) -- Make sure you rerun configure! * Run make depend to pick up name change of if.h * Check for <sys/param.h> in configure (larne) * Extern funcs are case insensitive in strict c90, fix (larne) * Rename options -> options.h since vms requires a dot in filename (larne) * Change "readonly" -> "rdonly" since "readonly" is a symbol in vms. (larne) * Pull in "compat.h" for gailib.c and glob.c (larne) * Set stdout to be explciitly line buffered at startup (larne) * Returning a value from void functino forbidden by strict c90. fix (larne) * Fix some compiler warnings that were lying around. * There are more changes forthcoming, these were the easy ones.
* Revert commit 1498 (the dcc stuff) -- it was half baked. * Fix warnings found with --with-warns.
*** I'm only half done here! Some stuff is probably broken! *** -- Just please be patient when telling me what I broke and I'll fix it. -- * Begin a refactoring of dcc to make my life easier * Simplify register_dcc_offer(), removing unnecessary args. * Also, register_dcc_offer() will only take url-encoded filenames now. * Fix up the ctcp handler do_ctcp to urlencode offered filenames. * Change the DCC_FILE* macros to DCC_SEND and DCC_GET to stop confusing me * Add a "offer_filename" variable to dcc's for next round of work * GC some unused code * Break dcc_message_transmit() into dcc_raw_transmit() and dcc_chat_transmit() * Drastically simplify those two functions * Fix up dcc_raw_transmit() so the hostname isn't required * This means /dcc raw <fd> <host> <msg> ignores <host>. yay!
Fix compiler warnings, should not be any functional changes.
Fix panic, make sha keys happy looking.
* Bust do_crypt back into its callers [de]crypt_msg(). * Make lookups between /encrypt flag<->cipher flag<->ctcp table-driven.
* Add SEDSHA cipher type, which is better than SED, and always available. * Add my_sleep|isreadable|iswritable() funcs to phase out rogue selects()h * Add support for multiple concurrent servers to /encrypt. yay! * Store the length of the Crypt key within the key itself. * This moves us closer to being able to decrypt arbitrary data. * Test all of the cipher types, incl. compat of CAST with ircII. All set!
___ WARNING ___ This stuff is all wildly un(der)tested. I will get to that soon! But I'm too excited about this to sit on it. * Add AESSHA256 support (AES256 using the SHA256 digest of your passkey) * Rename "EXTCRYPT" to "PROGCRYPT" * Migrate SED support from crypt.c to crypto.c * Integrate SED and extprog support into the mainline [de]cipher_message() * Refactor [de]cipher_message() to be less lame. * Support "anycrypt" support (AESSHA, AES, BLOWFISH, CAST5, SED, PROG) * Include sha256 implementation from Karll. Thanks Karll! * Unify the ctcp handling of all crypto ctcps * Add $sha256() function to test sha support (digest) * Make funcs in crypto.c static and just expose [de]crypt_msg(). * This finishes the divide between crypt.c (front end) and crypto.c (back end) * Fix a gazillion compiler warnings and sort out const/unsigned char issues.
AES support!
* Support cast5/blowfish encryption a la ircII. * Fix build for non-ssl users.
* Nix some func decls in windows.h that don't exist any more * Add message_setall(), lets you save to_window on the message_from stack. * Replace users of message_to() with message_setall(). * Replace direct users of to_window with message_setall(). yay! * /XECHO got rewritten as part of this. See UPDATES * Fix various compiler warnings.
* Don't offer non-"TELLUSER" ctcps via /on ctcp_reply (ACTION/SED/UTC)
GC a bunch of stuff no longer in use.
* Round one of blackjac's 'builtins' script. * Comment out a ton of now-scripted sets. Will GC it later.
* Fix compile error for #define UNAME_HACK * Fix crash when you do $open(/file/doesnt/exist R) * Add an /on 338 default handler. * Fix integer underflow with log file refnums * Rename STATUS_USER0 to STATUS_USER for backwards compat. oops! * Whack BRACE_LOAD_HACK, it's been unsupported for a while. PF loader rules! * Don't allow /botmode if #define NO_BOTS * Fix DCC connections instantly "timing out"? (Check on this) * Whack FLOATING_POINT_SUPPORT and depend only on /set floating_point_math
* Refactor window_check_servers() to work with server's current window only. * Roll forward all the rest of changes from epic4 (i think) * Add /ON NEW_NICKNAME, when epic needs a new nickname from you. * Run 'make depend', fix compile errors, fix 'environment' script
* Add /msg -<server>/<target> thingee, i really need to document this. * Oh, send_text() now takes a server argument.
* Add the rest of funcs to do builtin var support in unified symbol table.
* Change the unified data type for builtin funcs to (IrcVariable *).
* Implement "buckets", for O(N) scans of the unified symbol table.
* Change DEFAULT_USERINFO to DEFAULT_USER_INFORMATION to match the /set.
* Make the *_VAR stuff in vars.h 'int's.
* Change USER_INFO_VAR to USER_INFORMATION_VAR to match the /set.
* Change CLIENTINFO_VAR to CLIENT_INFORMATION_VAR to match the /set.
* Change STATUS_NICK_VAR to STATUS_NICKNAME_VAR to match the set.
* Put the defn of (struct IrcVariable) in vars.h, to expose to unified table.
* Convert all uses of now defunct (enum VAR_TYPES) to (int)
* Create "make_string_var_bydata", converts (IrcVariable *) to malloc string
* Change get_var_alias() to return (IrcVariable *)
* In that function that outputs set values, use make_string_var_bydata().
* Change hardcoded *_VAR uses into pointers to *_VAR, for deref at runtime.
* Major revamp of vars.c, to wholly create built in vars at runtime.
* Built in variables are stored in unified symbol table and vars.c xref array.
* *_VAR values now point through xref array to the actual variable data.
* Nix the now unnecessary get_variable_index().
* Add create_user_set(), backend for /SET -CREATE
* Add /SET -CREATE <name> <type> [{<code>}]
* Need to go back and implement the {<code>} thing.
* Revamp how /set works, using buckets, to implement auto-completion.
* $getsets() is not implemented yet, do that too.
* When looking up $<setname>, use the unified symbol table. HUZZAH!
* Wrap send_ctcp in message_from()s to send to the right window.
* Make dcc connections ($connect, /dcc get, /dcc chat) nonblocking * /DCC RESUME is totaly broken by this. Will fix later, maybe ;-) * Add $startupfile(), which returns the epicrc/ircrc file that was loaded * Offer unknown ctcp requests through /on ctcp_request before /on ctcp. * Fix /window level none and other such breakages (adm)
Well, at least it compiles again, but I think i still need at least one or two sweeps of the code to make sure I got everything proper.
*********** DONT RUN THIS -- IT'S WORK IN PROGRESS -- DONT RUN THIS *********** * Import epic4 commits 674 through 692, inclusive. * Import epic4 commits 693 through 710, inclusive (epic4-2.0 final) * Change _X and _Y macros to LEVEL and LEVELMASK for linux (sigh) * Add a searchbuf() 8 bit clean byte-finder for future use. * Convert flood checking, ignore checking, lastlog, logfiles to int masks. * Convert message_from to int masks. *********** DONT RUN THIS -- IT'S WORK IN PROGRESS -- DONT RUN THIS ***********
Merge changes from epic4 commits 674 to 692, inclusive.
* Assimilate notice.c into parse.c. *poof* * Fix some compiler issues and so forth * Nix the NOTE level. * Move load_ircrc() to irc.c, nix "startup_file" global var.
Make 'empty_string' (const char []). Now we're cooking with gas!
EPIC5-0.0.1! Huzzah!
Make message_from() work off of a stack; use panics to guard against unmatched message_from()s, and other wackiness.
* Add $windowctl(GET <refnum> DOUBLE) * Support inbound double quoted filenames in dcc handshakes. bleh. * Fix NULL deref when you kill hidden windows (ie, /window killswap)
* Fix /on ctcp_reply so it hooks in the LOG_CTCP context. (rb nsx)
Commit 551 -- second to last commit for this project -- the big one! * Roll in the new universal_next_arg_count() and attendant macros. * Comment out some deprecated function decls in ircaux.h * Do another round of make depends. * Modify alias arglist code to use the new universal_next_arg_count() stuff * Convert dequote() to dequoter(). * Convert new_new_next_arg() into new_new_next_arg_count(). * Comment out deprecated functions in ircaux.c -- will be deleted later.
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().
Commit 519 * Change m_strcat_ues_c to take a (char *) "unescape" param and not (int) * Rename m_strcat_ues_c to malloc_strcat_ues_c * Rewrite malloc_strcat_ues_c to support new semantics. * Make sure not to pass 0 to alloca() in ctcp checks * Initialize (DCC)->server [found by valgrind] * Change 'expand_alias' so 'unescape' is (char *) and not (int) * Add extra sanity checks in mangle_line against buffer overruns * Fix window_channel() to use new malloc_strcat_ues() arguments.
* Misc bugfixes as per KNOWNBUGS. * This patch involves renaming crypt.h to sedcrypt.h.
Make sure that the argument passed to alloca() isn't negative. *grumblesmurf*. This is a larnification change. More alloca() checks to come later.
* 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!
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.
Another merge.
Yikes. Merged to become consistent with HEAD. Sorry for all the commits, I'll be quiet again soon. :) -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.
* 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.
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.
Update copyright notices and copyright dates.
I'm going to start sweeping the entire source, adding the official copyright notice to each file (like ircII does already), and making sure that the /* $EPIC$ */ thingee is at the top of the file. This is my first swath of files.
No functional changes, just removal of unecessary whitespace at the end of lines. From adm.
* Add the rest of the stuff as an extra arg to register_dcc_offer. register_dcc_offer is _such_ a hack. * Add a new data item to the DCC struct, a item-specific callback when the connect()ion is established. This is for forward comaptability. We still do our connect()ions psuedo-blocking but some day we won't. This is always NULL for now. * Create a function dcc_opened() which is called whenever a connect()ion on any dcc is established. This is basically the last half of dcc_open(). * Revamp dcc_open() to use dcc_opened(). * dcc_open() now returns -1 on error and 0 on success. Change all callers to this new return value. * The error value if a connect() on a unix domain socket failed is -1 (system error) not -9 (connection timed out) * Add support for Connect()ing to a unix domain socket. UDS servers work again. All of this pretty much leaves epic in pretty good shape after the great cleanup. Unless something major comes along, we'll test and then i'll roll out epic4-1.1.4 and then we can go forward with ipv6 from there.
* 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.
* Enhanced flood checking to keep records based on userhost rather than nick. Not designed to catch clones but to make it harder to avoid. * Flood checking keeps its time in microseconds now, which _may_ make it a little hyperactive on occasions. * Small re-arrangement to find_array_item() to make it slightly faster. * Terminology fix in /alias /s. * Added $regmatches() which works exactly like $regexec, but returns pairs of numbers which can be applied to $mid() to extract the matched strings and substrings from the original string. It also takes a new second argument indicating the maximum number of subexpressions to return. * New -file option to /lastlog. If given, all output will be written to the file rather than the screen. file_put_it() may be questionable. * $channel() will return "h" in the op field if the user is a half-op.
* Bug fix: *shoot me* $encryptparm() wouldn't check if the program field was empty before sprinting it. * Failed received SED messages make their way through encrypted_privmsg and encrypted_notice now just like the successful ones, only without the "[encrypted message]" message. The reasoning is that first of all, it should be possible to block these messages and secondly it makes it a lot easier to script a secure key exchange. The failure hooks are called with only two arguments (no message). This may be a bad idea. On the one hand it makes it easier for a script to catch, on the other, the hook looses certain critical information.
Altered the processing of received SED CTCPs so that enclosed CTCP _replies_ are treated as replies and not requests. Minor cosmetic updates to the gpg scripts.
* Fixed a buffer overflow in the new /encrypt program mechanism. * Minor cosmetic update for encrypted messages for which the encryption program returns nothing.
This extends /encrypt to add a new argument, which will be treated as a program with which to filter messages through to be encrypted/decrypted. The protocol so far is: One line in text mode, with the key as the first word. Followed (starting on the second line and ending at EOF), by the encrypted message in binary. Binary messages returned are automatically quoted and unquoted for transmission over the wire. Ascii Armoring if performed by the program will "bypass" the quoting features. This patch also alters the way floating point numbers are returned. Before, canon_number was passed over the textual value. Now, ftoa() reads the correct way to do it from FLOATING_POINT_MATH.
Hurried patch. This rolls back the $read() patch for now.
Ok. ESR asked us to change our manpage. Some of his changes worked, some of them did not. I took the ones that did work. Add /on general_notice and /on general_privmsg. These will be documented in UPDATES -- they are generalized versions of /on (msg*|public*) and /on (notice|server_notice). Break backwards compatability on /on ctcp_reply by changing $* $0 Sender $1 Target [new] $2 CTCP command [Was $1] $3- CTCP Arguments [Was $2-] Everyone i asked wanted this change, so i claim immunity.
The beginning of the migration away from 'time_t's towards 'struct timeval's. This first round of support is very rough and may have some issues, which I will be happy to fix (or you can fix them yourself if you want), but it is more proof-of-concept work for now. I don't expect that I will migrate *everything* to struct timeval, just the important stuff. I have not made any serious attempt to optimize this yet and please don't jump the gun and start optimizing this until I've got the bugs settled out. Thanks. =) Oh yes, I almost forgot the good part -- /timer now has highly accurate sub-second timer resolution. This means you can do /timer 0.82 echo test and it will go off in exactly 0.82 seconds. No more "approximate" timers! The traditional restrictions about timer execution (timers do not go off while another timer is executing, and while you are /wait'ing) still apply.
* Fix server assignment in /exec so it works in /on's again. * Fix failsafe declaration for MAXPATHLEN for hurd in irc_std.h and glob.c. * Fixes to make dcc-over-ctcp-over-dcc work again (|Rain|) * Fix $querywin() so it can take a second argument, a server ref (for scromp)
Initial import into CVS
Initial revision
| CVS Admin |
Powered by ViewCVS 0.9.2 |