Compare commits

..

925 Commits

Author SHA1 Message Date
Kevin Easton 6ef78086f8 Bump MAXPARA (maximum protocol message arguments) to 20 as per EPIC5
Needed to bump it to 16 anyway (the RFC says 15 plus the protocol command itself, so 16), but EPIC5 bumped it
up to 20 based on a report from users of RusNet so we might as well go up to that as well.
2019-06-26 17:26:02 +10:00
Kevin Easton 0cbf8014ff Correctly handle a last argument prefixed with : for any protocol message
The previous handling for this had the : prefixing the last protocol argument reappear after
a PasteArgs() call.  This caused problems with the inspircd server, which prefixes the final
argument for every protocol message with :.  In particular the MODE command was problematic.

See https://github.com/inspircd/inspircd/issues/1636

Reported-by: trn
2019-06-26 17:16:35 +10:00
Kevin Easton 8d4808d744 Fix SHOW_AWAY_ONCE so it shows away message if the nick has changed
This was always the intent of the code, but it was using the server name
instead of the nick.
2019-06-21 16:24:27 +10:00
Kevin Easton bdd4f624c7 Handle 301 numeric with missing message away message argument
Reported-by: trn
2019-06-21 16:04:15 +10:00
Kevin Easton ae515a2b15 Minor simplification to remove one #ifdef/#endif pair 2019-02-05 17:39:24 +11:00
Kevin Easton f27d4d6599 Move find_old_server() nearby to only caller and make static 2019-02-03 00:59:18 +11:00
Kevin Easton 488c5bd9ba Remove obsolete check_host() function
This does nothing except fail when particular usernames are in use.
2019-01-31 22:24:11 +11:00
Kevin Easton ec8dee84b1 Remove my_from_server argument to finalize_server_connect()
This argument is always equal to the refnum argument at all three call sites.
2019-01-24 17:32:47 +11:00
Kevin Easton 062a5b781f Simplification of logic in server_lost()
Should have no change to behaviour.
2019-01-24 17:27:57 +11:00
Kevin Easton 18227203d9 Display "Servers exhausted. Restarting." message at the right time
The intention is to display this message when the client has failed to
connect to enough servers that it has to start back at the initially
requested server again.

The old code instead had some quite odd conditions.
2019-01-22 16:20:54 +11:00
Kevin Easton 32e5a0f281 Retry the initial server connection the correct number of times
The previous code relied on server[i].retries being equal to one less than the
number of connection attempts that had been made on entry to advance_server(), but
this was false for the initial connection attempt.

Change the code instead so that on entry to advance_server(), server[i].retries is
always the number of previous connection attempts that have been made.  This does the
right thing for initial connection attempts since .retries starts at zero.
2019-01-21 17:01:20 +11:00
Kevin Easton 080d26e4e1 Simplify next_server()
Replace the overly complex recursive implementation with a simple iterative one
that should behave exactly the same.
2019-01-19 00:52:20 +11:00
Kevin Easton 8072aea782 Improve error messages for SSL connection failures
This now shows the underlying failure reason, and includes the server name.
2019-01-16 23:54:59 +11:00
Kevin Easton 6cf30d8ce1 Make finalize_server_connect() static
It is only called within server.c.
2019-01-16 23:26:39 +11:00
Kevin Easton 95b57cc3cc Correctly handle reconnection after finalize_server_connect() fails
finalize_server_connect() can fail for SSL connections, because SSL_connect() can fail.  Without this change, the client won't
try to reconnect after an initial SSL connection failure - it'll just wait forever.

Reported by g0z, thanks!
2019-01-16 17:13:29 +11:00
Kevin Easton ad93fed710 Rename 'lines' identifiers that clash with <term.h>
Also pull out common part of scrollback_fowards() and scrollback_backwards() into a
helper function.
2018-12-14 17:55:52 +11:00
Kevin Easton f8ed18becb Rename 'pad_char' argument to padc
This avoids a clash with pad_char defined in <term.h>.
2018-12-12 00:22:59 +11:00
Kevin Easton 6a6f235db3 Rename 'lines' variables
This avoids a clash with the 'lines' macro declared in <term.h>.
2018-12-12 00:16:56 +11:00
Kevin Easton 76fc3b1b04 Rename 'lines' variable to 'line_range'
This avoids a conflict with the macro defined in <term.h>.
2018-12-11 22:29:20 +11:00
Kevin Easton e3750c7c1b Remove #include <ircterm.h> from source files that don't use it
Update Makefile dependencies as a result of header file inclusion changes.
2018-12-11 20:30:27 +11:00
Kevin Easton ac1c95c4ec Rename Window.columns to Window.saved_columns
This more accurately describes what it's for, and also avoids a conflict with the columns identifier
defined by terminfo's <term.h>.
2018-12-10 23:46:24 +11:00
Kevin Easton 9524f8996c Rename clear_screen() to input_clear_screen()
This matches input_unclear_screen(), and avoids a clash with the clear_screen identifier defined in
terminfo's <term.h>.
2018-12-10 23:29:45 +11:00
Kevin Easton 902ee7c455 Remove unused function irc_clear_screen 2018-12-10 23:25:17 +11:00
Kevin Easton 66b6fa4345 Add /EXEC -WINTARGET <target> argument
This allows you to choose a specific target window for the output of an /EXEC.
2018-11-30 13:17:27 +11:00
Kevin Easton 830572b91f Simplify and improve ov_strcpy()
The new implementation calls into strlen() and memmove(), and is safe to use even if the arguments don't
point into the same string.

The return value is now the same as the first argument (just like strcpy()), but no existing callers care
about the return value anyway.
2018-11-27 17:26:53 +11:00
Kevin Easton e51469568e Update command-line help text to explain server descriptions
Makes it clear that a each server can also specify port/password/nick/network if desired.

Reported by Ant.
2018-11-14 13:17:48 +11:00
Kevin Easton 076850f81b Move declaration to top of block
This fixes building with gcc2.  Reported by <https://github.com/fbrosson>.
2018-11-11 01:27:09 +11:00
Kevin Easton fe22025c01 Remove configure check for bcopy(), no longer required
This fixes building on Haiku OS (where bcopy() is a macro, not a function).
2018-11-11 01:22:31 +11:00
Kevin Easton b5afd1d596 Replace last uses of bcopy() with memcpy()
memcpy() / memmove() are standard everywhere, this lets us remove the configure script checking around bcopy()
which helps building on Haiku OS.
2018-11-11 01:07:31 +11:00
Kevin Easton d897a3b753 Fix /HISTORY *pattern* and /HISTORY -CLEAR
This code contained a bug where any argument to /HISTORY that _didn't_ start with "-CL" would clear history,
so no number or pattern argument could successfully be passed.

With this fix only an argument that case-insensitively matches "-clear" will clear history, so a pattern
argument will also work correctly.
2018-11-05 23:25:01 +11:00
Kevin Easton a3e8364bc9 Straight conversion of prepare_display() from pds.pos integer to pds.dest pointer
This means that the prepare_display_state struct includes the pointer into the destination
buffer, not just the offset.
2018-07-07 12:03:22 +10:00
Kevin Easton 6d432d458f Group variables representing the current prepare_display() state into a struct
This should have no functional effect, but groups together the variables required to
'rewind' prepare_display() to a particular point in the source string all together.
2018-06-16 14:28:40 +10:00
Kevin Easton d4c6123002 No tabs should be shown when /SET TAB is OFF
This also counts beeps, tabs and non-destructive spaces in the same way.

To maintain historical behaviour, BEEP_MAX of zero indicates no beeps allowed (the same
as /SET BEEP OFF), but TAB_MAX and ND_SPACE_MAX of zero indicates no limit.
2018-05-25 11:19:02 +10:00
Kevin Easton 255c25158c In prepare_display() set firstwb on tab as well as space 2018-05-17 23:20:15 +10:00
Kevin Easton f859f9e2f8 Count columns used by ND_SPACE character when splitting lines
ND_SPACE take up a printable column, so they need to be counted.  Reproducer:

/eval echo $repeat(160 $chr(19))XXXXXXXXXXXXXXXXXXXXXXX
2018-05-17 16:26:17 +10:00
Kevin Easton 9bffcf91ba Use main_screen->co instead of current_term->TI_cols as fallback width for never-visible windows
Window management should be getting its idea of screen geometry from screens, rather than
directly from the terminal.
2018-05-14 15:25:21 +10:00
Kevin Easton 5cc052ee6c Use target window width rather than terminal width to wrap /list -wide output
This should make the output correct in more circumstances.  It's the same wrapping used by add_to_window, anyway.
2018-05-10 17:33:35 +10:00
Kevin Easton 14a501bd04 Add window_columns() function to determine number of columns used for splitting window output
Replaces two open-coded versions of the same pattern.
2018-05-10 17:02:16 +10:00
Kevin Easton eb14b44413 Use current terminal size in term_reset()
Fixes a regression introduced by 70ac43ce77 where
the scroll region would be reset to the original terminal size, not current.
2018-05-07 20:13:23 +10:00
Kevin Easton caaba512c2 Remove dead code in refresh_screen() 2018-05-07 17:14:49 +10:00
Kevin Easton 563ab3efeb Use current screen size rather than original terminal size in term_clear_screen()
Also renames the function term_clrscr() to term_clear_screen() and remove the term_clear_screen()
macro.
2018-05-05 13:34:13 +10:00
Kevin Easton 1e97709bd8 Use output_screen size instead of current_term in term_scroll
This fixes a regression in commmit 70ac43ce77,
where the original screen size would be used to scroll after the terminal had
been resized.  If the screen was shrunk, this caused display problems when
running under GNU Screen.

Using output_screen size means that it stands a better chance of working on
non-default screens, too.
2018-05-05 11:31:31 +10:00
Kevin Easton 208fddb9f5 Simplify dcc_send_socketread()
There should be no change in behaviour.  Replaces a code block of the form:

if (a || b)
{
    if (c && a)
    {
        /* one */
    }
    else if (b)
    {
        /* two */
    }
}

with the simpler equivalent:

if (c && a)
{
    /* one */
}
else if (b)
{
    /* two */
}
2018-04-12 00:20:13 +10:00
Kevin Easton 99c5ec9872 Change arcfour example module to use ARC4CHAT instead of SCHAT as the DCC type
The SCHAT type is already used by some other clients for SSL CHAT.  This example module doesn't work
yet anyway, so no-one can actually be using it.
2018-03-14 16:58:10 +11:00
Kevin Easton 9e7fc85ae1 Fix various problems with adding and removing module DCC bindings
Change remove_all_dcc_binds() so that it only removes DCC binds for the module supplied, as it's supposed to.

get_dcc_type() should ignore the first entry in dcc_types[] ("<none>") otherwise the client will try to
respond to DCC requests with that name.

Explicitly track the number of entries in the dcc_types[] array rather than using a NULL terminator.  This
allows us to change dcc_types[] to use NULL entries to mark unused slots in the array, rather than pointers
to entries with a NULL .name element.  Together, this means that the dcc_types[] array is only resized when it
actually needs to be grown and removal works correctly (without eg. prematurely marking the end of the array).

Make add_dcc_bind() fail if the requested DCC type has already been bound by a module (this still allows one
module at a time to rebind a built-in DCC type).  Previously the behaviour was ill-defined in this case.
2018-02-20 23:27:32 +11:00
Kevin Easton 5ae42802ec Fix crash when unloading the arcfour module
Remove the empty Arcfour_Cleanup() function so that the default module cleanup can happen.

Define MODULE_NAME and use that when registering the module callbacks so that the default
module cleanup will remove them correctly.
2018-02-20 23:00:00 +11:00
Kevin Easton 3687e532f0 Change declarations of several globals to 'static' in dcc.c 2018-02-12 17:16:27 +11:00
Kevin Easton fcdfecd78c Introduce get_dcc_type(), remove open-coded variants 2018-02-09 22:09:09 +11:00
Kevin Easton 61a926a766 Introduce a struct dcc_ops to contain all functions pointers for a custom DCC type
Modules now must pass a pointer to a struct dcc_ops when calling add_dcc_bind() instead of
a list of function pointers.
2018-02-08 22:39:49 +11:00
Kevin Easton 64ec300d5d Add full prototyped declarations for DCC hook function pointers 2018-02-08 16:57:41 +11:00
Kevin Easton d15a738ee9 Don't limit dcc_schat_input to DCC_CHAT type (which is never true) 2018-01-06 21:20:48 +11:00
Kevin Easton 5991b83e13 Fix spelling mistakes in /BHELP file
Typo in /lastlog reported by g0z.
2018-01-04 22:29:10 +11:00
Kevin Easton c7a72b79ae Fix redirecting to DCC CHATs with /REL* commands
to + 1 is the correct destination, not to + 3.
2017-12-20 20:25:27 +11:00
Kevin Easton 2c94010d65 Update arcfour example module to use exported dcc_chat_socketread() callback
This allows it to actually connect OK, but it's still nonfunctional at the moment.
2017-12-20 18:10:02 +11:00
Kevin Easton d7688075b6 Export dcc_chat_socketread() and dcc_send_socketread() callbacks to modules
The idea here is that if you have a module which implements a new DCC type that is essentially
a lightly-modified version of CHAT or SEND you can reuse these functions.
2017-12-20 17:36:05 +11:00
Kevin Easton a55feeef5f Rename process_dcc_*() functions to dcc_*_socketread()
This makes it clearer what those functions really do.  It's in preparation to export them
for modules.
2017-12-20 17:11:56 +11:00
Kevin Easton 3800e4b099 Replace get_server_flag() with get_server_umode()
This function gets the status of a single umode flag identified by umode char rather than
internal server flag number.

This also lets us remove all the USER_MODE* constants because they're no longer required.

Invert the sense of the +w check in e_wall() - we only echo our OPERWALL if we're *not* +w,
because if we are +w then the server will echo it back to us anyway.
2017-12-07 00:23:43 +11:00
Kevin Easton 1769c03951 Replace set_server_flag() with update_server_umode() and remove get_possible_umodes()
The idea here is not to expose the internal server implementation for storing umodes,
but instead have callers just work in terms of umode characters.

The 'possible umodes' have always been the same for all servers anyway.  We just assume
that [a-zA-Z] is the bounding set.
2017-12-06 23:30:24 +11:00
Kevin Easton 305cfe2afb Move reinstate_user_modes() and update_user_mode() from funny.c to server.c and parse.c
Move these functions where they belong.
2017-12-06 22:13:34 +11:00
Kevin Easton c4ba093ca5 Rework update_user_mode() 2017-12-04 17:43:47 +11:00
Kevin Easton 7642e741b9 Switch to using NULL server.ssl_fd to mark new SSL connection instead of NULL server.ctx
server.ctx is now allocated once for each server on first connection, then reused for subsequent connections.

server.ctx wasn't being cleared when the server was closed (as server.ssl_fd is), so this was causing
reconnection to fail until try_connect() got called.

This also removes the last uses of the CHK_* macros in ssl.h, so remove them.
2017-12-03 02:16:39 +11:00
Kevin Easton 7b817dd9d2 Correctly handle zero value error return from SSL_write() 2017-12-03 01:09:06 +11:00
Kevin Easton abc9dbdf9e Use SSL_free() when closing an SSL server connection
This avoids leaking memory.

Also change to always call SSL_shutdown() regardless of whether a QUIT message was sent.  No
need to call SSL_shutdown() from write_to_server(), close_server() will do it for us.

Remove "Closing SSL connection" message.
2017-12-03 01:06:53 +11:00
Kevin Easton 5d131bcf01 Add SSL version and cipher to SSL connect message
Similar to what EPIC5 does.
2017-12-03 00:13:47 +11:00
Kevin Easton cdf53cbf86 Change switch_help from array of strings to plain string 2017-12-01 23:42:26 +11:00
Kevin Easton 035063abce Add BITCHXRC_NAME to config.h
(instead of hardcoding it in irc.c).  Simplify setting of ircrc_file and bircrc_file.

Use IRCRC_NAME and BITCHXRC_NAME in help strings.
2017-12-01 23:33:13 +11:00
Kevin Easton 973ae0e4da Correctly handle case when a nick comes between a -s flag and a server name on the command line
The -s flag resets after the next server on the command line, but it was also incorrectly resetting
if a nickname was seen as well. This meant that a command line like this failed to use SSL:

BitchX -s -p 9999 gauze irc.choopa.net

Also update the help text to correctly reflect the operation of the -s flag.

Reported by gauze.
2017-12-01 23:05:58 +11:00
Kevin Easton a4ef0798ac Use server argument instead of from_server in rebuild_notify_ison()
It is only called in one place, where from_server is already set to the same as the argument.

Rename rebuild_all_ison() to rebuild_notify_ison_all().

Make rebuild_notify_ison() and rebuild_notify_ison_all() static, they are only called from
this file.
2017-11-30 17:27:05 +11:00
Kevin Easton f3f2ef6796 Remove unused variable hostname in nslookup()
Squashes a warning.
2017-11-30 00:11:24 +11:00
Kevin Easton 95b53cdd9f Remove unused variable hp in ar_procanswer()
Also mark unused variable ttl.  It's easiest to keep the variable because we still need to skip the
TTL in the header.
2017-11-30 00:08:11 +11:00
Kevin Easton 7a36be1c47 Only declare variable hp in parse_args() when !IPV6
Squashes an unused variable warning.
2017-11-30 00:01:30 +11:00
Kevin Easton 0905cf9528 Remove unused variable tcl_ret in do_hook()
Squashes a warning.
2017-11-29 23:50:32 +11:00
Kevin Easton b458082800 Simplify putchar_x() definition
Introduce an inline helper xlate_char() to isolate the character translation code.

This halves the permutations of putchar_x() required.
2017-11-28 14:40:19 +11:00
Kevin Easton 863263aa07 Make inclusion of tcl_bx.h unconditional
There's no need for the conditional compilation - tcl_bx.h itself has the WANT_TCL guards
necessary.

This makes generating the Makefile target dependencies easier.
2017-11-27 23:15:06 +11:00
Kevin Easton 256b33747c Replace use of _inline and __inline with inline
AC_C_INLINE in configure.in defines inline as a macro where necessary.
2017-11-27 23:02:35 +11:00
Kevin Easton a60937a8fd Move dll_commands and find_dll_command from commands.c to modules.c
Kind of where it belongs.
2017-11-27 20:07:28 +11:00
Kevin Easton 0ba25f02a5 Simplify and clean up find_dll_command()
The only external change here is that it now always sets *cnt to 0 when it returns NULL

Previously, it could set it to -1 in some cases, in particular when dll_commands is NULL.
This led to a bug where /HELP would show the wrong number of matching commands, because it
added the return value of find_dll_command() to the number of matching internal commands.

Also fixes a set-but-unused-variable warning.
2017-11-27 17:18:15 +11:00
Kevin Easton 860e7e28fb Fix unsigned char / char mismatch warnings in encrypt plugin
There's no need to dynamically allocate encode_string, so just make it static.

It does need to be unsigned char though, for the loop that intialises it.  So cast it
when calling my_encrypt() / my_decrypt().
2017-11-25 01:37:11 +11:00
Kevin Easton e63033e1d5 Include tcl.h via tcl_bx.h, not directly
This fixes 'const char **' vs 'char **' compiler warnings.

Additionally, tcl_bx.h always defines STDVAR and can be included without checking for WANT_TCL.
2017-11-25 01:18:13 +11:00
Kevin Easton c719a0ecb3 Test pointer against NULL rather than casting to int 2017-11-25 01:09:11 +11:00
Kevin Easton 2b84718039 Remove unused have_head variable in possum.c 2017-11-25 01:02:47 +11:00
Kevin Easton 21ed1a01a3 Numerous minor fixes to nap plugin 2017-11-25 00:53:43 +11:00
Kevin Easton 862137d975 Remove redundant test in fserv.c 2017-11-24 23:47:37 +11:00
Kevin Easton c426c0dcca Use correct *printf format specifiers in fserv.c
Format ints with %d, not %u.
2017-11-24 23:25:10 +11:00
Kevin Easton f621f48a25 Fix some obvious errors in do_dccbomb() 2017-11-24 23:17:39 +11:00
Kevin Easton 70ce80dced Minor cleanups in wserv.c
Rename global variable 's' to a longer name.  Rename function 'ignore' to a name that reflects what
it actually does.

Make sigint_handler() and my_exit() static, because they're only used in this file.
2017-11-24 17:29:51 +11:00
Kevin Easton ba1b9742ec Simplify calling of rsindex() and strsearch()
Remove the 'how' parameter to rsindex(), making it reverse-search for only the first matching character,
as sindex() already does.  There are only two callers, and one already passed a hardcoded value of 1.

Also change rsindex() so that it starts searching at the character BEFORE the passed in position.  This
makes it easier to repeatedly call rsindex() in a loop to search for the Nth matching character, and
also fixes a technical instance of undefined behaviour where a pointer is decremented to point before
the start of the string.

Remove the 'mark' parameter to strsearch().  Instead, always forward-search from the beginning of the
string and reverse-search from the end of the string, as this is what the two callers want anyway.

Bump the module ABI version because these functions are exported to modules.
2017-11-23 17:22:38 +11:00
Kevin Easton de303ba554 Change scr-bx to list the detached screens if more than one matches
This appears to be the original intention.  It's certainly more friendly, anyway.
2017-11-18 00:20:36 +11:00
Kevin Easton a3e6f10be4 Simplify find_detach_socket() in scr-bx
This should cause no user-visible change.
2017-11-17 23:51:05 +11:00
Kevin Easton 0abfa67aa8 Don't pass -1 as the length to write() if read() fails 2017-11-17 23:06:46 +11:00
Kevin Easton 149b3206e0 Improve error handling around file descriptors in wserv 2017-11-17 22:55:06 +11:00
Kevin Easton abfe84eb5c Use correct formats / types in snprintf() calls in tcl.c 2017-11-17 22:48:03 +11:00
Kevin Easton 1569d859af Clean up upper() and lower() 2017-11-17 17:43:22 +11:00
Kevin Easton 0d5698d41b Add inv_strpbrk() function and convert equivalent sindex() calls
inv_strpbrk() is the inverse of the standard function strpbrk().

Calls to sindex() where both strings are not NULL and the second string begins with ^ are equivalent
to calls to inv_strpbrk() (but without the ^).  Convert those calls.
2017-11-17 17:19:07 +11:00
Kevin Easton 8c7d9334dd Replace uses of sindex() with constant accept strings with strpbrk() / strchr()
sindex(), where neither argument is NULL and the accept string does not start with ^, is exactly equivalent
to the standard function strpbrk().

Further, strpbrk() where the accept string is only one character long, is exactly equivalent to strchr().
2017-11-17 16:32:28 +11:00
Kevin Easton eb6ffc7395 Convert strsearch() arguments to const char *
Also clean up the implementation a little.
2017-11-17 15:47:33 +11:00
Kevin Easton e8ce5fb973 Convert sindex() and rsindex() to use const char * arguments
Also simply sindex() considerably using standard strspn() / strcspn() functions.
2017-11-17 12:21:12 +11:00
Kevin Easton fea88185f8 Clean up function move_to_abs_word() and rename to move_to_word()
Remove the output argument, as it's the same as the function return value anyway, so
the callers should just use that.
2017-11-14 23:15:33 +11:00
Kevin Easton 5e40c1ac01 Don't move pointer before start of object in move_word_rel()
The old code could move the variable 'pointer' backwards one character before the start
of the string (then incremented it again before returning).  Formally this is undefined
behaviour, so fix it.
2017-11-12 23:34:54 +11:00
Kevin Easton a71ee883e1 Make "You can't hide an invisible window" message respect /SET WINDOW_QUIET
Also remove unnecessary NULL check, window->screen is already checked for NULL.
2017-11-10 17:16:58 +11:00
Kevin Easton c6f420b53d Simplify get_window_by_desc()
The '#' case never worked anyway, so just remove it and simplify.
2017-11-10 17:12:09 +11:00
Kevin Easton 3ec950a7d7 Allow $mychannels() to query a window attached to a different server
Otherwise, there's really no point in passing this function a window refnum at all.
2017-11-10 16:57:26 +11:00
Kevin Easton a028aebdb9 Fix crash when passing $mychannels() a non-existent window refnum 2017-11-10 16:53:32 +11:00
Kevin Easton 8a176c6950 Remove pointless check for unsigned number < 0 in get_window_by_refnum() 2017-11-09 23:50:13 +11:00
Kevin Easton ce55f5eaa8 Move unsetting of UPDATE_STATUS flag into update_window_status()
Also remove a buggy attempt to unset the flag from set_hold_mode().
2017-11-09 23:45:09 +11:00
Kevin Easton c881d1d20f Simplify condition in set_current_channel_by_refnum() 2017-11-09 23:35:28 +11:00
Kevin Easton f81126186c Simplifications in window_query()
Should be no user-visible changes.
2017-11-09 23:32:56 +11:00
Kevin Easton 50999b3d5b Remove six dll_ variables from the module exports table
The removed variables are:

	dll_functions
	dll_numeric
	dll_commands
	dll_variable
	dll_ctcp
	dll_window

These are not actually directly used by any modules, and hiding them allows us to more easily
change their implementation later.
2017-11-06 17:14:12 +11:00
Kevin Easton a58078de7e Fix size argument in call to memset in MD5Final()
This function isn't used anyway, but the compiler was warning about the incorrect code.
2017-11-06 17:07:58 +11:00
Kevin Easton fcda7a4d55 Switch cavlink and nap plugins to use save_dllvar() function for saving SETs
This removes the only module uses of dll_variable, allowing it to be removed from the module
exports.
2017-11-06 17:01:36 +11:00
Kevin Easton 3f047ab2a9 Add save_dllvar() function exported to modules
This helper function is for modules to save the contents of their module variables to a file
as SET commands.

It will remove the need to export the raw dll_variable list to modules.
2017-11-06 16:54:51 +11:00
Kevin Easton 4b8ffbc52a Improve error message on module version mismatch 2017-11-06 16:52:14 +11:00
Kevin Easton ae4a45179e Remove unnecessary NULL check in whoreply()
new_w has already been checked for NULL further up the loop.
2017-11-03 16:32:33 +11:00
Kevin Easton 0703126773 Factor out common dll variable list lookup into lookup_dllvar() 2017-11-03 16:22:57 +11:00
Kevin Easton 3b2793877d Change set_var_value() argument from int to enum VAR_TYPES 2017-11-03 14:48:26 +11:00
Kevin Easton 59d237d819 Remove unused code branch in setcmd()
If cnt == 0, that implies that dll == NULL (if the list search returned an entry, it at least must match
the prefix we're looking for).
2017-11-03 01:18:04 +11:00
Kevin Easton 574053da52 Split out set_var_value_dll() from set_var_value()
Also remove external declaration of set_var_value() from vars.h, since it is only used in
vars.c.
2017-11-03 01:14:30 +11:00
Kevin Easton 1797858d0b Extract common core from set_var_value() into helper function 2017-11-02 23:57:15 +11:00
Kevin Easton 1cb3775ced Fix typo testing VIF_CHANGED
This error seemed to be benign, because I don't think there was a way to get here with
int_flags non-zero without VIF_CHANGED already set.

Remove unnecessary tests for 'value' and '!value', because value is always non-NULL in that
code path.
2017-11-02 16:16:37 +11:00
Kevin Easton a220b8aa7f Rename VIF_BITCHX to VF_BITCHX
This flag is part of ->flags, not ->int_flags, so name it appropriately.
2017-10-26 17:41:05 +11:00
Kevin Easton 571aafcb45 Add helper function save_vars_by_flags() for saving variables
The majority of save_variables() and savebitchx_variables() were common code, so pull it
out into a helper function.
2017-10-26 17:36:28 +11:00
Kevin Easton dc30b852e1 Add VF_NO_SAVE flag to mark variables that shouldn't be saved
This replaces an explicit test for the variable names "DISPLAY" and "CLIENT_INFORMATION".
2017-10-26 16:15:59 +11:00
Kevin Easton 796eef3f99 Removed unused VF_NODAEMON flag
No code ever tests for this flag, so just remove it.
2017-10-26 15:56:31 +11:00
Kevin Easton 46047b058c Remove unused function clear_sets() 2017-10-25 17:00:48 +11:00
Kevin Easton 481970b30d Use correct type for ircii_rem_str() 2017-10-25 16:59:18 +11:00
Kevin Easton ff048fbee9 Shitlist level 3/4 should kick regardless of /CSET KICK_IF_BANNED
As reported by Ancient, this is how it is documented to work.  It's also how shitlist level 2 works, so
it's consistent this way.

Some other cleanups in check_auto() while we're here.
2017-10-23 00:32:05 +11:00
Kevin Easton 60b40cf332 Simplify conditionals in check_prot() 2017-10-20 16:12:14 +11:00
gdinit bac141898b Correct spelling of some client messages, comments and function names 2017-10-20 14:57:17 +11:00
Kevin Easton b102b9d5c9 Remove pointless NULL test in translat.c
'args' is always non-NULL when this function is called (and has already been dereferenced before the point
where it was tested, anyway).
2017-10-14 23:18:26 +11:00
Kevin Easton 5839f2b393 Support fractional-second intervals on recurring timers
A fractional-second timeout was already supported for the initial timeout of a /TIMER, but
if the timer was recurring then the interval was rounded to a whole number of seconds for
the subsequent timeouts.

Change the type of interval from long to double to fix this.
2017-10-11 23:21:14 +11:00
Kevin Easton bbd18ba47e Introduce time_offset() helper and replace open-coded versions in timer.c
This function takes a struct timeval and offsets it by a (potentially fractional)
number of seconds, given as a 'double'.
2017-09-20 23:07:52 +10:00
Kevin Easton 604fcf794b Remove unused kill_timer() and get_delete_timer() functions
These functions are completely unused.  Also remove the TimerList.delete member that is only used
by these functions.
2017-09-20 15:31:41 +10:00
Kevin Easton 5bd8a40cf8 Change $geom() to return current screen's geometry, not the original terminal's
This only affects additional screens created with /window create, which is an unusual
configuration.
2017-09-15 17:39:52 +10:00
Kevin Easton 70ac43ce77 Remove globals 'li' and 'co' in term.c
These globals were used to store the original terminal dimesions from the terminal database (or
in the case of reattaching, supplied by scr-bx) to be applied if the current terminal dimensions
could not be determined.

Instead, we leave the original terminal dimensions in current_term->TI_lines and current_term->TI_cols,
and create current_term->li and current_term->co to store the current terminal dimensions (as eg.
supplied by scr-bx).
2017-09-15 17:15:24 +10:00
Kevin Easton c9b0e654b5 Remove unused variables BC, UP and my_PC
These appear to be a hangover from old termcap-using code, but there's nothing in BX that uses them anymore.
2017-09-02 07:03:10 +10:00
Kevin Easton 9080475ff7 Remove unnecessary typecasts in initialisation of tcaps[] 2017-09-02 04:55:19 +10:00
Kevin Easton 4a3cff53f4 Simplify and improve justification step of status formatting, and use the same code for $statsparse()
Separate out the justification step of make_status() into a new function, so it can be wired in to
stat_convert_format() as well.  This makes $statsparse() work correctly with right-justified status
formats.

Minimise the amount of copying around that is done during the justification - instead, we can just
remember pointers into the buffer returned by strip_ansi() for the left-hand-side, right-hand-side and
padding character.

Don't keep concatenating onto the same buffer with strlcat() when generating the padding - that gives
n^2 behaviour.  Instead keep a pointer to the current end and concatenate there.

Ensure buffer is null-terminated before calling strlcat() on it, in stat_convert_format().
2017-08-23 02:21:42 +10:00
Kevin Easton f7de661f2f Use L suffixed constant to match type of server.flags / server.flags2 field in (get|set)_server_flag()
Also squash return value of get_server_flag() to 1 / 0.
2017-08-22 23:16:43 +10:00
Kevin Easton 05633c9bc3 Consistently use SIGNAL_HANDLER() macro to define signal handler functions
With this change, the signal handler signature is defined in only one place.

Also make most signal handler functions static (those that are only referred to in irc.c).
2017-08-22 22:48:06 +10:00
Kevin Easton 742eeb33f7 Restore terminal settings after flushing output, not before 2017-08-22 22:26:50 +10:00
Kevin Easton 73148fa4a4 Remove unused server flags CLOSE_PENDING and CLOSING_SERVER, rename LOGGED_IN to SF_LOGGED_IN
CLOSING_SERVER was never referenced outside of server.h where it's defined, and CLOSE_PENDING was cleared
but never set by any code.

Rename LOGGED_IN to namespace it (in anticipation of other flag variables in the server struct being
consolidated into a set of server flags).

Also put correct parantheses around the definition of SF_LOGGED_IN.
2017-07-19 07:57:52 +10:00
Kevin Easton 0fea2b97a4 Remove exported function create_server_list()
The guts of this function doesn't need to be in server.c - it only uses extern server functions so it
makes sense just to move it into the body of function_servers(), the only caller.

That means it's no longer accessible for loadable modules, but it isn't much use for them anyway.  They
can always directly access the server list if they need that info.

(Requires rolling the module table version).
2017-07-17 12:59:49 +10:00
Kevin Easton d2e576a774 Fix $myservers(1) to only return registered server refnums
When $myservers() is called with an argument of 1 it is supposed to only return the refnums of servers
that are registered (ie. those which it is legal to send a command to).  This is the way EPIC works, and
it was always intended to work this way in BX too.

Also fix the warning about a NULL itsname - we use our name for the server if it isn't registered yet.

Remove the slightly bogus use of strncat() while we're here, by removing the temporary stack buffer and
just directly creating the result string with m_s3cat().
2017-07-17 12:48:28 +10:00
Kevin Easton cd9c358eed Fix CHANGE_NICK_ON_KILL feature
Remove the 'resend_only' flag option to fudge_nickname().  The only caller passing it was the CHANGE_NICK_ON_KILL
feature, and in that case it was the wrong thing too (and stopped that function from working at all).

Some other minor cleanups in fudge_nickname() while we're there.
2017-07-15 23:29:14 +10:00
Kevin Easton b481ed1e6e Remove pointless NULL check in repaint_window()
The function has already dereferenced the pointer and passing NULL to this function is just a bug.
2017-07-15 22:24:09 +10:00
Kevin Easton ce780c5b63 Use character constants instead of bare integers for escape character in strip_ansi()
Also use '\t' instead of '\011' in prepare_display().

Should be no functional changes, just looks nicer.
2017-07-15 22:22:58 +10:00
Kevin Easton df12f6860a Remove unused 'in_help' flag from log_put_it()
The flag was set, but never tested.
2017-07-15 00:33:24 +10:00
Kevin Easton d68d06480c Remove unused argument from log_put_it(), move declaration to output.h 2017-07-15 00:16:18 +10:00
Kevin Easton 9c46ddddb6 Check for unset MSGLOG_FILE or CTOOLZ_DIR, or failed stat(), in readlog()
Unset MSGLOG_FILE or CTOOLZ_DIR could cause a null pointer dereference.

If stat() failed it dereferenced the bogus 'struct stat', and in the directory case
just silently failed.  Now it falls through to the "error opening" path.
2017-07-15 00:07:25 +10:00
Kevin Easton a6a5a19e28 Fix memory leak in /QUEUE -FLUSH
The queue->name must be freed.
2017-07-11 19:01:09 +10:00
Kevin Easton dbd37bc35d Messages sent by /SV and /PASTE should be logged in the send log
This looks like an oversight.
2017-07-09 00:14:15 +10:00
Kevin Easton bb616e0626 Change send_text() to combine command, hook and log arguments into one set of flags
This function is exported to modules, so it requires updating a few modules and rolling the module table version.
2017-07-09 00:08:04 +10:00
Kevin Easton 496bbc8b74 Add send_text() flag STXT_LOG
Eventually to replace the 'log' parameter to send_text().
2017-07-08 21:49:59 +10:00
Kevin Easton 1bceb5ed86 Pass STXT_NOTICE flag instead of command string to functions downstream of send_text()
This uses another bit in the existing flags argument in place of the command argument, and avoids
having to re-compare against fixed strings ("PRIVMSG", "NOTICE").
2017-07-08 21:37:08 +10:00
Kevin Easton f8c76a4351 Include ircaux.h in qbx.c
This is required for SERVICE_CLIENT and PROTOCOL_UDP.
2017-07-08 21:34:28 +10:00
Kevin Easton a8e33b5efd Include irc.h in struct.h for required macros and typedefs
This fixes building the acro plugin.
2017-07-08 21:32:42 +10:00
Kevin Easton 2d0b3e728f Replace 'hook' and 'noisy' flags in functions downstream of send_text() with !(stxt_flags & STXT_QUIET)
This is in preparation for consolidating the various send_text() options into one set of consistent flags.
2017-07-07 15:19:39 +10:00
Kevin Easton 2c8671f3dd Simplify send_text() by separating out special targets into another function
Also rename the double-negative flag 'not_done' to the more description 'done_forward'.
2017-07-05 17:36:52 +10:00
Kevin Easton ac84793dd6 Switch from direct tcl_interp->result access to Tcl_GetStringResult() and Tcl_AppendResult()
This allows building against recent libtcl versions.

A fallback definition of Tcl_GetStringResult() is included so that building against libtcl 7 still works.
2017-07-01 00:47:20 +10:00
Kevin Easton 356eb699d0 Remove unnecessary repeated lines in parse_command()
There was no need for the same lines both in the WANT_TCL and !WANT_TCL branches.
2017-06-30 23:05:05 +10:00
Kevin Easton 19639ed608 Minor cleanups in send_text()
This removes some unused variables and some unnecessary copies of the text to be sent.
2017-06-29 16:51:26 +10:00
Kevin Easton 57827008a1 Change sed_encrypt_msg() so it doesn't modify the passed message in-place
This means the calling code in commands.c no longer needs to take a copy before calling the function.

Also remove code testing result of of ctcp_quote_it() and ctcp_unquote_it() - these functions never fail.
2017-06-29 00:10:24 +10:00
Kevin Easton 3c2028e167 Rename crypt_msg() / decrypt_msg() to sed_encrypt_msg() / sed_decrypt_msg() and move to ctcp.c
These functions are really specific to parsing and creating CTCP SED messages, which means they belong
in ctcp.c with the other CTCP code.

Also remove unnecessary inclusions of encrypt.h and ctcp.h.
2017-06-28 22:26:08 +10:00
Kevin Easton 9b0d3e4ab5 Type improvements to the internal encrypt/decrypt and CTCP quoting API
Use size_t for passing buffer lengths, and const char * for encryption keys and other non-modified buffer
arguments.

Remove pointless helper function do_crypt().
2017-06-28 16:57:35 +10:00
Kevin Easton c62e099d80 Add /FSET SEND_ENCRYPTED_PUBLIC format
Used when sending an encrypted message to a channel.
2017-06-28 00:03:09 +10:00
Kevin Easton 88f93c1de3 Only include color.h in source files that require it
Remove the inclusion of color.h from config.h, which is included by every file via irc.h, and instead
include it only in debug.c, fset.c and vars.c which are the only files that use it.

This minimises the number of files that need to be rebuilt when changing default format strings.
2017-06-27 18:22:45 +10:00
Kevin Easton 72ee3e6297 Correct order of arguments to /FSET SEND_ENCRYPTED_MSG and SEND_ENCRYPTED_NOTICE and improve default formatting
The argument order and default format now mirrors SEND_MSG / SEND_NOTICE but with different colours.
2017-06-27 16:27:59 +10:00
Kevin Easton ed597221f2 Add ENCRYPTED_PUBLIC and ENCRYPTED_PUBLIC_NOTICE formats
Encrypted messages to a channel need to use their own format.  This also fixes the use of ENCRYPTED_PRIVMSG
and ENCRYPTED_NOTICE - they were being called with too many arguments so the destination nick was being prepended
to the message text.
2017-06-27 14:21:12 +10:00
Kevin Easton 0c51ac19d4 Cleanups and simplifications in p_privmsg 2017-06-26 17:11:08 +10:00
Kevin Easton 0e9925f122 Minor simplification to beep_em 2017-06-26 16:54:50 +10:00
Kevin Easton 06aa5cb671 Move all handling of SED messages and notices into ctcp.c, re-enable SED notices
Actual encryped messages and notices are now printed directly from do_sed() / do_reply_sed().
Inline CTCP replacement is only done if the message cannot be decrypted (for the [ENCRYPTED MESSAGE]
placeholder).

This removes the need for the global flag 'sed' to alter the NOTICE and PRIVMSG handling.

A side-effect of this is that SED PRIVMSGs now do not go through the usual PRIVMSG ignore
and flood handling.  This is acceptable because messages can only go through this path if
the sender has actually been added as a SED peer with /ENCRYPT, and it still goes through
the CTCP ignore and flood handling.
2017-06-26 15:13:40 +10:00
Kevin Easton fb8dfc3946 Handle SED-encrypted CTCP replies properly
When a SED-encrypted NOTICE is scanned for CTCPs within the decrypted portion, they should be
handled with do_notice_ctcp() so they are treated as CTCP replies.
2017-06-22 00:03:53 +10:00
Kevin Easton 64d524804c Test sent_kick instead of kickcount for KICKFLOOD kicking
kickcount is for counting KICKs sent by the user to detect KICK floods.
2017-06-11 00:36:53 +10:00
Kevin Easton 07ab60f3ff Test sent_kick instead of kickcount for NICKFLOOD kicking
kickcount is for counting KICKs sent by the user to detect KICK floods.

The userlist and isme() tests are already done prior to calling handle_nickflood() so they are
not needed here.
2017-06-11 00:33:33 +10:00
Kevin Easton 50608f65ff Test sent_kick instead of kickcount for DEOPFLOOD kicking
kickcount is for counting KICKs sent by the user to detect KICK floods.
2017-06-11 00:26:57 +10:00
Kevin Easton 3caf308ea0 Test sent_kick instead of kickcount for JOINFLOOD kicking
kickcount is for counting KICKs sent by the user to detect KICK floods.
2017-06-11 00:23:39 +10:00
Kevin Easton 6b1fcf9c75 Add sent_nick flag to NickList struct, bump MODULE_VERSION
This flag is for tracking if we've sent a KICK for a nick.  It means we can avoid
sending duplicate KICKs (eg for floods, channel protection etc).

MODULE_VERSION is bumped because NickList is a struct exported to modules.
2017-06-11 00:08:07 +10:00
Kevin Easton b4ec2f6a0e Minor cleanups in p_kick()
Remove dead store to ptr.  Rename 'who' to 'target'.
2017-06-10 23:34:22 +10:00
Kevin Easton 5237136083 Replace writestr() with a simple fputs() call 2017-06-09 16:15:47 +10:00
Kevin Easton 4ae2c5ebdd Write correct length to terminal for unflash sequences
Introduce a wrapper for fwrite() of a full string to the current_ftarget.
2017-06-09 00:42:57 +10:00
Kevin Easton 917a04ce66 Use correct printf format for current_numeric 2017-06-08 23:31:10 +10:00
Kevin Easton 60dc1afdca Remove unnecessary duplicated NULL tests in handle_server_stats()
Also make handle_server_stats() static.
2017-06-08 23:17:06 +10:00
Kevin Easton 529b1e0aa0 Small cleanup of code for CTCPs over DCC CHAT 2017-06-07 00:30:12 +10:00
Kevin Easton 0a16ab16ac Introduce strbegins() macro and replace all open-coded instances
This test is done quite a bit across the tree, and the open-coded variants make it easy to have an
accidental mismatch between the length of the prefix being tested and the length actually passed to
strncmp().

This fixes an issue of that type comparing the server version against the prefix "u2.10", where the old
code used an incorrect length of 4.
2017-06-06 23:47:10 +10:00
Kevin Easton 09395464ff Don't check notifies if the interval is zero, even if the clock has gone backwards 2017-05-30 22:52:42 +10:00
Kevin Easton 09ab7a2130 Cleanup check_auto_invite() and make it static 2017-05-29 16:12:11 +10:00
Kevin Easton fb35a00d1d Add const to nick pointer passed to find_nicklist_in_channellist() 2017-05-29 15:54:57 +10:00
Kevin Easton 8f4b5600a5 Make the tcaps table const and static
This table isn't modified or referenced outside of term.c, so it can be const static.

The 'const' moves ~20K from the data segment to the text segment (on 64 bit), reducing the total size of
the BitchX data segment by 10%.
2017-05-12 11:24:00 +10:00
Kevin Easton 790ba5b428 Remove irc.h include from ircsig.c
Nothing in the irc.h header is required.
2017-05-10 23:41:32 +10:00
Kevin Easton 3f87eb31b1 Standardise header include guards
Tokens that begin with two underscores __* or an underscore and an uppercase letter _X* are reserved,
so we should avoid those for our own include guards.  The standard I'm settling on for foo.h is FOO_H_.
2017-05-10 23:30:11 +10:00
Kevin Easton a329dd8404 Include vars.h in wserv.c and scr-bx.c for enum VAR_TYPES
Also define STERM_C and include modval.h in scr-bx.c.

This allows us to remove the slightly bogus dummy definition of enum VAR_TYPES from modval.h, and use a simple
macro to redirect the declaration and use of get_int_var() to BX_get_int_var().
2017-05-10 23:19:57 +10:00
Kevin Easton 7173175adc Update "depend" target to include wterm.o, wnetwork.o and sterm.o
These special targets need to have their dependencies generated in a separate step.

Also update dependencies at the same time.
2017-05-10 23:16:40 +10:00
Kevin Easton 1c38eede94 Update source file dependencies in Makefile.in
Bring the dependencies up-to-date with a "make depend".

The major change seems to be adding modval.h and module.h as dependencies for most files.
2017-05-09 16:55:58 +10:00
Kevin Easton 84fc347f5a Move declarations of compat functions from ircaux.h to irc_std.h
irc_std.h is where these belong - it's where the normal declarations (via the system headers) come from on
systems which don't need the compat functions.
2017-05-05 00:28:21 +10:00
Kevin Easton 52b57d1576 Move the definition of the NotifyItem and NotifyList types from struct.h to notify.h
This change means that struct.h no longer needs to include alist.h, so it will be indirectly included in a lot
fewer other files.

As a consequence, server.h needs to include notify.h to get the definitions of those data types.
2017-05-04 23:50:47 +10:00
Kevin Easton 65646f6b71 Include irc_std.h instead of irc.h in alist.h
Only irc_std.h is needed here, for the u_32int_t type.
2017-05-04 23:26:47 +10:00
Kevin Easton 6d50e933ee Remove unnecessary struct.h include from hash.h 2017-05-04 23:14:00 +10:00
Kevin Easton be65ab7adb Standardise include guard in modval.h
Move the #ifndef / #define together at the start of the file, to trigger the compiler's include
guard optimisation.
2017-05-04 00:05:02 +10:00
Kevin Easton 107774aa51 Remove unused opendir.c
opendir() / readdir() have been in POSIX since the beginning.  This file isn't hooked up to compile anyway.
2017-05-03 23:19:05 +10:00
Kevin Easton 6234efc2fd Remove unused scandir() compat implementation
scandir() isn't used anywhere within the client, so we don't need to bother with a compat
implementation for systems that don't have it.
2017-05-03 22:49:30 +10:00
Kevin Easton 74a0c89d26 Use the same compat.o and ircsig.o object files for all binaries
Neither compat.c nor ircsig.c are compiled different for wserv or scr-bx, so there's no reason these
binaries can't just link to the same .o files as the main BitchX binary.

This also cleans up the build rules around wserv and scr-bx a little.
2017-05-03 21:55:55 +10:00
Kevin Easton b3108dccff Remove last use of ltoa() from compat.c
Now that compat.c doesn't use any functions from the global table, it doesn't need to be differentially
compiled for wserv and scr-bx anymore.
2017-05-03 17:24:23 +10:00
Kevin Easton a0c4fc46b9 Remove long-dead snprintf compat code
These bogus compat implementations of snprintf() and vsnprintf() have long been superseded by the proper
implementations in the same file.
2017-05-03 17:07:28 +10:00
Kevin Easton 492d5658d1 Simplify handling of /DETACH socket path
init_socketpath() was building a sprintf() format string intended to be used by /DETACH to create the socket
file name.  This included the actual socket path, plus a %d for the port, plus the sanitised tty name and
hostname.

Only one caller needed all this though - the /DETACH command - and the other callers (in scr-bx.c) just
wanted to truncate it to the actual socket path.  The format string also wasn't safe - if the home directory
path, hostname or ttyname contained % characters these werent being escaped.

It simplifies things to have init_socketpath() just return the actual socket path, after creating the 'screens'
directory if necessary.  This lets the code in scr-bx.c use it as-is, and removes the need for the global
socket_path variable.  The code to include the sanitised tty name and hostname in the socket file name can
be moved to the create_ipc_socket() function.

There's no need to check access() for the socket path before trying to create it - just call mkdir() regardless,
since it will fail if the path already exists, which is fine.

This commit also adds error handling to the create_ipc_socket() function for the case where creation of the
socket file fails, and switches the chmod() and chown() for the opened file to the more appropriate fchmod()
and fchown().
2017-05-03 00:13:24 +10:00
Kevin Easton aa04e465f3 Document and simplify the ltoa() / my_ltoa() distinction
The function provided (either by #define to the module table or directly in the case of scr-bx.c)
is called my_ltoa(), and the #define in irc_std.h aliases this to ltoa().
2017-04-30 23:33:58 +10:00
Kevin Easton 7ee8799b8e Minor fixes in dll_load()
The test for p != NULL is pointless, it has already been dereferenced and modified.

The argument to tolower() and toupper() must be in the range of unsigned char.

Fix some spelling errors in user-visible messages.
2017-04-24 17:34:07 +10:00
Kevin Easton afc4793cd8 Remove unnecessary variable from userhost_scanport() and findports() 2017-04-17 13:27:35 +10:00
Kevin Easton d851661942 Remove unused function argument from scan() 2017-04-16 23:28:18 +10:00
Kevin Easton 1ccd082cd2 Cleanup remove_channel()
remove_channel() is only called in direct response to a message from a server,
so it always acts on from_server - remove the unnecessary server argument.

The channel argument is always non-NULL - remove the dead code that removed all
channels if a NULL channel was passed.
2017-04-16 16:19:55 +10:00
Kevin Easton 53f3a34ca5 Change channel argument of is_current_channel() to const char * 2017-04-16 16:14:13 +10:00
Kevin Easton 2eabfabc35 Change lookup_channel() channel argument to be const char * 2017-04-16 16:03:01 +10:00
Kevin Easton 274ba92c2e Remove useless NULL checks
m_strdup() never returns NULL.
2017-04-15 22:56:36 +10:00
Kevin Easton a01a93eaa3 Fix removal of DCC_PROC-type plugin addins
The declaration of dcc_dllcommands in modules.c was wrong - add it to dcc.h so it's checked against the definition in dcc.c
and include it from there.

The DCC_dllcommands structure isn't structured like a "List2" so remove_module() doesn't work - use remove_from_list_ext().
2017-04-15 22:50:24 +10:00
Kevin Easton eca1e54602 Simplify addidle() a little 2017-04-11 01:54:31 +10:00
Kevin Easton 83770fd645 Simplify and clean up putlog() 2017-04-11 01:44:47 +10:00
Kevin Easton 3cf21ccc9d Simplify a conditional expression 2017-04-11 01:27:31 +10:00
Kevin Easton 170b79c0d0 Switch /VER command to use ctcp_simple() 2017-04-11 01:24:36 +10:00
Kevin Easton bad8c2fa02 Remove netfinger client code and repurpose /FINGER command to send a CTCP FINGER instead
No-one runs fingerd servers anymore so this code was entirely obsolete.
2017-04-11 01:19:32 +10:00
Kevin Easton eace841366 Enable use of cached whowas info for /IG* and /UNIG* commands
Previously these codepaths were dead because it was passing an argument like "+HOST" to check_whowas_nick_buffer()
in place of the channel name, so it would never find anything.

Now that function supports a NULL channel to mean "any channel", so we can use that.  The actual code itself needed to be
fixed as well, it's now similar to the way userhost_unban() is written.
2017-04-05 22:55:43 +10:00
Kevin Easton 484fc156ed Remove HAVE_SSL define from configure
This is no longer needed, we use the HAVE_LIBSSL from AC_CHECK_LIB now.
2017-03-17 01:27:30 +11:00
Kevin Easton 184af728c7 Add support for OpenSSL 1.1.0 to configure script
OpenSSL 1.1.0 removed the SSLeay() function and replaced it with a macro, that AC_CHECK_LIB can't see.

Search for ERR_get_error() instead.
2017-03-17 00:38:46 +11:00
Kevin Easton 2fa0bf818a Replace uses of HAVE_SSL with HAVE_LIBSSL
autoconf's AC_CHECK_LIB automatically sets HAVE_LIBSSL, whereas HAVE_SSL has to be set manually.

This prepares us to remove some code from configure.
2017-03-17 00:07:38 +11:00
Kevin Easton 1fbafddc59 UNBAN <nick> can use cached whowas info to unset bans
The use of the whowas cache in userhost_unban() would never work, because it was passing 'args' as the channel
name which also included the window number.

Rework this substantially, including using lookup_channel() and set_display_target() in place of prepare_command().
2017-02-25 00:34:58 +11:00
Kevin Easton 3a5a489f25 Add option to check_whowas_nick_buffer() to scan all channels in whowas list
Passing NULL channel lets you scan the full whowas list, which is useful for functions not tied to a channel
like ignore.
2017-02-22 23:03:17 +11:00
Kevin Easton 2363ea709d Remove unused 'unlink' argument from check_whowas_nick_buffer()
Every caller was passing 0 for unlink, so remove it.  This simplifies the function.

Also change the nick and channel arguments to const char *.
2017-02-22 22:28:17 +11:00
Kevin Easton 0c721de2a5 Remove dead code and clean up convert_output_format_raw()
The second branch of if (str) ... else if (str) is dead code, remove it.  Also remove the if() entirely because
the while condition covers it exactly anyway.

Move the static variables used only in this function to function scope.

Change color_mod to const static and remove unneeded variable c_mod.

Move the increment of cparse_recurse to after the point where we bail.

None of this should have any user-visible impact.
2017-02-18 01:04:39 +11:00
Kevin Easton 61ff399b3d Remove superfluous test for current_window
It is always non-NULL, and we dereference it unconditionally anyway.
2017-02-18 00:32:23 +11:00
Kevin Easton 5574ff043b Replace an alloca() call with new_malloc() / new_free()
This also cleans up the code here a bit.
2017-02-18 00:00:45 +11:00
Kevin Easton e5b2a65fe2 Remove pointless NULL test and unreachable return
There is no point testing ptr for NULL - we dereference it anyway, this function can't be called with a
NULL pointer for the first argument.
2017-02-17 21:55:11 +11:00
Kevin Easton a0e8bd5742 Cast pid_t to long for fprintf()
pid_t is defined by POSIX to be a signed integer type, so the %u format is wrong.

Cast to long and print with %ld - it is unlikely that any real-world system has pid_t bigger than long.
2017-02-17 16:50:41 +11:00
Kevin Easton 686344314f Unsetting CMDCHARS sets it back to the default
Previously you could unset CMDCHARS and the effect would be to treat it like it was set to DEFAULT_CMDCHARS,
except that some code was missing the fallback (eg. ignore_last_nick()) which would make it crash.

Instead of having the fallback everywhere, just make it so that you can't unset the variable - if you try, it
sets it to DEFAULT_CMDCHARS.  This reflects what the behaviour has always been, it just makes it explicit to
the user and the bonus is we don't have the test it for NULL everywhere.
2017-02-16 23:42:52 +11:00
Kevin Easton debfebf3a7 Fix a double-free bug when a window on an alternate screen queries an exec process
The 'free_it' variable was only initialised to zero at the start of the function, so when non-main screens
were processed in the later iterations of the loop, it could keep a value of 1 from the previous iteration.

We don't actually need a free_it variable at all - just use a NULL value of ptr_free to indicate that there
is nothing to free (and passing a NULL to new_free() is a no-op).

This also simplifies a test because ptr is always non-NULL (strip_ansi() never returns NULL).
2017-02-16 23:12:38 +11:00
Kevin Easton 790cb771ed Use 127.0.0.1 for wserv socket, which fixes /WINDOW CREATE with IPv6
If wserv is told to connect to "localhost" it might try to connect to ::1, which won't work because
the wserv socket is AF_INET only.

So explicitly bind the socket and make the connection to "127.0.0.1" instead.
2017-02-16 22:06:32 +11:00
Kevin Easton 1f062fb7de Remove unnecessary repeated check
tmp has already been tested in the previous line.
2017-02-12 23:55:16 +11:00
Kevin Easton 3d353f5a48 Remove dead store to a variable 2017-02-11 22:42:32 +11:00
Kevin Easton 95ad004ff0 Remove unused function is_ignored() 2017-02-08 23:56:36 +11:00
Kevin Easton ce92ddc8fc Fix typo in unused function is_ignored() 2017-02-05 00:09:51 +11:00
Kevin Easton bbaeca3bc3 Allow INVITE and WALLOP floods to trigger auto-ignore
Previously, INVITE and WALLOP were tracked for flooding, but if the flood triggered then the auto-ignore
didn't happen.  As far as I can tell, this was just an oversight.
2017-01-25 17:12:38 +11:00
Kevin Easton 27b2f3e939 Change ignore_type() arguments to (const char *, size_t)
This just changes the arguments to match the strncmp() calls in the function.
2017-01-21 14:23:57 +11:00
Kevin Easton 69296c2c5a Switch *_FLOOD constants to sequential rather than bits and add flood type lookup table
Using sequential constants for *_FLOOD constants means that we can use a simple lookup table to convert them
into text for display and IGNORE_* constants.
2017-01-21 14:17:42 +11:00
Kevin Easton 81ddf52909 Introduce an enum flood_type for the *_FLOOD constants
This allows the debugger to show the decoded constant name.
2017-01-19 17:10:32 +11:00
Kevin Easton fef98f43ba Separate notion of _FLOOD constant from the flags stored in the Flooding struct
This adds a FLOOD_FLAG() macro to convert a _FLOOD constant to the appropriate flag.  For now this just
casts the argument to unsigned int.

Rename Flooding.type to Flooding.flags and change it to unsigned int, to reflect that it's a bitfield of
flags for multiple flooding types.
2017-01-18 17:03:06 +11:00
Kevin Easton 78dbdea441 Remove 'type' argument of flood_prot()
All callers of flood_prot() were supplying { get_flood_types(flood_type), flood_type } as the second and third arguments,
except one that supplied { get_flood_types(CTCP_FLOOD), CTCP_ACTION_FLOOD }.

Hardwiring this logic in to flood_prot() lets us remove the 'type' argument without changing the behaviour.
2017-01-18 00:11:49 +11:00
Kevin Easton 7dce90d809 Move COMPILE-PROBLEMS into INSTALL 2017-01-07 14:54:10 +11:00
Kevin Easton 657acd8985 Remove dead store to currmatch in do_hook() 2017-01-03 00:12:23 +11:00
Kevin Easton 89a5417a11 Use %d sprintf() format for 'int' arguments rather than %u 2017-01-02 15:16:13 +11:00
Kevin Easton a047eba6da Simplify unnecessarily complex condition
!match || (match && ...) is exactly equivalent to !match || ...
2017-01-02 15:09:21 +11:00
Kevin Easton f8f6723b80 Update docs to remove references to bitchx.com
Thanks to cpet for the patch.
2017-01-02 01:10:28 +11:00
Kevin Easton 00ae33b67f Clean up formatting in function_sar() and function_msar(), remove redundant test
The test for !search in function_msar() wasn't necessary because it is assigned from a pointer
that was just tested for NULL above.
2017-01-02 00:47:43 +11:00
Kevin Easton 8975ba93dd Change $indextoword() so that the return value numbers the words from 0 rather than 1
This aligns the function with the documentation and what EPIC4/5 do. I couldn't find any example of an existing
script that actually called this function, so hopefully no-one is relying on the old behaviour.
2017-01-01 23:33:25 +11:00
Kevin Easton 678adbdd40 Rework and simplify $remw() implementation
This replaces calls to alloca() followed by two strcpy()s with a single
call to memmove(), and removes a confusing for/break structure.

The function should behave exactly as it did before.
2016-12-14 23:39:31 +11:00
Kevin Easton 39dd68b67b Add regression test script for $remw() 2016-12-14 23:38:28 +11:00
Kevin Easton 908e6cdf00 Remove doubled-up identical fset_string_var() calls 2016-12-07 23:53:14 +11:00
Kevin Easton 21a12c004b Correct issue where flood detection could become unreliable
The static 'pos' variable in check_flooding() would not stay in sync with the number of entries in
flood_list after clean_flood_list() was called.  This meant that check_flooding() would always end up
removing all previous entries if it tried to add a new one.

Fix this by removing the tracking of number of flood_list entries, and just removing stale ones (older
than /SET FLOOD_RATE).
2016-11-26 00:08:59 +11:00
Kevin Easton 966f1c6c27 Apply correct casts to check_ext_mail and check_ext_mail_status
As always, the funcion pointers should be cast to the correct type before calling them, rather
than calling them with the wrong type and trying to cast the result.  Fixes a warning compiling
mail.c on 64 bit architectures, and this might well have caused a crash when using the qmail plugin
on those architectures too.
2016-11-03 00:57:03 +11:00
Kevin Easton 414b1cc679 Move calls to parse_offer_params() into create_dcc_int()
Every call to create_dcc_int() was preceded by a call to parse_offer_params(), and the DCC_int
is where the address/port/size produced by the latter is stored, so this refactoring makes
sense and reduces the calling function complexity/size considerably.
2016-11-03 00:45:38 +11:00
Kevin Easton 6cac0e6bb1 Truncate DCC port to unsigned short before checking for a privileged port
Checking before truncation means you can sneak a privileged port past the check.

This change also collects the various broken-out parts of a CTCP DCC offer into a struct so that
it's easier to pass them all around together.
2016-11-02 23:58:11 +11:00
Kevin Easton 23d466c4a1 Don't show DCC "Handshake failed" message twice
parse_offer_params() was being run unconditionally by check_dcc_init() even if it didn't find a
custom init_func() to call, which is the usual case.  It then gets called again by the hardwired
DCC init function, which led to the error message appearing twice.  This has check_dcc_init() only
call parse_offer_params() when its about to dispatch to a custom init func.

This also improves the message a bit (making it [host:port] rather than the other way around) and
combines the 'privileged port' message and "zero address" message together.
2016-11-02 22:19:57 +11:00
Kevin Easton a5b78db7db Remove pointless typedef my_uint in struct.h 2016-11-02 16:55:10 +11:00
Kevin Easton 34c2a66a35 Improve accuracy of DCC LIST speed and ETA calculations
Switch from using whole-second time_t values to fractional values calculated with time_since().
2016-10-29 01:03:18 +11:00
Kevin Easton f372e2a19b Use the same format in /DCC LIST for all waiting offers
Previously waiting (inactive) file-type offers were shown different to others, omitting the
time-since-offer.  Unify them to use the same format, which also cuts out a few lines of code.

Also tweaks the DCC_BAR_TYPE 1 format to include the DCC state (always Active) where the
completion bar would be in the DCC_BAR_TYPE 0 format.  This just looks a bit more consistent.
2016-10-29 00:21:00 +11:00
Kevin Easton 031608a4ea Replace get_bar_percent() with get_stat_format()
get_stat_format() now returns the entire cparse string, not just the completion bar portion.  This
means we don't need to call convert_output_format() twice.
2016-10-29 00:00:27 +11:00
Kevin Easton 30e1a65efb Add function dcc_type_name() to convert DCC type to corresponding name.
This conversion (which conditionally prepends 'T' to the DCC type name depending on whether
TDCC is enabled or not) was open-coded in several places.

Also removes unused extern function get_dcc_type().
2016-10-28 15:35:23 +11:00
Kevin Easton 919b76fcef Correctly show time since offer for DCC CHAT offers in /DCC LIST
s->time on the SocketList is set to the time that the chat offer will expire, so it's in the future.
This shows up as a very large positive time.  Instead, use n->lasttime as that is set to the time
when the offer is made.

Also adjust the format for non-file offers so that it all lines up properly.
2016-10-27 15:14:57 +11:00
Kevin Easton 30e3e65af7 Move translation of DCC_ACTIVE / DCC_WAIT / DCC_OFFER state to string into new function
The same expression was open-coded in several places, so collect it into one.
2016-10-27 14:54:21 +11:00
Kevin Easton 3cba15f6b4 Further cleanups in dcc_glist()
This now calculates a 'pcomplete' value for proportion of transfer complete (0.0 to 1.0).
From this we can calculate most other things easily - percent complete, ETA, and the size
of the completion bars.

User-visible change is that the DCC_BAR_TYPE 1 bar now matches the % complete for the RESUMEd
file case.
2016-10-27 00:23:35 +11:00
Kevin Easton ed12420755 Extensive cleanups and simplifications in dcc_glist()
The only user-visible change here is that the bar displayed for DCC_BAR_TYPE 1 is now shown
as empty for a zero-length file rather than full, matching the 0.0% complete that is shown
and the bar displayed in the DCC_BAR_TYPE 0 case.
2016-10-26 23:47:24 +11:00
Kevin Easton d8a53ab045 Correctly align formatting of /DCC LIST line for /SET DCC_BAR_TYPE 1
With DCC_BAR_TYPE 1 set, the stat line for active DCC file connections was not aligned
correctly with the header (the mm:ss field spilled into the KB/s column.)

This also simplifies things by always generating the inline bar, so the only difference
between the line printed for DCC_BAR_TYPE 0 and 1 is now the format itself.
2016-10-25 13:56:56 +11:00
Kevin Easton 09e53eb6d4 Cleanups in open_listen_port()
This fixes a few issues in this function - the socket type should be 'int' not 'socklen_t', the
error cases should close() the socket so it doesn't leak.
2016-10-21 16:37:18 +11:00
Kevin Easton caba4c830c Length-check copies to DCC_current_transfer_buffer 2016-10-21 00:47:51 +11:00
Kevin Easton aacc4b2282 Fix unsigned/signed comparison in process_dcc_send1()
The result of read() can be -1, and if that is compared against the unsigned result of sizeof
it will be converted to SIZE_MAX.  Cast the result of sizeof to a signed type.
2016-10-20 21:42:10 +11:00
Kevin Easton e49dfcf11f Remove unnecessary double-sprintf() in close_dcc_file() 2016-10-19 16:48:28 +11:00
Kevin Easton b462cf0001 Simplify show_version()
Re-order the code to squash two copies of the formatting code into one.
2016-10-18 23:54:46 +11:00
Kevin Easton 0a90a9d9db Minor cleanups in commands2.c
Remove some unused expressions after comma operators.

parm.termid is an array so it is pointless to compare it to NULL.
2016-10-18 23:46:43 +11:00
Kevin Easton c2d6a184a3 Act on channel mode lock as half-op
There's no reason you shouldn't be able to use modelock as a half-op.

Also a few other minor cleanups in this function - eg. use my_send_to_server()
with the passed server number instead of implicitly using from_server.
2016-10-18 23:32:23 +11:00
Kevin Easton da1618d393 Constify pointer return value of find_command() 2016-10-16 00:45:41 +11:00
Kevin Easton c6ec1f4098 Reformat and remove some unnecessary tests in parse_line()
Remove some unnecessary tests for !line: next_expr(&line, ...) can't set line to NULL.

Fixes some whitespace breakage.
2016-10-15 11:59:39 +11:00
Kevin Easton 9a2792345f Fix crash and memory leak in $aliasctl(COMMAND MATCH)
glob_commands() would run off the end of the irc_command array if given a match that matched
the last command.  It also leaked memory because it used m_s3cat() to construct the string,
then passed that to m_strdup().

This fixes these problems by reworking glob_commands(), and at the same time removes the use
of alloca() and wild_match() by using strncmp() instead to match the start of a string.  Move
glob_commands() to alias.c and make it static since it's only used for aliasctl().

Change the 'name' argument of find_command() and find_dll_command() to const char * at the same
time, so that glob_commands()'s prefix argument can be const char * too.
2016-10-15 00:41:34 +11:00
Kevin Easton dec7caafd0 Change 'name' argument of find_fixed_array_item() to const char * 2016-10-15 00:17:31 +11:00
Kevin Easton a7f2462395 Fix memory leaks and format string issues in CDCC
cdcc_numpacks is unsigned, so %u should be used instead of %d.

Fix some memory leaks in /CDCC PLIST and /CDCC NOTICE where malloc_sprintf() was called
and the string never freed.
2016-10-14 00:56:03 +11:00
Kevin Easton 6948d91f6b Simplify unnecessary tests in CDCC
!password || (password && x) can be simplified to !password || x.

There's no need to check if a string is equal to the destination before
copying it there: might as well just copy it.
2016-10-14 00:34:26 +11:00
Kevin Easton eb4b2a29d6 Remove unused function quote_it()
This function is no longer needed.  It was problematic anyway because it didn't have a way for
the caller to specify the destination buffer size.
2016-10-13 01:44:29 +11:00
Kevin Easton 04cf832604 Change send_msg_to_channels() to remove 'channels' argument and always use PRIVMSG
The 'channels' argument was unnecessary because the channel list passed to it would
always be from get_server_channels(server) anyway.

Changing the message argument from a protocol message format string to a plain payload
string for PRIVMSG means printf-escaping of the argument is avoided in the caller.
This simplifies the callers and means we can remove the last use of quote_it().

This change also switches set_server_away() to use send_msg_to_channels() instead of
open-coding the equivalent, which simplifies that function a lot.

We are changing the signature of a function exported to modules here; however none
of the in-tree modules use this function so it should be OK.
2016-10-13 01:36:19 +11:00
Kevin Easton 08e3c99720 Remove use of quote_it() from LameKick() and masskick()
The use of quote_it() is unnecessary - we can just directly use my_send_to_server()
to construct the message.

Preparation to remove quote_it() entirely.
2016-10-09 23:22:18 +11:00
Kevin Easton 41d98dc5f5 Rename reserved identifiers in irc_std.h
Identifiers beginning with two underscores or one underscore and a capital
letter are reserved in all contexts, including macros.

The __N macro in irc_std.h is in this space, and was conflicting with a macro
definition in gcc 5.4.0's xmmintrin.h under cygwin, making the build fail.

Reported-By: ice-man
2016-10-08 00:35:46 +11:00
Kevin Easton 0fd11b3d75 Ensure masskick(), massban(), unban(), ban() and remove_bans() send command to correct server
These commands use prepare_command() to find a channel to act on, which returns the server to use.
The code should then use my_send_to_server() to ensure that it sends the command to that server -
these functions were using send_to_server() which sends to 'from_server', which means that they
could send the commands to the wrong place, for example if they were called from a hook on a
different server.

This patch was created with the following coccinelle script:

// Detects pairing preprare_command() with send_to_server() (which uses from_server)

@prepare3@
identifier s;
local idexpression c;
expression E1, E2, E3, E4, E5;
@@

(
if ((c = prepare_command(&s,...)) != NULL && ...)
{
<...
(
- send_to_server(E1);
+ my_send_to_server(s, E1);
|
- send_to_server(E1,E2);
+ my_send_to_server(s, E1, E2);
|
- send_to_server(E1,E2,E3);
+ my_send_to_server(s, E1, E2, E3);
|
- send_to_server(E1,E2,E3,E4);
+ my_send_to_server(s, E1, E2, E3, E4);
|
- send_to_server(E1,E2,E3,E4,E5);
+ my_send_to_server(s, E1, E2, E3, E4, E5);
)
...>
}
|
if ((c = prepare_command(&s,...)) == NULL || ...) { ... return ...; }
{
<...
(
- send_to_server(E1);
+ my_send_to_server(s, E1);
|
- send_to_server(E1,E2);
+ my_send_to_server(s, E1, E2);
|
- send_to_server(E1,E2,E3);
+ my_send_to_server(s, E1, E2, E3);
|
- send_to_server(E1,E2,E3,E4);
+ my_send_to_server(s, E1, E2, E3, E4);
|
- send_to_server(E1,E2,E3,E4,E5);
+ my_send_to_server(s, E1, E2, E3, E4, E5);
)
...>
}
)
2016-10-08 00:12:47 +11:00
Kevin Easton 58588946e0 Simplify send_to_server functions by adding server parameter to vsend_to_server() 2016-10-02 22:44:06 +11:00
Kevin Easton 729b029385 Code and comment cleanups to the Karll array functions
There should be no behavioural change.
2016-10-01 01:37:27 +10:00
Kevin Easton e2b351b9ce Remove unnecessary NULL checks in expr.c
The first is unnecessary because after_expand() never returns NULL, and the 'rest' pointer has been
dereferenced multiple times anyway.

The second is unnecessary because parse_number(&ptr) cannot set ptr to NULL.
2016-09-30 23:44:15 +10:00
Kevin Easton 7e3c39a464 Fix implied operators under NEW_MATH
This fixes several issues with the implied operators when NEW_MATH is enabled:

* None of the implied operators were returning the correct value, which should be the value
assigned to the LHS.

* The &&=, ||= ad ^^= operators were also operating on uninitialized variables and so behaving
unpredictably.

* The /= and %= operators would crash the client when the RHS was zero, because after outputting
the "Divide by zero" error they would go on to perform the operation anyway.
2016-09-29 01:11:29 +10:00
Kevin Easton a625650c4a Remove unnecessary NULL checks in assigncmd() and stubcmd()
In both cases, the args pointer has already been dereferenced so it cannot be NULL.
2016-09-28 14:58:43 +10:00
Kevin Easton dc17b059eb Make 'distclean' Makefile target remove .config.h 2016-08-02 23:46:55 +10:00
Kevin Easton d9b522cd0b Add back Makefile rules to create .config.h
This fixes a bug introduced in commit f2ae2327, which improved the Makefiles for parallel builds
but in doing so removed the rule to create an empty .config.h file.

.config.h isn't included in the source distribution - it's created by bxconfigure if you run it.
If you don't run it, the build systems needs to create an empty one.  This commit adds a rule to
both the toplevel Makefile.in and source/Makefile.in (the latter in case you're running 'make' just
in the source/ directory).  The toplevel one is required for building the modules tree under dll/,
since the module Makefiles don't have the right dependencies wired up.

This also makes 'distclean' remove the .config.h file.
2016-08-02 23:36:01 +10:00
Kevin Easton bc5c20ef5c Remove old file README-1.2 from debian/docs and update debian/changelog for 1.2.1
Reported by Solbu.
2016-07-25 23:00:24 +10:00
Kevin Easton 5a91e0b1d8 Add /SCANB command to scan for users on the userlist with the BOT flag
This is analagous to the /SCANF command that scans for friends etc.
2016-05-25 23:41:34 +10:00
Kevin Easton 23967ba5be Wire up /FSET WHOIS_BOT for users on the userlist with the BOT flag
This FSET has existed for a long while but has been unused for some time,
since before the userlist was reworked to use flags instead of levels.  This
means that the default value for the FSET also has to be updated.
2016-05-25 23:38:11 +10:00
Kevin Easton 95a422cd27 Directly link string format to numargs in do_dirlasttype()
This is just a simplification - the string format should always match the arguments passed,
and none of the options are using anything but plain %s formats.

This also requires modifying /RELI to store the invited-channel in .last_msg so that it
can use the numargs = 3 format.
2016-05-15 22:43:01 +10:00
Kevin Easton 2c805c096f Use /FSET RELSN to format /RELSN relayed messages
The RELSN format already existed but wasn't used - instead it used SEND_NOTICE.  The other relay
types already used similar formats for their relayed messages.

The default /FSET RELSN looks just like the default /FSET SEND_NOTICE so this shouldn't be
noticeable to anyone using the defaults.

This required updating the NOTICE-sending code to correctly stash the 'to' in the right place.
2016-05-15 22:05:16 +10:00
Kevin Easton 9fb317b07d Improve formatting of SERVER_NOTICE_CLIENT_CONNECT and SERVER_NOTICE_CLIENT_EXIT 2016-05-10 18:49:18 +10:00
Kevin Easton 43d482a444 Change /FSETs SERVER_NOTICE_KLINE and SERVER_NOTICE_GLINE to show the ban type
The ban type (eg. K-Line, G-Line, D-Line etc.) is now passed in the second-last
argument of these formats.
2016-05-10 18:30:55 +10:00
Kevin Easton df2e250ccf Clean up handling of oper server notices
This switches from somewhat gory string parsing based on strncmp() and next_arg() to a simpler alternative
based on sscanf().  I think these are much easier to understand now, and shouldn't have any subtle bugs
lurking like the old code.

This also removes support for some obsolete messages that don't seem to be in any modern ircds:
"Identd reponse differs"; bot messages like "Rejecting vlad/joh/com bot:" except for "is a possible spambot"
which is still in use; and the "High-traffic mode" messages.
2016-05-07 00:44:29 +10:00
Kevin Easton e53d1cab7b Unify handling of SWATCH NONE between OperView and non-OperView modes
Previously, SWATCH NONE meant "show no server notices" if OperView was
enabled, but "show all server notices" if OperView was disabled.  Now,
it always means "show no server notices" (the default SWATCH is ALL,
so the default will behave the same).

This allows us to simplify the code a great deal as well.

Also trim off leading "***" if the server messages are handled by
handle_oper_vision(), as they already are in parse_server_notice().
2016-04-15 00:11:08 +10:00
Kevin Easton 7c3648bb2c Don't hide first word of server notices containing "***"
Using strstr() here is entirely wrong.  The intention is to catch notices
prefixed by *** or similar, and that's already detected further up in the code,
stored in the flag variable.
2016-04-14 23:18:54 +10:00
Kevin Easton 6b0aa0f8fe Remove unnecssary space at the start of SERVER_NOTICE_* formats
Also fix up similar hardcoded formats in notice.c.

The space isn't needed because serversay() adds a space (and has done for
a very long time).
2016-04-14 22:22:05 +10:00
Kevin Easton d236b19410 Don't double-up server notices in the /RELS list
serversay() calls add_last_type(), so there's no need for the callers to do so
as well.

Remove the first argument to serversay() because it was always called with 1
anyway.
2016-04-14 21:51:49 +10:00
Kevin Easton d296739f6f Don't fire the SERVER_NOTICE hook more than once per NOTICE
The previous code would fire the hook twice per NOTICE if handle_oper_vision()
didn't handle the NOTICE (eg. /set SWATCH NONE).
2016-04-12 23:05:34 +10:00
Kevin Easton 0b91d61496 Fix conversion of SWATCH flags to string form
This was broken in commit [07cdd587], where 'sizeof' was used on a pointer
instead of the buffer pointed-to.

Fix this by having the caller of ircop_flags_to_str() supply a buffer and
length, since there's only two callers and both can use happily use stack
objects.
2016-04-10 21:38:38 +10:00
Kevin Easton 9e4602360a Remove the extra space from default SERVER_NOTICE format
Remove the extra space in the default /fset SERVER_NOTICE, and similarly
the extra space in the HUMBLE /set SERVER_PROMPT.

The code in the client always _intended_ to add a space between SERVER_PROMPT
and SERVER_NOTICE_FSET but a bug in 75p3 and below meant it that it didn't.
This bug was fixed in 1.0b but the formats were never updated.

Also remove replace the embedded ANSI in the default SERVER_PROMPT with
% color code.
2016-04-09 00:36:08 +10:00
Kevin Easton 1f64201362 Always treat NOTICEs received before registration as local server notices
We don't know the server's proper name until registration, so the test against
that isn't reliable.  We shouldn't be able to receive messages from anyone else
until we're registered, so this should be safe.

This requires changing serversay() to accept the from name instead of the
from_server.  While we're there, replace the use of alloca() with simpler
logic based on m_sprintf().
2016-04-07 00:11:27 +10:00
Kevin Easton d19c050837 Fix handling of "host.domain" style server names in ov_server()
The old code would return "omain" rather than "domain" in this case.

Also remove unneccesary checks on the return value of get_server_itsname() -
this function already falls back to 'name' if 'itsname' isn't set yet.
2016-04-06 22:22:39 +10:00
Kevin Easton 74ee653d24 Remove unnecessary extern declaration of ov_server()
It is declared in output.h, which is already included by status.c.
2016-04-06 21:33:06 +10:00
Kevin Easton b1277f75d4 Add /on NOTICE_GROUP and /fset NOTICE_GROUP analogous to MSG_GROUP
This hook and format are used for NOTICEs where the destination isn't
a channel and isn't yourself - eg. global targets like $$*.org.  This was
already the case for PRIVMSGs (using the MSG_GROUP hook and format).

Previously these were being routed like a normal NOTICE, and those don't
display the target, so it looked exactly like a private NOTICE to you.

This will also catch server notices sent before you're registered.
2016-03-31 23:55:14 +11:00
Kevin Easton 05eb8d946f Removed unused DEFAULT_FORMAT_MSG_GROUP_AR_FSET macros
There is no MSG_GROUP_AR fset.
2016-03-31 21:39:20 +11:00
Kevin Easton d464bd91fb Remove unnecessary inclusions of <numbers.h>
Functions display_msg() and check_sync() are only used in numbers.c, so they
can be static.

Remove inclusions of <numbers.h> from .c files that don't need it.
2016-03-24 11:21:09 +11:00
Kevin Easton f129ca29e7 Move got_initial_version_28() from notice.c to numbers.c, where it belongs 2016-03-24 00:08:57 +11:00
Kevin Easton 83741aca7a Add configure check for <sys/sockio.h>
Some systems need <sys/sockio.h> for the SIOCGIFCONF ioctl - this switches
to using a proper configure check for that header rather than just assuming
it'll be there if we can't find SIOCGIFCONF.  Should be more robust.
2016-03-20 23:48:31 +11:00
Kevin Easton 94f4e1c2a3 Don't #include <sys/ioctl.h> or <unistd.h> more than once
<unistd.h> is included by irc.h so it does not need to be included again here.

<sys/ioctl.h> only needs to be included once.
2016-03-18 16:46:36 +11:00
Kevin Easton 82d606979b Add HAVE_*_H checks around inclusions of netinet/in.h and sys/socket.h
Only include <netinet/in.h> and <sys/socket.h> if the system supplies them.
This is necessary to try and get the mingw32 build working again.

No need to include <sys/types.h> and <netinet/in.h> from cdns.c - these are
already included by <irc.h>.
2016-03-17 21:39:17 +11:00
Kevin Easton f21b89e428 Improve /WINDOW DESCRIBE output
Instead of showing a meaningless pointer value for Screen:, we show the
screen number and ttyname.

Also take the CO, LI values from the window's screen.

Don't show the Prompt: unless one is set.
2016-03-16 23:50:38 +11:00
Kevin Easton 9427b3db84 Try all addresses returned by getaddrinfo() until we find one that socket() is happy with
Someone reported being unable to connect with the error "Address family not
supported", which is probably being returned by socket().  It is likely a
system where getaddrinfo() is returning AF_INET6 addresses, but socket()
won't create AF_INET6 sockets.

To handle this case, we loop over all the addresses returned by getaddrinfo()
until we find one that socket() will accept.
2016-03-08 23:53:16 +11:00
Kevin Easton c2a2d68d8d Only show version once with -v command line option
Reported by cpet.
2016-02-24 17:23:38 +11:00
Kevin Easton 6dc89247e2 Drop group privileges before dropping user privileges when execing
This ensures that the saved-set-gid is also set, although this shouldn't
matter in practice since we always call execve() soon after, which
overwrites the saved-set-gid with the effective gid anyway.
2016-02-24 16:52:33 +11:00
Kevin Easton 1359f013e8 Make autogen.sh prompt to run configure
Patch from cpet, thanks!
2016-02-19 23:09:30 +11:00
Kevin Easton f2ae2327e3 Improve toplevel Makefile "all" target to work better with parallel make
Change the all: target in the toplevel Makefile so that it doesn't try to
resolve build dependencies at the top level - instead, it just recursively
builds the all: target in source/ and dll/.

Change the all: target in the source/Makefile so that it builds the EXTRAS
(scr-bx and wserv) as well as the main client binary.

The upshot of all this is that one "make" invocation is responsible for both
scr-bx and wserv, which is necessary for parallel make (make -j) to work
correctly as these binaries share some object files.
2016-02-19 22:54:50 +11:00
Kevin Easton 04f5138a6c Improve a couple of messages in /window create 2015-11-11 17:05:58 +11:00
Kevin Easton 8886c20c1b Improve messages shown by /window size 2015-11-11 14:59:21 +11:00
Kevin Easton 4ee14e00c2 Minor cleanup in add_userhost_to_dcc() 2015-10-29 22:17:10 +11:00
Kevin Easton a2e8e103e0 Modularise handling of DCC offers
There's several different types of DCC offers, all of which need slightly
different handling.  Previously they were all handled by the monster function
register_dcc_type() - this breaks them out into seperate functions for handling
SEND, RESEND, CHAT and BOT offers, moves common code into static helper
functions and renames the entry point from ctcp.c to handle_dcc_offer().

This will allow adding a way for modules to register DCC offer types that
they're interested in.

This also moves rename_file() from misc.c into dcc.c, where its only user is.
2015-10-28 21:46:38 +11:00
Kevin Easton af3b0c920a Change find_name_in_genericlist() to take const char * argument 2015-10-28 21:42:33 +11:00
Kevin Easton f2262d5b01 Change hash_nickname() to take a const char * argument 2015-10-28 21:38:26 +11:00
Kevin Easton a24f1d12ec Convert lookup_userlevelc() to accept const char * parameters
Also converted dependant functions check_channel_match() and
find_bestmatch() to use const char *.
2015-10-20 23:12:33 +11:00
Kevin Easton 51ecdb8d1b Re-add code for DCC CHAT autoget mistakenly removed in [be6bd5aca] 2015-10-12 17:22:52 +11:00
Kevin Easton cfe6735ef0 Simplify find_dcc() and find_dcc_pending()
Extract the common DCC matching code into one function and simplify
it a little.
2015-10-12 16:26:23 +11:00
Kevin Easton fe368ac875 Fix argument order for dcc_getfile_resume_start()
The last two arguments are port, then offset (as per the DCC ACCEPT CTCP
command).  We don't really use these anyway - port is passed to dcc_create()
but for pre-existing DCC entries all that did was add it to the socketinfo,
which doesn't seem to have any real effect.

Also fix dcc_create() so it passes the actual remote port to add_socketread()
(as above, this doesn't seem to have any real effect but is consistent with
the other code).
2015-10-10 22:48:26 +11:00
Kevin Easton be6bd5aca4 Simplify and improve code around DCC auto-get / auto-rename / auto-resume
This improves the client messages - eg previously the message to tell you that
you could use /DCC RESUME never got shown due to a logic error.

It also won't try to auto-resume if the local file is already the same size or
bigger than the incoming file.
2015-10-10 00:08:00 +11:00
Kevin Easton ce3fd79652 Global spelling fix s/recieve/receive/ across codebase
This includes some user-visible messages and help files, so if anyone has
hooked them with /ON WINDOW their hooks will need updating.
2015-10-04 09:06:38 +11:00
Kevin Easton 726884b0b0 Ignore DCC ACCEPT if we didn't request a DCC RESUME
Mark DCC connections that we have requested RESUME on, so that we know
whether or not to act on a DCC ACCEPT that is received.

Also fixes up a slightly wrong message in /DCC RESUME.
2015-10-04 00:44:47 +10:00
Kevin Easton c173af3f65 Remove unused DCC_CNCT_PEND flag and always define DCC_SSL
DCC_CNCT_PEND was only ever set, not tested, so it was pointless.

There's no point only defining DCC_SSL when HAVE_SSL is defined: we can't
re-use that flag bit anyway, so might as well just define it always.

Also fixes a "flags && DCC_WAIT" that should have been "flags & DCC_WAIT".
This has no practical effect though I believe, since as far as I can tell
DCC_WAIT would always be set at that point anyway.
2015-10-03 22:10:15 +10:00
Kevin Easton 857a5fa524 Fix /KB so that it kicks-then-bans as documented
This also fixes a few others - eg /KBI now kicks-then-bans, and
/BKI bans-then-kicks (previously these were the wrong way around).

Reported by profiler.
2015-09-20 21:54:54 +10:00
Kevin Easton e0bdc609c1 Fix type mismatches and remove unused variables in nap plugin
Should just fix compiler warnings.
2015-09-10 17:00:09 +10:00
Kevin Easton 6d6717e56e Fix type mismatch errors in fserv module
No functional change, this just fixes some compiler warnings.
2015-09-10 16:31:34 +10:00
Kevin Easton 723cb5be9b Remove some set-but-not-used variables in the cavlink module
Cleans up some compiler warnings.
2015-09-10 14:57:00 +10:00
Kevin Easton c99345f1ce Fix char / unsigned char mismatch in blowfish module
Cleans up a compile warning, no functional change.
2015-09-09 23:14:01 +10:00
Kevin Easton e54106de83 Add missing Changelog entry for commit [b944573]. 2015-09-09 13:02:33 +10:00
Kevin Easton aea7050efe Don't create a double stack frame when calling aliases
The old code created a new stack frame in parse_line_alias_special(), then
another one in parse_line().  This prevented $functioncall() from working,
and made the output of CALL look odd.

|Rain| mentioned this years ago in starman.irc.
2015-09-08 23:35:06 +10:00
Kevin Easton 642ab8829d Fix up some type mismatch errors in the arcfour module 2015-09-07 17:12:04 +10:00
Kevin Easton 8cc9684c76 Ensure close_server() clears the who/ison/userhost queues for the right server
close_server() should call clear_server_queues() on the server that's being
closed, not from_server.  This also lets us remove a few other calls to
clear_server_queues() that are right next to calls to close_server().
2015-09-07 16:34:41 +10:00
Kevin Easton 35b1a65f03 Remove obsolete AIM plugin
The servers for the TOC protocol used by this plugin were decomissioned
by AOL in 2012, so it can't be used any longer.
2015-09-06 23:33:36 +10:00
Kevin Easton 9606ab312f Remove now-unused stripansi() function. 2015-09-06 22:54:12 +10:00
Kevin Easton 2520bd32f6 Separate parsing of channel WALLs into a function and clean it up
Channel WALL notices now have to match "[%Wall%/%] *", and have to be for
a channel that the client is actually on.  Otherwise, they just appear as
ordinary NOTICEs.
2015-09-06 22:47:20 +10:00
Kevin Easton d62914af15 Optimise add_last_type() and change it to accept const char * pointers
The optimisation reduces the number of malloc_strcpy() calls, from 50 to 5
for most last types.
2015-09-03 01:04:12 +10:00
Kevin Easton c881dd7a9a Change 'from' and 'format' arguments of logmsg() to const char *
This allows callers to pass const char * pointers to them.
2015-09-02 23:39:53 +10:00
Kevin Easton d1816fdc8b Don't mangle ANSI sequences in NOTICEs.
We pass through ANSI just fine in PRIVMSGs, so we might as well treat
NOTICEs the same way too.  The old code wasn't just stripping them out,
either - it was turning them into printable garbage.
2015-09-01 23:04:01 +10:00
Kevin Easton 75bd647d15 Switch stripansi() to stripansicodes() in the CTCP reply parser.
stripansi() actually just munged control-characters, so it just turned ANSI
codes into visible junk.

stripansicodes() instead leaves control characters alone but removes complete
ANSI sequences from the string.  I'm not sure if even that is necessary,
really - after all, we always allowed ^B, ^C etc style formatting in CTCP
replies.
2015-08-30 22:03:38 +10:00
Kevin Easton 498631e74a Introduce get_kick_reason() and switch all kick commands to use it
get_reason() is then used only for the implementation of get_kick_reason()
and for the $getreason() scripting function.  Add current nick as an
explicit argument for get_reason(), which pushes all use of from_server
out of the ransom reason functions.

Also switch a few instances of send_to_server() to my_send_to_server() where
the current server has been returned by prepare_command().
2015-06-28 00:35:50 +10:00
Kevin Easton ff251080da Add get_kill_reason() that uses BitchX.kill, and convert all /KILL users to it
Previously only send_kill() used BitchX.kill - the other KILL commands (eg.
/WHOKILL) were using the random kick reasons.  Standardise them all on
BitchX.kill, and add this file to the source so it can be installed along
with the other random reason files.
2015-06-27 23:18:38 +10:00
Kevin Easton 27e32a0319 Cleanup and simplify get_reason() and related functions
Rename randreason() to fread_random() to better reflect its function,
and change it to a one-pass algorithm.  Have it write into a caller-provided
buffer instead of a static buffer.  Fixes a file leak when an empty
file is given to this function.

Change freadln() so that it never returns an empty line - it only returns
0 at end-of-file now.  This simplifies its callers.

Factor out some common code from the several get_reason()-type functions,
which greatly simplifies them.
2015-06-27 00:38:40 +10:00
Kevin Easton 5f4429bf7b Removed unused variable from output_reject_ctcp()
Also remove unnecessary tests for stuff and stuff->user - these are always
non-null when the callback is called.
2015-06-25 11:45:09 +10:00
Kevin Easton ee0cd23ae5 Rearrange code in bankick() to silence a compiler warning
Re-checking the command name to see if it's a timed ban means that the
compiler can't see that it's the same check.

This also makes sure you can't specify a negative timeout.
2015-06-24 23:38:28 +10:00
Kevin Easton 28bd7a66b6 Remove useless check for !nick from userhostbase callbacks
The userhostbase callback is always called with non-null nick.  Checking for
this is just noise which also sometimes results in odd compiler warnings.
2015-06-24 23:20:53 +10:00
Kevin Easton 05cf540a99 Fix use of uninitialised variable and hostmask matching logic in userhost_unban()
Initialise ip_str so that it isn't used uninitialised.

Don't strip server flags from user@ portion of the hostmask, so that it will
not miss matching bans.

Switch ip_str from alloca() to malloc_sprintf() / new_free() - there's no
particular need for alloca() here.
2015-06-23 15:53:30 +10:00
Kevin Easton 3618f842aa Changelog update for unsigned char / char fixes 2015-06-23 15:50:29 +10:00
Kevin Easton 90f85dec0c Clean up unsigned char / char mismatches in screen.c
Also remove a couple of unused variables in prepare_display()
and create_additional_screen().
2015-06-21 22:50:44 +10:00
Kevin Easton 91d6169cb7 Fix unsigned char / char mismatches in a few remaining places in functions.c
Also slightly clean up function_stripansi(), removing a redundant mask.
2015-06-21 18:01:11 +10:00
Kevin Easton 69bbcfd83d Convert stripansi() from unsigned char to char
This silences a few compiler warnings.

This also cleans the function up by removing some always-true checks.
I'm not convinced that this function makes a whole lot of sense, though.
Will look into it further...
2015-06-21 00:18:03 +10:00
Kevin Easton b0f0124779 Don't compile convert_output_format2() in non-GUI builds
This function is only used by the GUI menu code, so we don't need to
build it for normal builds.

Also clean up some unsigned char / char mismatches that the compiler warned
about.
2015-06-20 23:42:04 +10:00
Kevin Easton 64860729b3 Convert read_netfinger() to use char instead of unsigned char 2015-06-20 23:18:13 +10:00
Kevin Easton 716a8ec33a Change ar_* resolver functions from char to unsigned char where appropriate
This gets rid of all the unsigned char / char mismatch warnings in these
functions.
2015-06-20 22:36:05 +10:00
Kevin Easton cce8b30079 Switch write_sockets() and read_sockets() from unsigned char * to char * 2015-06-20 08:43:00 +10:00
Kevin Easton 8649c17912 Change edit_char() from unsigned char to char
This squashes a few more warnings.
2015-06-20 00:03:15 +10:00
Kevin Easton 53f7c374cf Convert strip_ansi() from unsigned char to char
This required a few careful changes to ensure that the result does the same
thing.

Also included a few little cleanups in this function.
2015-06-19 23:12:10 +10:00
Kevin Easton 1b1734d7e1 Fix bxconfigure crash on terminals wider than 200 columns.
A few places created strings based on the terminal width, using fixed-sized
buffers and without checking for overflowing them.  Fix those, and also
replace all other sprintf() calls with snprintf().

Reported by cpet.
2015-06-19 20:42:44 +10:00
Kevin Easton d0b0a95330 Convert skip_ctl_c_seq() and its callers (except strip_ansi()) from unsigned char to char
This should make no functional difference, and cuts out a large number of
unsigned char * / char * mismatch warnings.
2015-06-17 22:50:49 +10:00
Kevin Easton 563493dd6a Add COLOR_CHAR and BELL_CHAR defines to replace open-coded values 2015-06-16 19:06:30 +10:00
Kevin Easton aa3dc1939d Remove obsolete Chatnet 310 numeric support (WANT_CHATNET)
Chatnet doesn't use the odd 310 numeric support anymore, it now uses 310 for
the same WHOIS_HELPFUL as Dalnet.  They apparently use a pretty bog-standard
Unreal ircd now.
2015-06-16 13:23:36 +10:00
Kevin Easton 6077322ef8 Check for socket errors when connection is terminated by server
This means that when a connection fails or is closed due to a socket
error, the error is properly bubbled back up to the user.
2015-06-13 23:29:00 +10:00
Kevin Easton bc94fbe64a Remove a strange old piece of code apparently for detecting a server gone to lunch
This code appears to be some kind of backstop so that the client will notice
a server connection that's died because of a network interruption.  Checking
errno that was last set christ-knows-where is not the right way to do this,
though.

The normal write to the server for the lag check should eventually see the
host/net unreachable error if this happens.
2015-06-13 22:35:03 +10:00
Kevin Easton b0951d44dd Simplify and make static reconnect_server() function 2015-06-13 22:30:44 +10:00
Kevin Easton 1883e2c0c3 Minor fix to /STACK to make it match /SET behaviour
Previously /STACK would not accept just the initial part of a /SET name
even if it wasn't ambiguous.  Now it uses the same matching behaviour
as /SET.

This also removes an unused variable in do_stack_set().
2015-06-12 16:57:19 +10:00
Kevin Easton 6ba8dc7426 Remove vestigal NOTIFY_BITCHX_COM defines 2015-06-12 16:15:32 +10:00
Kevin Easton 6dbc712046 Rework and improve the scheduling of the server lag check
Previously the server lag check was run by update_clock() if the number of
seconds since client startup was a multiple of 20 (unless it had already been
done this second).  This meant that if update_clock() was not being called
frequently (eg. if your IRC connection was very quiet), it might go a long
time between lag checks.

This commit adds a /set LAG_CHECK_INTERVAL (defaulting to 30).  For each
server, a lag check ping is scheduled for every LAG_CHECK_INTERVAL seconds
after the connection is finalised/registered.  Setting this value to 0
disables the lag check pings entirely.

The old code set the lag to 'unknown' immediately after sending out a ping,
which meant that it was quite unpredictable how long the lag value would
stay around for.  The new code only sets this once the current lag value
has become stale (ie. a ping reply is overdue based on the current lag
value).  If your lag is staying the same or reducing, you shouldn't see
the [Lag ??] at all.
2015-06-12 15:54:43 +10:00
Kevin Easton 7eae2aba86 Change arguments of my_strnstr() from const unsigned char * to const char *
This kills warnings in both ircaux.c and input.c.
2015-06-07 00:30:05 +10:00
Kevin Easton c0c7cdbdcc Rework the calculation of the select timeout in io() to be based on absolute wake time
An absolute wake time is now calculated and updated by set_server_bits(),
TimerTimeout() and tclTimerTimeout().  This is then used to calculate the actual
select() timeout, instead of having those functions calculate a relative timeout
value themselves.  This significantly simplifies those functions, since the
underlying values tend to be recorded as absolute times.

It also allows us to disentangle tclTimeTimeout from TimerTimeout(), and move the
responsibility for calculating the QUEUE_SENDS wake time from TimerTimeout() to
set_server_bits() where it belongs.

The QUEUE_SENDS and CONNECT_DELAY wake up times will also now be correctly
calculated, based on the last sent time and connect time respectively.
2015-06-07 00:03:09 +10:00
Kevin Easton 6f0f9dd8a8 Add missing Changelog entry for commit [8cdc62a] 2015-06-03 23:34:18 +10:00
Kevin Easton 8cdc62ae0d Wire up /SET DOUBLE_STATUS_LINES so it actually does something
The DOUBLE_STATUS_LINES /SET has existed for a long while, but setting it has
never actually had an effect.  This change causes it to affect the
/window double setting of new windows: 0 means new windows are created without
double status lines, 1 means only the first window is created with double
status lines and subsequent windows aren't (this is the default) and 2 means
that all windows are created with double status lines.

Note that setting this variable in your .ircrc can't actually affect the first
window, because that's created before the .ircrc is loaded.  The compiled-in
default value (DEFAULT_DOUBLE_STATUS_LINES in config.h) is the only thing that
can affect the first window.

Reported by presi.
2015-06-03 23:16:57 +10:00
Kevin Easton ec842a808f Update COMPILE-PROBLEMS
Remove reference to crashes with clang under FreeBSD, advised by cpet.

Add name of libncurses-devel package for Cygwin.
2015-06-03 22:43:00 +10:00
Kevin Easton 454deb943a Bring the BitchX(1) man page a little more up-to-date
Some changes from cpet to replace references to bitchx.com with bitchx.org.

Also a few minor formatting fixes and changes to the contributors.
2015-06-03 22:38:02 +10:00
Kevin Easton 5d46e9a768 Add OpenBSD to list of known-working OSes
Patch from cpet, who confirmed a BitchX port has existed in OpenBSD since 1999.
2015-06-03 22:15:56 +10:00
Kevin Easton b14d0ddcb9 Add timer_cmp() utility function to compare two timevals.
This is preferable to using time_diff() to compare two timevals, because
time_diff() gives its result as a 'double' which only has 53 bits of
precision.

Also switch a couple of places from using time_diff() to using
this function.
2015-05-21 01:21:02 +10:00
Kevin Easton b944573a5e Minor fixes to enable compiling against TCL8.5
Define USE_NON_CONST so that the newer TCL headers define functions in the
same way as pre-8.4 TCL headers.  It will be a good idea to change to
USE_COMPAT_CONST instead at some point.

Also use ckfree() instead of free() to free an allocation returned by TCL.
2015-05-16 22:20:25 +10:00
Kevin Easton e33393ab86 Remove 100ms fudge factor on timer expiry.
If we immediately handle timers that have already expired, there doesn't
seem to be a compelling reason to add 100ms to the expiry of unexpired timers.
2015-05-16 14:13:11 +10:00
Kevin Easton af017816e2 Use time_since() and time_until() instead of open-coded variants
Use these helpers in the places where we're calling get_time() and
comparing it against a single struct timeval.
2015-05-14 00:02:51 +10:00
Kevin Easton f1c27a4f64 Switch server->connect_time from time_t to struct timeval
This means that settings like CONNECT_DELAY and CONNECT_TIMEOUT are compared
against the current time with sub-second resolution.  With the old way, the
delays could be up to a second longer than asked for, which had the effect of
almost doubling the default CONNECT_DELAY value of 1.
2015-05-13 23:17:18 +10:00
Kevin Easton 4ee6c6295b Add time_until() and time_since() utility functions
Adding these in preparation for converting server->connect_time from time_t
to struct timeval.  Also converts three existing open-coded versions over to
the new functions.
2015-05-13 21:50:30 +10:00
Kevin Easton 0f8280ed51 Prevent indefinite wait if CONNECT_DELAY is set to zero
set_server_bits() now returns -1 for "no timeout", so 0 is a legitimate
return value.

io() should only update real_timeout from server_timeout if server_timeout
is not -1 (real_timeout == -1 ends up meaning "wait indefinitely").

Note that if you set CONNECT_DELAY to zero you get a lag check ping sent off
first thing in the server connection, this should be fixed.
2015-05-12 22:39:30 +10:00
Kevin Easton 72f5536121 Fix bug that prevents ignoring of NICK messages.
check_ignore() returns IGNORED for that case, not zero.
2015-05-10 14:22:12 +10:00
Kevin Easton dea26d0c1c Remove unused variables in check_bitch_mode() and parse_server() 2015-05-09 00:01:07 +10:00
Kevin Easton 32659b9998 Simplify LAMEIDENT code and remove unused variable.
Replace open-coded loop with strpbrk(), make the constant lame_chars string
static const and remove the unused variable 'user'.

I think LAMEIDENT might be obsolete now anyway - I can't find a server that
allows control chars in usernames these days.
2015-05-08 23:25:41 +10:00
Kevin Easton a497d3ab09 Remove unused variables in whoreply() and add_user_who()
The result of add_to_channel() isn't used in these functions, so we don't
need to store it.
2015-05-08 22:24:36 +10:00
Kevin Easton 941a3c6c63 Removed unused variables in p_privmsg()
com_do_log and com_lines are static variables that are set, but never
checked by any code.
2015-05-08 21:50:14 +10:00
Kevin Easton 5e9263f325 Simplify and improve ANNOY_KICK checks.
The annoy kick code looks for messages that are longer than 12 characters
and more than 75% of them are highlighted (eg. bold).  The old code counted
the whoel message length, so it could be fooled by padding the message with
lots of nonprinting control characters.  This change makes it count only
displaying characters.

Also fix the check for beep (it's a single character, not a highlighting
toggle, so we just check for one of them), and add a check for the blinking
highlight.
2015-05-07 22:30:59 +10:00
Kevin Easton e646ab42d2 Move char_fucknut() and caps_fucknut() from misc.c to parse.c.
These functions are only used by parse.c:annoy_kicks(), so move them next
to that function and make them static.

This also changes their arguments from unsigned char * to char *, getting rid
of some signed/unsigned mismatch warnings.
2015-05-05 20:30:07 +10:00
Kevin Easton 9f7cf6b6c2 Alter the way PINGs for /sping and lag check are used.
We now send PING <server> :<server> for /spings, and
PING LAG!<cookie>.<tv_sec>.<tv_usec> :<server> for lag checks.  The cookie is
set randomly at server connect time, and means that clients connected to the
same bouncer shouldn't act on each other's lag checks.

We can now remove in_sping entirely - previously it would get out of synch if
you disconnected with a sping in progress.
2015-05-04 00:13:08 +10:00
Kevin Easton 443b87a8aa Remove alternate /sping implementation for systems without gettimeofday()
This changes the code to use struct timeval and get_time() on all systems,
which simplifies the code by removing most of the checks for HAVE_GETTIMEOFDAY.

The only user-visible change is that ancient systems without gettimeofday()
will see message like "Server pong from irc.choopa.net 1.0000 seconds" instead
of "Server pong from irc.choopa.net 1.x seconds".  And really, I seriously
doubt that there's any systems like that left out there anyway.
2015-03-29 20:35:57 +11:00
Kevin Easton 1c6ff3088a Fix compilation problems in 'amp' plugin.
Four instances where 'default:' is at the end of a block replaced with
'default: break;' (reported by mscherer).

One typo where [j] should have been [1] (array out of bounds error).

Missing <unistd.h> includes for _exit(), and <string.h> for memcpy().
2015-03-17 00:06:34 +11:00
Kevin Easton 6898260809 Add configure.lineno to files removed by distclean target. 2015-03-16 23:45:49 +11:00
Kevin Easton 5b89193679 Remove doc/Makefile (template for dummy toplevel Makefile). 2015-03-16 23:23:14 +11:00
Kevin Easton ca093feaf9 Remove top-level dummy Makefile.
There's no need for a top-level dummy Makefile - the real Makefile is generated
by configure, and the dummy file only worked on systems that had bash installed
into /usr/local/bin anwyay.
2015-03-16 23:18:00 +11:00
Kevin Easton 3b80790a31 Define VERSION in configure, and add git describe output if available.
The client release version is now defined in configure.in rather than
source/irc.c.  The gitversion.sh script is used to automatically add a
suffix to the version number for versions of the client built from git.

Also removed AC_REVISION() from configure.in, because $Revision$ doesn't
make sense with git.
2015-03-16 23:04:43 +11:00
Kevin Easton aab85f807a Update version number to 1.2.1 in preparation for release.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@537 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-14 10:42:09 +00:00
Kevin Easton a06fe2a883 Revert back to using floating point for stats calculations, but correctly rounded.
Integer division has potential edge-case overflow problems that are best avoided.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@536 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-14 10:34:50 +00:00
Kevin Easton 62b483f811 Rename README-1.2 to README.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@535 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-13 12:25:24 +00:00
Kevin Easton 77d5c9e0aa Remove old 1.1-final README, to be replaced with 1.2 README.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@534 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-13 12:24:57 +00:00
Kevin Easton 42c366ab20 Add an introduction to the release notes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@533 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-13 12:22:35 +00:00
Kevin Easton 85ec7d8859 Reword warning about FreeBSD / clang compile issue.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@532 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-13 10:12:24 +00:00
Kevin Easton 137fbd9b85 Prefer <fcntl.h> over <sys/fcntl.h>.
<fcntl.h> is the name used by POSIX, so we prefer this and only fall back to
<sys/fcntl.h> on non-POSIX systems.  Fixes warnings compiling against musl
libc.

Reported by ncopa.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@531 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-06 10:44:07 +00:00
Kevin Easton bb5e9920d2 Squash a warning when compiling with a some curses library configurations.
ncurses can optionally declare tigetstr(), tigetnum() and tigetflags() with a
const char * argument, indicated by the NCURSES_CONST macro.  So we use this 
macro, if available, to optionally declare cap2str.iname as const char *.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@530 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-06 10:25:37 +00:00
Kevin Easton 835453ae40 Bump up defaults for FLOOD_AFTER, SCROLLBACK_LINES and LASTLOG.
Bandwidth and memory have both increased a lot since these values were last looked at.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@529 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-05 11:01:40 +00:00
Kevin Easton 93d06b03c9 Fix overflow in say() when handling a client message over the maximum.
This was noticed when /channel on a very large channel segfaulted.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@528 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-05 09:32:46 +00:00
Kevin Easton ca55063443 Apply patch from cpet mentioning problems with FreeBSD/clang.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@527 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-04 12:59:35 +00:00
Kevin Easton 07c2291966 Add SERVERREQ flag to all send_2comm commands.
send_2comm() always sends the command on to the server, so it always requires a server connection.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@526 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-04 10:54:23 +00:00
Kevin Easton 867f7f8327 Add SERVERREQ flag to all send_comm commands which were missing it.
send_comm() just passes the command directly to the connected server, so it obviously
requires a server connection.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@525 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-04 10:36:54 +00:00
Kevin Easton 0b6725dbe2 Remove WANT_CHAN_NICK_SERV define and include services commands by default.
They're pretty widely used these days, and the cost is trivial.  And quite frankly,
the less #ifdefs I have to see, the better.

This covers /NICKSERV, /CHANSERV, /OPERSERV and /MEMOSERV.  It also brings 
in the bahamut / unreal /SILENCE server-side-ignore command, and unreal's /HELPOP.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@524 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-04 10:27:19 +00:00
Kevin Easton 78aeaeb1cb Cleanups around WANT_CHAN_NICK.
Remove unused function declaration, add SERVERREQ flag to CHANSERV command and remove IRCIIHELP
command that no server has provided in a long time, as far as I can tell.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@523 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-04 10:05:58 +00:00
Kevin Easton eb5f767d53 Update default /FSET LINKS so it shows more than the first word of the server description.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@522 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-03 10:32:21 +00:00
Kevin Easton f6d42f35d4 Fix spelling mistake in client message.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@521 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-03 10:26:13 +00:00
Kevin Easton 685fc8b25a bxconf has its own set of required libraries, different to the client itself.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@520 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-01 14:52:43 +00:00
Kevin Easton a05b1160c3 Change build to pass through CPPFLAGS if provided, and to use the DEFS value set by configure.
The DEFS Makefile variable has been renamed to CPPFLAGS, and is now set based on the CPPFLAGS,
INCLUDES and DEFS values provided by configure.

Reported by cpet, this allows the FreeBSD port to drop a patch.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@519 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-01 14:37:41 +00:00
Kevin Easton 4ce8dc88de Update default server list.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@518 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-01 11:13:47 +00:00
Kevin Easton 4f181b5977 Cleanup and update some ancilliary infomation files.
Bump copyright date, add TCL information to README-1.2, replace old COMPILE-PROBLEMS with more relevant
information and remove old 'bugs' file.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@517 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-01 03:40:30 +00:00
Kevin Easton f84d9c0b42 Add some more user-visible changes to the 1.2 README file.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@516 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-30 12:28:28 +00:00
Kevin Easton db3fabfc3e Delay setting the /cset CHANMODE mode on new channels until the channel is synched.
Instead of setting the mode at NAMES time (when we know that the channel is new),
remember this for later by setting the GOTNEW flag in the joinlist entry.  Then
check this flag when the channel is synched.

Setting the channel mode takes us out of server "grace mode", which slows down the 
processing of subsequent commands and drastically reduces the number of commands we
can have outstanding before we get kicked off for flooding.  This change allows us
to stay in grace mode while we're synching every channel that we joined at connect.

In turn, this makes joining lots of channels on connect faster, and much less likely
to cause us to be booted with "Excess Flood".


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@515 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-29 14:07:05 +00:00
Kevin Easton 8054c3e4ab Rename show_channel_sync() to channel_sync(), and don't use prepare_command() before it.
prepare_command() does nothing useful here, and it sets the current server to an incorrect value
if the channel sync happens while the current window is set to a window from a different server.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@514 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-29 12:51:40 +00:00
Kevin Easton 3816ea7494 Don't execute an empty command for an empty branch in an /IF.
Old behaviour was that /if (0) { echo y } would execute an empty command for the missing else
case, which winds up doing send_text("").


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@513 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-27 12:05:16 +00:00
Kevin Easton 7563f1d401 Cache the bitmask of the channel log level in the cset structure instead of the channel structure.
This fixes a bug where the cached channel log level bitmask was not correctly set unless you did a 
/cset CHANNEL_LOG_LEVEL after the channel had been joined, which resulted in most things not being
logged.

It makes most sense to cache the bitmask within the cset structure, and there was even an (ununsed)
field already there for it.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@512 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-26 13:08:43 +00:00
Kevin Easton 34c34b9a43 Add ccTLDs for .cw (Curacao) and .sx (Sint Maarten).
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@511 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-21 12:21:24 +00:00
Kevin Easton 3f3bdf5387 Display user and channel mode changes at level MODEUSER and MODECHAN instead of CRAP.
These were already being logged at the correct level, this just fixes the
interaction with window level and window notify_level.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@510 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-18 13:18:13 +00:00
Kevin Easton de1145ffc9 Refine illegal message source characters: * is in, - is out.
IRCNet uses message sources like *.se (ie masked server names) after a
netsplit.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@509 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-14 13:44:45 +00:00
Kevin Easton c41048b896 Increase size of buffer to handle maximum-length topics in status_topic().
This affects the maximum length of the topic that can be displayed by the %-
status format.  No topic can be longer than IRCD_BUFFER_SIZE, so use that.

Reported by oxy.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@508 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-14 12:57:01 +00:00
Kevin Easton 8fde6f8248 Don't allow message source name to include ','.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@507 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-14 12:37:56 +00:00
Kevin Easton 5126d21126 Add /FSET WHOIS_LOGGEDIN to format RPL_WHOISLOGGEDIN, used by hybrid, ratbox, ircu and derivatives.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@506 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-10 12:56:09 +00:00
Kevin Easton 4d14d35d1a Allow nicknames to start with ~, apparently allowed by IRCnet.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@505 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-05 22:19:39 +00:00
Kevin Easton 5e55fc5dee Cleanup send_whom(), and fix bug where get_socketinfo() was used instead of get_socket().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@504 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-24 14:28:19 +00:00
Kevin Easton 337c3128d1 Fix faulty boolean logic in .echo xlink command.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@503 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-24 14:14:59 +00:00
Kevin Easton 6d2675e312 Slight cleanup to some xlink code.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@502 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-24 13:35:13 +00:00
Kevin Easton b99118c030 Add sanity checking of incoming nicknames.
Check that at least the first character of an incoming nickname is valid (we
actually go a bit beyond the RFC by also allowing any char with bit 8 set - at
least Russian servers use nicknames like this).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@501 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-24 06:54:00 +00:00
Kevin Easton 6dc2335df9 The /mv command shouldn't send +v for already-voiced users.
The logic in the massop function to exclude already-voiced users from
massvoice was faulty - it was equivalent to just !nick_isop().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@500 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-23 13:59:03 +00:00
Kevin Easton a3170cf578 Fix regression introduced in r480, where /BKI on non-joined clients no longer ignored.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@499 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-23 13:46:47 +00:00
Kevin Easton e808dbe94b Change the lag check so that it does not try to format a time_t using %lu.
Recent OpenBSD and NetBSD have changed time_t to be a 64 bit type on all
platforms.  This means that on 32 bit systems, time_t is now longer than
long, and %lu can't be used to format it.

The lag check doesn't actually care what is in the first field of the PING
command, so change it to be our nick (which is arguably what it should be).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@498 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-21 14:54:12 +00:00
Tim Cava 72a20a8b82 Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@497 13b04d17-f746-0410-82c6-800466cd88b0
2014-03-02 21:25:49 +00:00
Tim Cava b3cd3509d0 Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@496 13b04d17-f746-0410-82c6-800466cd88b0
2014-03-02 21:21:40 +00:00
Tim Cava a266f0bad3 Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@495 13b04d17-f746-0410-82c6-800466cd88b0
2014-03-02 21:20:33 +00:00
Tim Cava dd030f6e67 Make function_channelnicks() use the sort_type optionally passed in.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@494 13b04d17-f746-0410-82c6-800466cd88b0
2014-03-02 21:15:36 +00:00
Tim Cava deb1c71b8c Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@493 13b04d17-f746-0410-82c6-800466cd88b0
2014-03-02 21:09:37 +00:00
Tim Cava 8d5882a9ef Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@492 13b04d17-f746-0410-82c6-800466cd88b0
2014-03-02 19:59:13 +00:00
Tim Cava e7da953fc1 Don't check if the address of an array is NULL.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@491 13b04d17-f746-0410-82c6-800466cd88b0
2014-03-02 19:40:31 +00:00
Tim Cava 04e898bb57 Cleanup quotecmd() a little bit. Remove a set but unused variable.
Kill commented out code that normally prevents some commands from
being quoted.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@490 13b04d17-f746-0410-82c6-800466cd88b0
2014-03-01 20:02:16 +00:00
Tim Cava 3138017406 Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@489 13b04d17-f746-0410-82c6-800466cd88b0
2014-03-01 19:45:47 +00:00
Tim Cava 101204b0b9 Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@488 13b04d17-f746-0410-82c6-800466cd88b0
2014-03-01 19:44:55 +00:00
Tim Cava ae4014808f Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@487 13b04d17-f746-0410-82c6-800466cd88b0
2014-02-28 23:52:33 +00:00
Tim Cava 7791aec8d6 Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@486 13b04d17-f746-0410-82c6-800466cd88b0
2014-02-28 23:47:14 +00:00
Tim Cava c45a43c8e2 Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@485 13b04d17-f746-0410-82c6-800466cd88b0
2014-02-28 23:41:57 +00:00
Tim Cava a9cc4ec891 Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@484 13b04d17-f746-0410-82c6-800466cd88b0
2014-02-28 23:39:57 +00:00
Tim Cava ebc3ff9b2b Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@483 13b04d17-f746-0410-82c6-800466cd88b0
2014-02-28 23:31:58 +00:00
Tim Cava 3fe6a86f64 Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@482 13b04d17-f746-0410-82c6-800466cd88b0
2014-02-28 23:29:22 +00:00
Tim Cava d8b8c169ab Remove a variable that is set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@481 13b04d17-f746-0410-82c6-800466cd88b0
2014-02-28 22:22:33 +00:00
Tim Cava 3494a55541 Remove variables that are set but unused.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@480 13b04d17-f746-0410-82c6-800466cd88b0
2014-02-28 22:13:49 +00:00
Kevin Easton f13de53ad4 Fix bug introduced in r243 where /LASTLOG without -FILE no longer worked.
Reported by jeezy.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@479 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-24 13:15:22 +00:00
Kevin Easton b300961524 alias.c: Remove unused variables in pmatch_cmd_alias(), pmatch_assign_alias() and do_stack_alias().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@478 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-18 13:13:26 +00:00
Kevin Easton f22dc54b13 Change BX_add_to_screen() and BX_skip_incoming_mirc() to use char * rather than unsigned char * arguments.
This clears up a few pointer type mismatch warnings.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@477 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-18 12:38:07 +00:00
Kevin Easton ced7f9bcc9 keys.c: Convert most uses of unsigned char to char, clearing up warnings.
This also fixes the ability to bind to key sequences ending in ^.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@476 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-17 21:37:32 +00:00
Kevin Easton de3d310678 Change RETURN_STR() macro to silence 'always evaluates to true' warnings.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@475 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 11:35:41 +00:00
Kevin Easton 324cdd4c85 Update plugins to cast time_t to long when formatting with %ld.
Fixes platforms where time_t and long are different sizes.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@474 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 10:59:34 +00:00
Kevin Easton 87de292f53 cdcc.c: Cast time_t to long before formatting with %ld.
Fixes platforms where time_t and long are not the same size, like netbsd i386.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@473 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 03:18:39 +00:00
Kevin Easton d03781f45b Fix the $timer() scripting function.
This function never worked - function_timer() was creating a string but then
never throwing it away and returning a part of the argument instead, which
then caused a crash because it couldn't be freed later in the expression
parsing.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@472 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 03:17:13 +00:00
Kevin Easton ffea653764 Fix the /TKB (timed kickban) command.
An incorrect pointer was being passed to malloc_sprintf(), causing a
crash.  Use m_sprintf() instead.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@471 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 03:13:26 +00:00
Kevin Easton 5a3a74d38a functions.c: Fix mismatched format strings in several aliases and functions.
Affected functions are alias_idle(), alias_serverlag(), alias_awaytime(),
function_serverpass(), function_checkuser() and function_isuser().

This fixes $serverpass(), which seems to have never worked right.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@470 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 01:33:53 +00:00
Kevin Easton 55d3b28060 dcc.c: Fix mismatching format strings in get_dcc_info() and dcc_ftpcommand().
Cast time_t value to long and use %ld to print.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@469 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 00:18:39 +00:00
Kevin Easton 021812f6ae Respin configure and defs.h.in for configure.in r467.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@468 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 00:09:33 +00:00
Kevin Easton f178d6e024 Fix int/long typo.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@467 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 00:08:31 +00:00
Kevin Easton e7c8240622 Use long instead of time_t in send_kline(), and cast time_t values to long in sping() when using %ld format.
This fixes bugs on netbsd i386, where time_t is longer than long.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@466 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-15 13:57:46 +00:00
Kevin Easton 77ee55f33f Simplify function_uptime() and change it to use long instead of time_t.
This fixes a series of compiler warnings on netbsd i386.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@465 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-15 12:55:44 +00:00
Kevin Easton 70b1c060f3 Change function_tdiff2() to use long instead of time_t, which fixes warnings on netbsd i386.
Also rework function to use snprintf() instead of sprintf().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@464 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-15 12:11:19 +00:00
Kevin Easton b2ae3c888f Cleanup get_term_capability(), silences some warnings.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@463 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-13 13:35:10 +00:00
Kevin Easton 58b5d39fea Remove unnecessary variable proctitlestr.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@462 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-13 11:43:57 +00:00
Kevin Easton 3b99834e00 Partially revert r456.
An snprintf() call that creates IRC protocol messages must use 
(MAX_PROTOCOL_SIZE + 1) as 'n' rather than the buffer size.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@461 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-13 09:57:15 +00:00
Tim Cava 582d720ea4 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@460 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:29:21 +00:00
Tim Cava 496d3dc8ff Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@459 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:29:16 +00:00
Tim Cava f69404b0f9 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@458 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:29:11 +00:00
Tim Cava 4f5aab355b Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@457 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:29:05 +00:00
Tim Cava 317b84ee9d Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@456 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:29:00 +00:00
Tim Cava c9d059cee6 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@455 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:28:55 +00:00
Tim Cava 1bafc85e23 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@454 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:28:48 +00:00
Tim Cava dd88392b15 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@453 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:28:38 +00:00
Tim Cava 3287f7775b Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@452 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:28:31 +00:00
Tim Cava 2677dc4c60 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@451 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:28:26 +00:00
Tim Cava bfc147418a Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@450 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:28:19 +00:00
Tim Cava 9d7c4f93d0 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@449 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:28:10 +00:00
Tim Cava c7e6e5ea08 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@448 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:28:03 +00:00
Tim Cava c1530e9406 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@447 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:24:14 +00:00
Tim Cava 78265498b1 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@446 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:23:51 +00:00
Tim Cava 224143f653 Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@445 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:23:25 +00:00
Tim Cava db8c5cdc4f Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@444 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:22:00 +00:00
Tim Cava 6fed90327c Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@443 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:20:39 +00:00
Kevin Easton d9a81a2841 who.c: Apply patch from tau replacing sprintf() with snprintf().
Also some minor associated cleanups from me.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@442 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 13:48:32 +00:00
Kevin Easton 220225f4ff whowas.c: Apply patch from tau replacing sprintf() with snprintf().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@441 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 13:37:14 +00:00
Kevin Easton f222b94d13 window.c: Apply patch from tau replacing sprintf() with snprintf().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@440 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 13:24:38 +00:00
Kevin Easton f086f264bb wserv.c: Apply patch from tau converting sprintf() to snprintf().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@439 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 13:23:11 +00:00
Kevin Easton 03761ec715 Respin configure and defs.h.in for new configure.in, and update ircterm.h to match.
ircterm.h now includes ncurses/ncurses.h if present, which is necessary for Cygwin.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@438 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-10 12:00:08 +00:00
Kevin Easton f2aa46e252 Add check for ncurses/ncurses.h to configure. This is where Cygwin installs ncurses.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@437 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-10 11:57:45 +00:00
Kevin Easton ecabc12b3d Add helper macros to always call tparm() with 10 arguments.
This ensures portability to systems with a fixed-argument list declaration
of tparm(), like NetBSD curses.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@436 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-10 06:27:03 +00:00
Kevin Easton 0fe37326a3 Rebuild configure and defs.h.in from new configure.in, and update code to match.
This simplifies the inclusion logic in ircterm.h, and updates term.c to include
term.h if available.  This removes the declarations for setupterm(), tigetstr(),
tigetnum(), tigetflag(), tgetent(), tgetstr(), tgetnum() and tgetflag() from
term.c as those should be defined in term.h or termcap.h.

This should make the system declaration of tparm() available to term.c, which
will fix a crash on NetBSD x86-64 caused by the implicit declaration of tparm()
having a return type of 'int' while the real function has a return type of
'char *'.

We have to include term.h in term.c, not in ircterm.h because term.h defines
a large number of macros, at least two of which ('lines' and 'goto_window')
conflict with names in use in the rest of the codebase.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@435 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-10 05:38:06 +00:00
Kevin Easton 73c9947324 Rewrite the termcap/terminfo detection logic in configure.
The new logic is considerably shorter and simpler, and should mean that
terminfo is properly used in preference to termcap on NetBSD.  This also
allows us to include term.h in term.c, where the system definition of
tparm() lives on some systems (NetBSD is one such).

The new logic also means we link against libtinfo in preference to
libncurses, which should mean a little less memory used at runtime and a
fraction faster startup time.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@434 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-10 04:50:52 +00:00
Kevin Easton 96f1d64aa0 Change ircterm.h header include guard so that it doesn't clash with
the system term.h.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@433 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-09 11:04:30 +00:00
Tim Cava 112b38ac7a Revert the last commit. It accidentally had autogenerated files in it.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@432 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-07 03:00:24 +00:00
Tim Cava 276fd24258 Use snprintf rather than sprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@431 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-07 02:41:16 +00:00
Kevin Easton 590ae4c685 Further cleanups in dcc.c, removing unused variables and reworking dcc_exempt_save().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@430 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-06 10:35:16 +00:00
Kevin Easton 15894eb006 Some simplification / cleanup in dcc_glist().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@429 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-05 13:07:06 +00:00
Kevin Easton 456a0061f0 Fix output when client is built against termcap.
The pointer passed to tgetstr() must not be reset each time around the loop.
Also some other minor cleanups in term_init().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@428 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-01 13:06:02 +00:00
Tim Cava 8e8a4022f9 Cleanup check_serverlag(), with suggestions from caf.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@427 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-01 11:32:57 +00:00
Kevin Easton 25dcf0709b Don't crash if the user gives a bogus status format with too many elements.
Replace unused .format_var member of status_expandos list with .args. For
expandos which have a subformat, this stores how many arguments are passed to
sprintf() when the subformat is expanded in the callback function.  The
convert_sub_format() function then uses this to limit the number of %s
conversion specifiers it creates in the converted subformat.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@426 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-30 13:09:03 +00:00
Kevin Easton 02327eebae Fix STATUS_NOTIFY so that it appears in the right window.
The old code was reusing the 'window' variable, which means that it
could pick up the STATUS_NOTIFY format from the wrong window.  You
would only have noticed this if you have windows with different settings
for STATUS_NOTIFY.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@425 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-29 13:25:10 +00:00
Kevin Easton e9d180f526 Improve handling of padding in status formats.
Status formats support a %<PAD>c syntax for specifying padding.  This change
ensures that we only use padding consisting of the characters "0123456789.",
which ensures it won't confuse sprintf.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@424 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-29 13:14:19 +00:00
Kevin Easton e281537918 logfile should be initialised from LOGFILE_VAR if that is set.
We can also rearrange things to remove the need for the add_ext variable,
hopefully also making the logic a bit more clear.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@423 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-27 15:08:23 +00:00
Tim Cava 6094d62550 Cleanup window_help(). Use strlcat rather than strmcat.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@422 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 16:43:49 +00:00
Tim Cava 37f59831a2 Refactor window_log(). Use strlcat rather than strmcat. Rename a variable
and remove a buffer on the stack.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@421 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 15:30:09 +00:00
Tim Cava 9a5f10b8c5 Oops. nick must be initialized before old_uh, since it's passed to
fetch_userhost().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@420 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 15:16:36 +00:00
Tim Cava 0cf0cf1ec4 Cleanup userhostbase. Use strlcat rather than strmcat. Rename some variables.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@419 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 15:03:12 +00:00
Tim Cava 9d562a6225 Cleanup convert_flags() a little bit.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@418 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 13:12:08 +00:00
Tim Cava a0faae3e62 Cleanup convert_flags_to_str() a little bit. Use strlcat rather than strmcat.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@417 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 13:09:29 +00:00
Tim Cava 41dcaad142 Cleanup check_on_hook(). Use strlcat rather than strmcat. Don't
initialize variables unless necessary.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@416 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 02:54:04 +00:00
Tim Cava 1d1cd09ee3 Cleanup status_notify_windows() a little bit. Use strlcat rather than strmcat.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@415 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 02:43:57 +00:00
Tim Cava e9ef2d4e55 Use strlcat, rather than strmcat, in make_status(). Remove a block of unused
ifdefed out code.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@414 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 02:34:25 +00:00
Tim Cava fdb83238de Cleanup stat_convert_format() a little bit. Use strlcat rather than strmcat.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@413 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 02:28:13 +00:00
Tim Cava 26e070565e Use strlcat, rather than strmcat, in fix_status_buffer(). Remove unused
blocks of ifdeffed out code.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@412 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 02:20:19 +00:00
Tim Cava 95235006ab Cleanup convert_sub_format() a little bit. Use strlcat rather than strmcat.
Remove a variable that had no affect.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@411 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 02:12:42 +00:00
Tim Cava a3ab6659fc Refactor vsend_to_server() with help from caf.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@410 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 00:49:30 +00:00
Tim Cava eebdc6fb96 Cleanup set_operview_flags(). Rename old to old_flags to use the same
variable name across functions. Use strlcat rather than strmcat.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@409 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-23 17:51:09 +00:00
Tim Cava b978b76bb7 Cleanup s_watch().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@408 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-23 17:44:20 +00:00
Tim Cava 07cdd587b4 Cleanup ircop_flags_to_str. Make the bufsize IRCD_BUFFER_SIZE instead of
BIG_BUFFER_SIZE. Even with many flags enabled the output string shouldn't
be larger than 512 bytes. Use strlcat rather than strmcat.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@407 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-23 17:33:50 +00:00
Tim Cava 809dc2f727 Cleanup create_channel_list a little bit. Use strlcat rather than strmcat.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@406 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-23 15:49:02 +00:00
Tim Cava b12e865b9b Cleanup bits_to_lastlog_level a little bit. Use strlcat rather than strmcat.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@405 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-23 14:48:45 +00:00
Tim Cava 95a7534c8c Use strlcat, rather than strmcat, in BX_path_search.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@404 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-23 14:35:37 +00:00
Tim Cava 57020a48e7 Use strlcat, rather than strmcat, in get_userhost().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@403 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-20 18:40:18 +00:00
Tim Cava 22a4c1d9fb Use strlcat, rather than strmcat, in tab_completion().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@402 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-20 18:38:44 +00:00
Tim Cava bfb9dc3d54 Use strlcat, rather than strmcat, in the definition of HANDLE_TYPE().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@401 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-20 18:32:07 +00:00
Tim Cava faa052b597 Use strlcat, rather than strmcat, in ignore_list().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@400 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-20 18:20:05 +00:00
Tim Cava 559dfdd278 Use strlcat, rather than strmcat, in fill_it_out().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@399 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-19 20:52:37 +00:00
Tim Cava 12d3fadfb1 Use strlcat, rather than strmcat, in expand_twiddle().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@398 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-19 20:10:19 +00:00
Kevin Easton c9260b61d3 Fix typo reported by nesta.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@397 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-16 22:27:23 +00:00
Kevin Easton 933478d7b1 Rename cavlink's randm() function to cav_randm() so that it doesn't clash with
the definition from ircaux.h.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@396 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-16 11:59:36 +00:00
Kevin Easton a5bfc81b04 Fix typo bufer -> buffer.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@395 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-16 11:58:14 +00:00
Kevin Easton 751c53678d Use sizeof instead of size constant when passing buffers to getcwd().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@394 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-14 14:13:42 +00:00
Kevin Easton 69109d9045 Ensure that crypt_msg always leaves space for the trailing CTCP delimiter.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@393 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-14 14:10:26 +00:00
Kevin Easton 86d47f06ce Fix behaviour of /XDEBUG with no arguments (based on EPIC).
Previously it would carefully construct a string, then do nothing with it.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@392 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-14 14:02:09 +00:00
Tim Cava f5ef9ae80d Use strlcat, rather than strmcat, in function_ftime().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@391 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-13 20:28:11 +00:00
Tim Cava 501d960800 Use strlcat, rather than strmcat, in function_fsize().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@390 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-13 20:26:23 +00:00
Tim Cava a8db6437aa Use strlcat, rather than strmcat, in function_fexist().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@389 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-13 20:24:12 +00:00
Tim Cava 4f529d214f Cleanup crypt_msg(). Use strlcat rather than sprintf and strmcat.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@388 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-13 20:20:52 +00:00
Tim Cava e4e2c11429 Use strlcat, rather than strmcat, in xdebugcmd().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@387 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-13 19:33:48 +00:00
Tim Cava 9df878c536 Use strlcat, rather than strmcat, in do_clientinfo().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@386 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-13 19:21:29 +00:00
Tim Cava 9bc7e5c835 Cleanup help() a little bit. Use strlcat rather than strmcat.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@385 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-13 18:56:37 +00:00
Tim Cava 50d29b1f29 Use strlcat, rather than strmcat, in command_completion(). Pass sizeof buffer,
rather than a constant, to snprintf and strlcat.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@384 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-13 18:48:42 +00:00
Tim Cava 44874b28b3 Cleanup l_help() a little bit. Use strlcat and strlcpy rather than
strmcat and sprintf.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@383 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-13 18:33:23 +00:00
Kevin Easton 3de05c07c1 Only build and use the compat.c bsd_setenv/bsd_putenv/bsd_unsetenv on systems
that don't provide the POSIX setenv().

This fixes building plugins that link to compat.c on OS X (shared libraries on
OS X don't have direct access to environ).  It also reduces the binary size on
platforms which provide setenv(), which these days is most of them.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@382 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-09 21:40:55 +00:00
Kevin Easton 040c6abbe4 Add configure check for setenv()
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@381 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-09 20:08:17 +00:00
Kevin Easton 8c618b82fc Fix some longstanding build problems with !WANT_CDCC.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@380 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-06 13:20:46 +00:00
Kevin Easton 742887059d arcfour: Zero the full size of the 'in' array.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@379 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-06 13:18:22 +00:00
Tim Cava 536aea4704 Use strlcpy, rather than strmcpy, in function_prefix. From caf.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@378 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-02 00:02:54 +00:00
Kevin Easton 717d2e88b7 Fix incorrect truncation in cluster() caused by strlcpy().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@377 13b04d17-f746-0410-82c6-800466cd88b0
2013-09-28 14:26:57 +00:00
Kevin Easton d7bdc25960 Use memcpy() instead of strlcpy() in two places where the source length is
known and the destination length is known to be sufficient.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@376 13b04d17-f746-0410-82c6-800466cd88b0
2013-09-28 14:01:23 +00:00
Tim Cava 07c6a61fed Use strlcpy, rather than strmcpy, in extract().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@375 13b04d17-f746-0410-82c6-800466cd88b0
2013-09-21 05:12:43 +00:00
Tim Cava d01233f559 Use strlcpy, rather than strmcpy, in extract2().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@374 13b04d17-f746-0410-82c6-800466cd88b0
2013-09-21 05:11:07 +00:00
Tim Cava 21612025eb Use strlcpy and strlcat, rather than strmcpy and strmcat, in decrypt_msg().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@373 13b04d17-f746-0410-82c6-800466cd88b0
2013-09-18 23:41:46 +00:00
Tim Cava ea5aa01f87 Use strlcpy, rather than strmcpy, in cluster().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@372 13b04d17-f746-0410-82c6-800466cd88b0
2013-09-18 23:28:07 +00:00
Tim Cava 6afd2d4a87 Use strlcpy, rather than strmcpy, in Tcl_GetKeyedListField().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@371 13b04d17-f746-0410-82c6-800466cd88b0
2013-09-18 23:17:23 +00:00
Tim Cava c907a548e0 Use strlcpy, rather than strmcpy, in Tcl_GetKeyedListKeys().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@370 13b04d17-f746-0410-82c6-800466cd88b0
2013-09-18 23:16:12 +00:00
Tim Cava 4de9626a99 Use strlcpy, rather than strmcpy, in set_input_heb().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@369 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-26 08:06:36 +00:00
Tim Cava fafd888528 Cleanup rename_file() a little bit. Use strlcpy, rather than strmcpy.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@368 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-26 08:04:21 +00:00
Tim Cava c13b00be0c Use strlcpy, rather than strmcpy, in set_input().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@367 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-23 05:37:03 +00:00
Tim Cava 4ba3f45a89 Cleanup check_mode_lock() a little bit. Use strlcat, rather than strcat.
Prefer m_strdup over malloc_strcpy.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@366 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-23 04:49:54 +00:00
Tim Cava 56f5eceb26 Don't compare an array (cx_function) against NULL. Don't bother checking
whether a context is empty, since the result is the same.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@365 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-23 02:55:27 +00:00
Tim Cava ceada1fac4 Use strlcpy, rather than strmcpy, in split_CTCP().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@364 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-21 05:57:50 +00:00
Tim Cava 1524033b3f Use strlcpy and strlcat, rather than strmcpy, strmcat, and strcpy, in
do_notice_ctcp().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@363 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-21 05:53:18 +00:00
Tim Cava 3808071ba6 Use strlcpy and strlcat, rather than strmcpy, strmcat, and strcpy, in
do_ctcp().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@362 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-21 05:46:02 +00:00
Kevin Easton 4118a120bc Don't truncate the password and salt passed to crypt() by the $crypt()
scripting function - this allows alternate hashing methods to be selected
if supported by the C library.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@361 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-20 12:50:39 +00:00
Tim Cava 9207c838f9 Use strlcpy and strlcat, rather than strmcpy and strncat, in tcl_putdcc().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@360 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-18 09:56:12 +00:00
Kevin Easton 2fea73808f Improve the initial seeding of the randm() RNG. This is the RNG selected
for $rand() when RANDOM_SOURCE is 1.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@359 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 15:10:17 +00:00
Kevin Easton 641565d4eb Strengthen the algorithm that generates a random cookie for /detach.
This is a backwards-compatible change, no update to the scr-bx binary
is necessary.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@358 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 14:51:28 +00:00
Kevin Easton 5582171286 Switch random_number() to always use the best entropy source for internal
client purposes.  The RANDOM_SOURCE setting now only affects the $rand()
scripting function.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@357 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 14:47:04 +00:00
Tim Cava d194069da9 Use strlcpy, rather than strmcpy, in expand_twiddle().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@356 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 09:28:09 +00:00
Tim Cava b80425ce7d Use strlcpy, rather than strmcpy, in get_userhost().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@355 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 09:18:11 +00:00
Tim Cava 94f99bfdbb Use strlcpy, rather than strmcpy, in make_channel().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@354 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 09:11:04 +00:00
Tim Cava 41e52c7cf5 Use strlcpy, rather than strmcpy, in do_newuser().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@353 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 09:07:32 +00:00
Tim Cava 0b32d978f8 Actually use strlcpy.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@352 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 07:31:03 +00:00
Tim Cava 9a36857761 Use strlcpy, rather than strmcpy, in new_dcc_message_transmit().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@351 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 07:29:02 +00:00
Tim Cava ebd5398d89 Use strlcpy, rather than strmcpy, in create_timer_ref().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@350 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 06:22:58 +00:00
Tim Cava cc8f50b187 Use strlcpy, rather than strmcpy, in ov_server().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@349 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 06:16:00 +00:00
Tim Cava 44c4f2baf9 Use strlcpy, rather than strmcpy, in function_ftime().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@348 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 06:05:22 +00:00
Tim Cava 86e3064d2c Use strlcpy, rather than strmcpy, in function_rot13().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@347 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 06:03:32 +00:00
Tim Cava 23d1f6ad74 Use strlcpy, rather than strmcpy, in function_fsize().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@346 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 06:02:08 +00:00
Tim Cava e095a1f373 Use strlcpy, rather than strmcpy, in function_fexist().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@345 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 05:58:39 +00:00
Tim Cava 2caa8a2637 Use strlcpy, rather than strmcpy, in set_realname().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@344 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 05:42:09 +00:00
Tim Cava 7af7913c98 Use strlcpy, rather than strmcpy, in tcl_putscr().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@343 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 05:21:31 +00:00
Tim Cava 172bb8c409 Use strlcpy, rather than strmcpy, in tcl_putserv().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@342 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 05:19:50 +00:00
Tim Cava 3c4acd0446 Use strlcpy, rather than strmcpy, in tcl_putloglev().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@341 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 05:16:23 +00:00
Tim Cava 5b3d5bf285 Use strlcpy, rather than strmcpy, in tcl_putcmdlog().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@340 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 05:14:29 +00:00
Tim Cava 905bceb348 Use strlcpy, rather than strmcpy, in tcl_putlog().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@339 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 05:13:15 +00:00
Tim Cava 8a0d84b3ab Use strlcpy, rather than strmcpy, in status_windowspec().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@338 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 05:06:38 +00:00
Tim Cava bcdf91f415 Use strlcpy, rather than strmcpy, in status_refnum().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@337 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 05:04:20 +00:00
Tim Cava e8bca384b9 Use strlcpy, rather than strmcpy, in status_topic().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@336 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 05:01:46 +00:00
Tim Cava adf7bc4b68 Use strlcpy, rather than strmcpy, in status_channel().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@335 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 04:59:44 +00:00
Tim Cava d56010df9b Use strlcpy, rather than strmcpy, in status_umode().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@334 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 04:54:42 +00:00
Tim Cava fdddcf99bf Use strlcpy, rather than strmcpy, in make_status().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@333 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 04:47:19 +00:00
Tim Cava 89d82d7ae0 Use strlcpy, rather than strmcpy, in fix_status_buffer().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@332 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 04:39:08 +00:00
Kevin Easton 0b0dbf5cf7 Make the RANDOM_LOCAL_PORTS setting actually use a random port.
The code was calling random_number(65535 - 1024), but a non-zero argument
to random_number() is actually a seed to reseed the generator, and causes
random_number() to return zero.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@331 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 15:06:21 +00:00
Kevin Easton 176be1cff2 Add the ability to bind listening sockets to addresses, and use this for the
/detach IPC socket.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@330 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 14:05:15 +00:00
Tim Cava a394019490 Use strlcpy, rather than strmcpy, in window_log().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@329 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 10:55:09 +00:00
Tim Cava 674558ece4 Use strlcpy, rather than strmcpy, in delete_window().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@328 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 10:46:09 +00:00
Tim Cava e4e8a1358a Use strlcpy, rather than strmcpy, in show_server_map().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@327 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 10:41:00 +00:00
Tim Cava 72cf367e45 Use strlcpy, rather than strmcpy, in accept_server_nickname().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@326 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 10:35:43 +00:00
Tim Cava 68c3df7c6c Use strlcpy, rather than strmcpy, in set_server_nickname().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@325 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 10:28:56 +00:00
Tim Cava 337dfe0d06 Don't copy into a passwd struct returned by getpwuid().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@324 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 09:18:14 +00:00
Tim Cava 15c5f518fd Make the port passed to qbx's query_q_server() an unsigned short,
which eliminates a warning.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@323 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-14 23:18:07 +00:00
Tim Cava bc485f95a8 Possum's llist uses memcpy, so include string.h and eliminate a warning.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@322 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-14 22:32:48 +00:00
Kevin Easton a6f8021cd9 Fix a couple of compiler warnings in irc.c - two places where the address
of an array was tested (always not-NULL) and one unused variable (first_time
in io()).

The user-visible change here is that the emergency exit QUIT messages 
(eg "User abort with 5 Ctrl-C's") will be correctly relayed to the local 
terminal now.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@321 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-14 14:39:24 +00:00
Kevin Easton 1cfaf1349c Remove XLINK CTCP reply handler - it's not used for the botlink
functionality.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@320 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-14 13:34:04 +00:00
Kevin Easton 4a25f5462f Simplify code that produces realname from gecos, replace strmcat() with strlcat().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@319 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-14 09:32:33 +00:00
Tim Cava 74f8a720c4 Use strchr, rather than index, which is a legacy function. From caf.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@318 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-14 07:22:32 +00:00
Tim Cava c0bc9294cd Use strlcpy, rather than strmcpy, in parse_args().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@317 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-14 07:01:30 +00:00
Tim Cava b1d55bce82 Use memcpy, rather than strmcpy or strlcpy, in parse_command(). Suggested
by caf.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@316 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-14 04:15:09 +00:00
Tim Cava 0460b22bb0 Use strlcpy, rather than strmcpy, in realname_cmd().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@315 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-12 10:57:52 +00:00
Tim Cava 18142f0abe Use strlcpy, rather than strmcpy, in set_username().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@314 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-12 10:37:10 +00:00
Tim Cava 44e59337ee Include the size of hostname, nickname, realname, userhost and username
in their forward declarations.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@313 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-12 10:36:14 +00:00
Kevin Easton 338a8ecd4c Remove unnecessary declarations in term.c for wserv builds.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@312 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-12 09:40:59 +00:00
Tim Cava ca7f9c6b86 Use memcmp, rather than strncmp, in wavplay's validate_wav_header(),
and avoid warnings about mismatched signedness.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@311 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-11 08:20:37 +00:00
Kevin Easton c7cefb1c05 Don't look beyond the end of a cparse format if it ends with % or $.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@310 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-10 15:59:04 +00:00
Kevin Easton 9e0ba0a573 Pass correct buffer size to fgets().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@309 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-10 03:54:48 +00:00
Tim Cava 975bc2bc57 Don't compare an array to NULL, but check that the first character isn't
NULL. Found by Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@308 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-09 07:30:54 +00:00
Kevin Easton 6691732900 Make add_socketread() close the new socket if it can't be added to the
socket manager because it exceeds FD_SETSIZE.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@307 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-07 23:03:45 +00:00
Tim Cava 718e53d6f0 Refactor fserv's make_temp_list(), with help from caf, and use mkstemp()
instead of tmpnam(), which is dangerous. Found by Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@306 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-07 01:00:11 +00:00
Tim Cava 16fac903e9 Reverse the last commit, which accidentally included generated files.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@305 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-07 00:56:16 +00:00
Tim Cava 1ead56a251 Refactor fserv's make_temp_list(), with help from caf, and use mkstemp()
instead of tmpnam(), which is dangerous. Found by Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@304 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-07 00:50:43 +00:00
Kevin Easton c85ca721e3 strmcpy() does include the null terminator in the maximum number of bytes to
be written, so use sizeof - 1 instead of sizeof.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@303 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-01 14:47:12 +00:00
Tim Cava 565621d070 Use strmcpy, instead of strcpy, to initialize FSstr. Fixes a potential buffer overflow found by Coverity.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@302 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-31 09:28:46 +00:00
Tim Cava aefa6e71f4 Kill an unnecessary LOCAL_COPY() in fserv's print_mp3().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@301 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-31 07:39:13 +00:00
Tim Cava 94e04ff631 Remove a small amount of dead code found by Coverity.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@300 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-31 07:28:45 +00:00
Tim Cava b0fa3c55e6 Fix the for loop in cav_away().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@299 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-31 07:15:29 +00:00
Tim Cava 4057523aef Don't bother storing what find_in_list() returns, it goes unused. Found by Coverity.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@298 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-31 05:50:22 +00:00
Tim Cava d68a196b8a Mention fixes to commands in the banlist.c cleanup.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@297 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-31 05:40:44 +00:00
Tim Cava 92012cccd1 Cleanup banlist.c and fix a few bugs, with suggestions from caf.
* Restore from_server in doop() when prepare_command() fails
* Make /bans &channel work
* Make /unban #channel #number work (caf)


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@296 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-17 14:17:29 +00:00
Tim Cava 49a7117900 Including dcc.h in window.c is unnecessary.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@295 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-15 06:21:26 +00:00
Tim Cava 73bf008b9f Remove a duplicate include of dcc.h.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@294 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-15 06:20:49 +00:00
Tim Cava 2d0c2ac415 Including dcc.h in screen.c is unnecessary.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@293 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-15 06:19:53 +00:00
Tim Cava be47d08d53 Including dcc.h in exec.c is unnecessary.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@292 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-15 06:19:02 +00:00
Tim Cava 4309055cf7 Including dcc.h in commands2.c is unnecessary.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@291 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-15 06:02:23 +00:00
Tim Cava b786c75e7a Include string.h in arcfour's MD5 implementation, since it uses memset().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@290 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-15 04:23:40 +00:00
Tim Cava 6ae6edc0fb Make the definition of Tgetstr() use the value of y, when terminfo is
available, which quiets an unused variable warning.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@289 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-15 04:13:52 +00:00
Tim Cava 2d80cbb680 Restore this variable, as it's used when terminfo isn't available.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@288 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-15 03:48:43 +00:00
Tim Cava 3b509dfa52 Kill an unused variable in term_init().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@287 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-15 03:17:49 +00:00
Kevin Easton 84a87ca7ec Add socklen_t typedef for very old systems that don't provide it.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@286 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-15 01:29:43 +00:00
Kevin Easton 9378704c39 Improve the list_channels() function so that it behaves correctly when
connected to multiple servers.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@285 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 14:01:20 +00:00
Kevin Easton 7d9ffbe792 Add Changelog entry for socklen_t change.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@284 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 13:33:09 +00:00
Kevin Easton e915462aef Change a & to && in BX_do_compress_modes() to squash a warning. Should
be no behavioural change.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@283 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 13:25:22 +00:00
Tim Cava 0450875ab5 Remove two unnecessary includes from alias.c.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@282 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 05:26:51 +00:00
Tim Cava 37dcaad1ae Make the addrlen passed to connect() in connect_by_number() a socklen_t.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@281 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 04:16:13 +00:00
Tim Cava e070369079 Make the namelen passed to getsockname() a socklen_t everywhere.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@280 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 03:26:00 +00:00
Tim Cava 80cfa9c5d8 Make the namelen passed to getpeername() a socklen_t everywhere.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@279 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 03:18:47 +00:00
Tim Cava 27ed98a03d Make the addrlen passed to my_accept() a socklen_t everywhere.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@278 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 03:09:16 +00:00
Tim Cava a3b938dfd5 Make the addrlen argument to my_accept() a socklen_t.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@277 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 02:59:11 +00:00
Kevin Easton 2235c029bb Update Changelog for sys/termios -> termios fix.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@276 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 02:03:44 +00:00
Kevin Easton cc0b75f2dd Include <termios.h> in preference to <sys/termios.h>.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@275 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 02:01:59 +00:00
Kevin Easton ce86c78a21 Respin configure and defs.h.in for configure.in r273.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@274 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 00:57:29 +00:00
Kevin Easton 4673c6ff01 Add configure check for <termios.h>.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@273 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 00:55:35 +00:00
Kevin Easton 791c49986e Remove unnecessary termios.h includes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@272 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 00:51:58 +00:00
Kevin Easton d2b9d769e8 Respin configure and defs.h.in for configure.in r270.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@271 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 00:24:05 +00:00
Kevin Easton f4d7123ad6 Add configure check for socklen_t.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@270 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 00:14:24 +00:00
Tim Cava b4cd944bef The third argument to accept() should be a socklen_t.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@269 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-13 22:21:32 +00:00
Tim Cava 64779fd515 nap:naplink_handlelink() The third argument to accept() should be a
socklen_t.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@268 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-13 21:58:15 +00:00
Tim Cava b5f835e8fc identd:identd_handler() The third argument to accept() should be a
socklen_t.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@267 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-13 21:57:31 +00:00
Tim Cava 76528c6f38 arcfour:start_dcc_chat() The third argument to accept() should be a
socklen_t.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@266 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-13 21:53:24 +00:00
Kevin Easton d6393b8248 acro plugin: Use correct module name when registering command.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@265 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-10 13:33:43 +00:00
Kevin Easton b1de392172 acro plugin: Don't sort scores when saving to file. This was losing the head
of the list, and it's not necessary anyway.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@264 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-10 12:57:06 +00:00
Tim Cava ee35df3a41 Don't seed arcfour with uninitialized stack values when urandom can't be
opened, but fail instead. Fixes using uninitialized value warnings from
Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@263 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-09 07:06:43 +00:00
Tim Cava e39eddbc04 Oops. Remove init_schat()'s forward declaration.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@262 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-09 06:54:57 +00:00
Tim Cava ba8b5a67cb Kill unused initialization code in arcfour.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@261 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-09 06:39:50 +00:00
Tim Cava 0e099fe064 Kill unused code in dcc_sdcc() and eliminate an unused pointer value
warning from Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@260 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-08 04:42:46 +00:00
Tim Cava b1e59bed9e Convert uses of new_malloc/strcpy in end_vote() to m_strdup. While I'm
here, don't cast what new_malloc returns.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@259 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-07 09:28:11 +00:00
Tim Cava c76c962feb Convert uses of new_malloc/strcpy in take_vote() to m_strdup. While
I'm here, don't cast what new_malloc returns.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@258 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-07 09:22:04 +00:00
Tim Cava e42c16a832 Convert uses of new_malloc/strcpy in take_acro() to m_strdup. While
I'm here, don't cast what new_malloc returns.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@257 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-07 09:17:02 +00:00
Tim Cava 5ab9f87936 Simplify show_acros() by sending each line immediately, rather than
buffering lines together.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@256 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-07 08:51:25 +00:00
Tim Cava 8a02a1946a Simplify show_scores() by sending each line immediately, rather than
buffering lines together. This also avoids a dereference before null
check found by Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@255 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-07 08:39:34 +00:00
Tim Cava 114f6f52f0 Reorder the members of struct _srec to make type punning with
Lists work.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@254 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-03 03:06:44 +00:00
Tim Cava ed1ad22d70 Rewrite read_scores() with suggestions from caf. Failing to open the scores file no longer leaks memory, and a malformed record no longer adds an empty link to the global scores list.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@253 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-02 14:42:36 +00:00
Tim Cava 4ff0b8d2d5 Make sure setupterm() returns ERR before examining the status value.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@252 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-01 01:23:18 +00:00
Tim Cava c464efa90e Fix file descriptor leak in read_scores() found by Coverity.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@251 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-28 07:34:06 +00:00
Tim Cava ee761e7f02 Skip malformed entries in abots.sav, which avoids two null dereferences found by Coverity.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@250 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-28 05:22:20 +00:00
Tim Cava 7a5448aa74 Don't make a copy of args, it goes unused. Remove the variable it was stored to. Found by Coverity.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@249 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-26 13:09:01 +00:00
Tim Cava 3812cf36a6 Don't bother storing what get_window_by_name() returns, it goes unused. Found by Coverity.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@248 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-26 11:51:41 +00:00
Kevin Easton b5574f3b23 Replace fprintf() of single fixed buffer with fputs().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@247 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-25 12:16:38 +00:00
Kevin Easton 8a04cbeba8 Don't pass the output of convert_output_format(FORMAT_DCC, ...) directly to
sprintf() as a format string, because there could (and usually are!) '%'
characters that will be interpreted by sprintf.

This also allows clean compilation under -Werror=format-security.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@246 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-23 14:36:32 +00:00
Kevin Easton dd9de3dff0 Update (currently un-used) save_digraphs() function so that it compiles
cleanly with -Werror=format-security.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@245 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-23 14:32:47 +00:00
Kevin Easton c51810738e Improve handling of one kind of malformed CDCC save file, where the pack
description line doesn't contain a space.  Found by Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@244 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-20 01:45:29 +00:00
Kevin Easton 882c3150e2 Fix open file leak in /LASTLOG, in situations like:
/LASTLOG -FILE /tmp/a -FILE /tmp/a
/LASTLOG -FILE /tmp/a -CLEAR
/LASTLOG -FILE /tmp/a -LITERAL
/LASTLOG -FILE /tmp/a -BOGUS

Found by Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@243 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-18 12:55:32 +00:00
Kevin Easton 2fc84d5f93 Fix a file descriptor leak when connect() fails during a SOCKS4 proxy
connection attempt.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@242 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-18 11:00:12 +00:00
Tim Cava b26e295137 Improve cryptit() fixes, suggested by caf.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@241 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-17 08:00:37 +00:00
Tim Cava df8328c3a1 Fix out-of-bounds error in cryptit() found by Coverity.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@240 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-16 14:40:52 +00:00
Kevin Easton 88172a9004 paused_topic should be the same size as help_topic_list.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@239 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-16 13:12:59 +00:00
Kevin Easton ceb0492734 Cleanup save_formats() by removing unused function argument.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@238 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-16 12:21:03 +00:00
Kevin Easton bad477f9dc Fix off-by-one error in the check for s against FD_SETSIZE in add_socketread()
and set_socketwrite().  This was found by Coverity.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@237 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-16 06:04:29 +00:00
Kevin Easton 6045b8fe91 Fix installhelp target on OpenBSD.
The -R flag to cpio isn't portable, so replace it with an open-coded
shell loop.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@236 13b04d17-f746-0410-82c6-800466cd88b0
2013-05-22 11:56:20 +00:00
Kevin Easton 092d9789e0 Order the rfc1459[] array correctly.
This is a longstanding bug - it's also present in EPIC4 and EPIC5 so it's
probably been in BitchX since the beginning.  The bug has been latent until
the AUTHENTICATE and CAP commands were added, which perturbed the binary
search so that the client didn't see invite messages properly.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@235 13b04d17-f746-0410-82c6-800466cd88b0
2013-04-24 12:05:44 +00:00
Kevin Easton 73269ea887 Bail out of check_auto_reply() early if auto_str is NULL. This fixes a
crash after /SETAR -.

Reported by riderplus.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@234 13b04d17-f746-0410-82c6-800466cd88b0
2013-03-01 12:33:00 +00:00
Kevin Easton 17e3a91f03 Remove handling for the 484 numeric. It was intended for ircnet's 484
(ERR_RESTRICTED), to set user mode +r - however this does not appear to
be necessary anymore.  It was also buggy for several reasons: due to 
a change in set_server_flag() this has actually been setting mode +G; and
484 is ERR_ISCHANSERVICE on other ircds.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@233 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-25 12:22:54 +00:00
Tim Cava d7a0c781f8 Convert simple uses of alloca/strcpy to LOCAL_COPY.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@232 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-24 07:32:59 +00:00
Tim Cava a7c93a3950 Remove a redundant call to alloca.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@231 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-23 20:57:24 +00:00
Kevin Easton e99861dbfb Add /OBITS command showing obituaries for long-time BitchX friends.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@230 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-21 22:29:34 +00:00
Kevin Easton 5da6c807c2 Remove old reference to BitchX.com
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@229 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-21 11:04:35 +00:00
Kevin Easton 29a3747534 Fix sequence point issue in arcfour (S[x] = --x; is undefined).
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@228 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-16 13:32:00 +00:00
Kevin Easton 1390402af1 Fix abuses of the RESIZE() macro in array.c, of the form:
x = RESIZE(x, type, size);

which should just be:

RESIZE(x, type, size);

The erroneous use is undefined behaviour according to the C standard, and
causes new versions of gcc (and, apparently, clang) to throw a warning.

Reported by nenolod/moogle.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@227 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-16 08:11:07 +00:00
Kevin Easton 934d19aaa2 Some more minor BitchX.quit tidying.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@226 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-16 08:06:20 +00:00
Kevin Easton da954a5c37 Apply patch from Dan Mashal (VICODAN) - Fix incorrect FSF address.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@225 13b04d17-f746-0410-82c6-800466cd88b0
2013-01-17 12:55:55 +00:00
Kevin Easton a1ec2113e9 Fix sort_scores in the acro plugin - pass the correct number of array entries
to qsort() and properly reconstruct the list.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@224 13b04d17-f746-0410-82c6-800466cd88b0
2013-01-04 10:11:32 +00:00
Kevin Easton f51de3a170 Fix the timer callbacks in the acro plugin to use the correct function
signature.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@223 13b04d17-f746-0410-82c6-800466cd88b0
2013-01-04 09:03:12 +00:00
Kevin Easton bf40ef7015 Use INSTALL_DATA instead of INSTALL to install the BitchX.hints file. This
means it's not made executable.

Patch from Jeff Horelick <jdhore@gentoo.org>.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@222 13b04d17-f746-0410-82c6-800466cd88b0
2013-01-03 03:03:30 +00:00
Kevin Easton 84346beafa Make 'toc' target a dependency of aim.so, so that parallel building works.
Patch from Jeff Horelick <jdhore@gentoo.org>.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@221 13b04d17-f746-0410-82c6-800466cd88b0
2013-01-03 02:57:39 +00:00
Kevin Easton c3a2a39513 Don't strip plugins on install - it's no longer really necessary and helps in
debugging to have the symbols.

Patch from Jeff Horelick <jdhore@gentoo.org>.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@220 13b04d17-f746-0410-82c6-800466cd88b0
2013-01-03 02:48:09 +00:00
Kevin Easton 2027f75969 Move inclusion of system headers in misc.c to top, which fixes building on
recent Cygwin (including windows.h after the macros defined in modval.h
causes the build to fail due to our 'load' macro).  Reported by VICODAN.

Also define WIN32_LEAN_AND_MEAN in misc.c, which should speed up Cygwin
build times a little.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@219 13b04d17-f746-0410-82c6-800466cd88b0
2013-01-02 22:40:58 +00:00
Kevin Easton 754f1a19eb Update installation instructions, including changes from cpet.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@218 13b04d17-f746-0410-82c6-800466cd88b0
2012-12-31 13:27:29 +00:00
Kevin Easton b2c9da8fef Fix the AC_CHECK_PLUGIN_SUPPORT configure macro so that it matches FreeBSD-1.*
instead of FreeBSD-1*, which fixes building with plugins on FreeBSD-10.  Also
a similar fix for the FreeBSD-2.* case.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@217 13b04d17-f746-0410-82c6-800466cd88b0
2012-12-30 22:47:03 +00:00
Kevin Easton 1541299fa1 Merge infrastructure for SASL authentication support from flashback.
This includes all of the underlying support, but doesn't hook it up to the
/SERVER command yet, so it's not useable at this point.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@216 13b04d17-f746-0410-82c6-800466cd88b0
2012-12-30 02:22:56 +00:00
Tim Cava 0d67cac5f7 Add a note about fixing QUITs with SSL connections.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@215 13b04d17-f746-0410-82c6-800466cd88b0
2012-10-21 01:36:23 +00:00
Kevin Easton 1e7c7edd1b Use LOG_PUBLIC instead of LOG_MSG for PRIVMSGs sent to channels.
This doesn't tend to affect what window they go to, since for channels
there's always a target window based on the channel.  But it does
affect logging.

This was fixed in EPIC4 back in 2001.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@214 13b04d17-f746-0410-82c6-800466cd88b0
2012-10-19 12:25:25 +00:00
Kevin Easton f7607baf45 Add tcl.c to source distribution (panasync gave his permission for this to be released).
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@213 13b04d17-f746-0410-82c6-800466cd88b0
2012-10-19 12:11:05 +00:00
Tim Cava 416fcda578 Fix QUIT messages with SSL connections.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@212 13b04d17-f746-0410-82c6-800466cd88b0
2012-09-20 02:36:48 +00:00
Kevin Easton c604db14e5 Add cp437 tool to contrib/ directory.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@211 13b04d17-f746-0410-82c6-800466cd88b0
2012-07-26 07:21:20 +00:00
Kevin Easton 18721ef0f2 Respin configure for configure.in r208.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@210 13b04d17-f746-0410-82c6-800466cd88b0
2012-06-17 23:30:20 +00:00
Kevin Easton dd0c756cbc Add .deb package build files from nyet.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@209 13b04d17-f746-0410-82c6-800466cd88b0
2012-06-17 23:26:20 +00:00
Kevin Easton 69fd6e12c7 Change command used to install help files so that it ignores VCS directories.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@208 13b04d17-f746-0410-82c6-800466cd88b0
2012-06-17 23:22:55 +00:00
Kevin Easton 904ad9edef Update sites and mailing list addresses.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@207 13b04d17-f746-0410-82c6-800466cd88b0
2012-06-13 14:59:20 +00:00
Kevin Easton d22a4531d8 Update old email addresses in user-visible messages.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@206 13b04d17-f746-0410-82c6-800466cd88b0
2012-06-13 12:34:32 +00:00
Tim Cava 46cf14c0da Fix the MKNU command, with suggestions from caf.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@205 13b04d17-f746-0410-82c6-800466cd88b0
2012-06-07 04:22:17 +00:00
Kevin Easton 3ed7f68d4e Rename include/bitchx to include/options.h. This fixes building on
case-insensitive filesystems like NTFS or HFS+, where it clashes with
the BitchX binary.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@204 13b04d17-f746-0410-82c6-800466cd88b0
2012-06-02 14:53:37 +00:00
Kevin Easton 252d1bf004 On systems that support it, supply the AI_ADDRCONFIG flag to getaddrinfo().
This means that we shouldn't try to connect using IPv6 if the local machine
doesn't have an IPv6 address itself.

This also simplifies the IPv6 code in BX_connect_by_number() a bit.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@203 13b04d17-f746-0410-82c6-800466cd88b0
2012-06-02 11:38:37 +00:00
Kevin Easton 64605b326c Respin configure for configure.in r201.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@202 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-31 12:43:57 +00:00
Kevin Easton fa42be30ae Change configure.in to enable SSL by default, if libssl is present. Can
still be disabled with --without-ssl.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@201 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-31 12:40:26 +00:00
Kevin Easton dd51b53e7d AC_CHECK_LIB() doesn't work to check for Windows API functions due to calling
conventions, so use AC_LINK_IFELSE() instead.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@200 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-30 12:26:44 +00:00
Kevin Easton 27c4333ef5 Respin configure and defs.h.in for configure.in r198.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@199 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-28 13:54:19 +00:00
Kevin Easton d13eee6683 The Cygwin resolver library doesn't fill out the list of name servers in
res_init() if /etc/resolv.conf doesn't exist, which is usual.

Add code to handle this by calling GetNetworkParams().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@198 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-28 13:52:18 +00:00
Kevin Easton 1c2581aea3 Respin configure for configure.in r196.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@197 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-27 04:43:40 +00:00
Kevin Easton 79625bf516 Define BIND_4_COMPAT everywhere (except OS X, who just _had_ to be different)
and switch to using BIND4 macros (GETSHORT / GETLONG).

Should fix /nslookup on OpenBSD.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@196 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-27 04:42:09 +00:00
Kevin Easton 82f7a2ccf2 Use AC_LANG_SOURCE() around argument to AC_LINK_IFELSE(), this means that we
get confdefs.h included in the test.

This should fix the resolver linking issue on OS X.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@195 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-27 04:26:36 +00:00
Kevin Easton 6947c0492d Update configure for configure.in r193.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@194 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-24 13:03:57 +00:00
Kevin Easton 8a9917270c Alter method of finding resolver library name, to hopefully work on OSX.
Now uses AC_LINK_IFELSE() to link a program that calls res_mkquery(),
after defining BIND_8_COMPAT / BIND_4_COMPAT as per misc.c.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@193 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-24 13:02:44 +00:00
Kevin Easton 241f3df842 Spin up new configure for configure.in r191.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@192 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 14:32:26 +00:00
Kevin Easton 5b7c84fb55 Rework res_mkquery test, adding test for __res_mkquery to fix problem on
x86-64 platforms reported by snadge.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@191 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 14:31:05 +00:00
Kevin Easton 43f5288dd4 Update document to remove old supported platforms list and correct old
information about vhosts.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@190 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 14:29:06 +00:00
Kevin Easton ab7d59f1f6 Add a length sanity check - just in case there's an implementation out there
that parses AF_UNIX addresses in getaddrinfo() or something.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@189 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 14:01:42 +00:00
Kevin Easton ba365bfd54 Fix logic error that can result in a potential crash (when getaddrinfo() fails
and res happened to be NULL).

Also add missing freeaddrinfo() call.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@188 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 13:29:32 +00:00
Kevin Easton 9ec4f49540 Apply patch from snadge to set BIND_4_COMPAT on OpenBSD. This is similar
to the existing BIND_8_COMPAT fix for OSX.

Oh how I hate the /nslookup function.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@187 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 13:16:11 +00:00
Kevin Easton 2f79061c0d Partially back out r183, by removing -fPIC from Cygwin builds. It's
unnecessary there and just creates a warning.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@186 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 12:52:25 +00:00
Kevin Easton 5b95a36896 Rebuilt for aclocal.m4 changes in r183.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@185 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 12:36:51 +00:00
Kevin Easton e16b8197b0 Change message at end of "make install" to make vicodan happy.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@184 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 12:35:19 +00:00
Kevin Easton 4e53ace4f1 Use -fPIC for building plugins on NetBSD, OpenBSD, FreeBSD, BSDI and Cygwin.
Required for plugins to work on x86-64.

Thanks to snadge for this patch.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@183 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 12:22:13 +00:00
Kevin Easton 26a62fe7fa Rework the IPV6 verison of BX_ip_to_host() so that it works on BSD (used
by $iptoname() scripting function).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@182 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-14 13:56:52 +00:00
Kevin Easton f035eceb72 Pass the right socket address length to bind() in client connections with
IPv6 enabled.  This fixes an issue reported by packet, where IPv4 conections
don't work on FreeBSD when the client is built with IPv6 support and you
have a local hostname set (with /hostname, -H or IRCHOST).

Also ensure we clear the full size of the 'server' address structure - doesn't
fix a known problem but is a defensive measure.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@181 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-13 14:06:53 +00:00
Kevin Easton 35f0400e1f Fix typo.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@180 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-11 22:00:16 +00:00
Kevin Easton d029695841 Remove old devel files that shouldn't have been left lying around.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@179 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-11 12:47:01 +00:00
Kevin Easton e27169c15e Rebuild for configure.in r177.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@178 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-11 12:32:51 +00:00
Kevin Easton 0271799a4a Remove check for Linux from IPv6 tests. Replace GLIBC version test with
a generic link test for "native" IPv6.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@177 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-11 12:31:31 +00:00
Kevin Easton 5d788560a4 Choose the address length passed to connect() based on the address family.
This fixes making IPv4 connections on BSD when the client is compiled with
IPv6 enabled.

Thanks to brabes on sourceforge and snadge@freenode for originally tracking
this down.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@176 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-11 12:22:03 +00:00
Kevin Easton 0219904860 Ensure that real errors from connect() (eg. EINVAL) are detected and
acted on immmediately, even for nonblocking connects.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@175 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-11 12:03:10 +00:00
Kevin Easton 8e66eb6653 A few updated quit messages.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@174 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-10 12:47:51 +00:00
Kevin Easton 972b428e89 Create relative rather than absolute link to BitchX executable at
install time.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@173 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-10 12:42:25 +00:00
Kevin Easton 68a84226de Rebuild for configure.in r170.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@172 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-10 12:41:24 +00:00
Kevin Easton c9fa7b0ce1 Remove unused sys/syslimits.h include.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@171 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-10 12:31:04 +00:00
Kevin Easton eb964e1c52 Remove BitchX.spec and gtkBitchX.spec - these are obsolete now. A new
BitchX.spec will be added later.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@170 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-10 12:22:22 +00:00
Kevin Easton 822522affa Fix test so that sig.inc isn't built if sys_siglist, _sys_siglist or strsignal
is available.

In the long-run sig.inc should be built by a Makefile target.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@169 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-10 09:16:25 +00:00
Kevin Easton 5d1953946e Use the correct dependencies when checking for net/if.h, arpa/inet.h and resolv.h
(fixes a nasty configure spew on FreeBSD, reported by flashback).

Add check for sys/socket.h, replace unused checks for netinet/in_systm.h and 
sys/in_system.h with a check for netinet/in.h.  Remove unused check for
sys/syslimits.h.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@168 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-10 09:12:27 +00:00
Kevin Easton de771dac56 Simplify install target for translation files and scripts. No longer creates
bxglobal.old backup of bxglobal file at install time.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@167 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-08 15:41:09 +00:00
Kevin Easton 3bbe082f16 Fix aim and nap plugin Makefiles so that they build compat.o in the right
place when building out-of-tree.  Reported by nyet.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@166 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-08 15:20:39 +00:00
Kevin Easton b55825ab99 Rebuild configure from configure.in rev 164.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@165 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-08 14:35:53 +00:00
Kevin Easton 7ee26d4ed3 Change the install* targets in the Makefiles to honour DESTDIR. This
makes packaging the client for .deb and .rpm easier.

Reported separately by nyet and VICODAN.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@164 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-08 14:34:25 +00:00
Kevin Easton cb0c2aabc2 Improve error handling in /detach - will now soft-fail the detach instead
of killing the whole client.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@163 13b04d17-f746-0410-82c6-800466cd88b0
2012-04-30 08:05:04 +00:00
Kevin Easton 3090365354 Change connect_by_number() so that SERVICE_SERVER sockets are always bound to
IPv4 even on an IPv6-enabled client.  This fixes /detach and wserv when
compiling with --enable-ipv6.

This does also mean that the internal identd, if used, won't listen on IPv6
either.  This isn't a problem yet, since the internal identd is used only on
WINNT and we don't support IPv6 there yet.

This will also need tweaking to support initiating DCC-over-IPv6.

Thanks to snadge and packet for working on this bug.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@162 13b04d17-f746-0410-82c6-800466cd88b0
2012-04-29 12:15:57 +00:00
Kevin Easton 10d5ab5a18 Changelog update for r160 change.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@161 13b04d17-f746-0410-82c6-800466cd88b0
2012-03-06 12:12:58 +00:00
Kevin Easton 97174632dc Add explicit default value for NICK_COMPLETION_CHAR.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@160 13b04d17-f746-0410-82c6-800466cd88b0
2012-03-06 11:14:51 +00:00
Kevin Easton a9e1608865 Compile wterm.o, bircsig.o, wnetwork.o, bcompat.o, sterm.o directly
from source files without symlinks.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@159 13b04d17-f746-0410-82c6-800466cd88b0
2012-03-06 11:11:54 +00:00
Kevin Easton dd6bb7752b Update copyright notice and add COPYRIGHT file to top-level of archive.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@158 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-29 22:56:23 +00:00
Kevin Easton b0f8c03dec Cleanup ci_alist_hash() and cs_alist_hash(), fixes a compile warning.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@157 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-17 13:11:03 +00:00
Kevin Easton e2ada61548 Modernise autoconf checks for sys_siglist and strsignal.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@156 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-17 12:30:55 +00:00
Kevin Easton b7c216bcc6 Remove special compilation for help.c - DEFAULT_HELP_PATH isn't
referenced by the code.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@155 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-17 10:31:20 +00:00
Kevin Easton c648b63fa6 Regenerate configure and defs.h.in using autoconf and autoheader 2.59.
(Applies FreeBSD 9 build fix from rev 152 to configure).  May also fix
strlcpy() detection with icc.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@154 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-17 10:24:38 +00:00
Kevin Easton 71584dfc23 Build system fixes - remove unnecessary acconfig.h.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@153 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-17 10:21:54 +00:00
Kevin Easton f95ebdc259 Fix AC_CHECK_PLUGIN_SUPPORT to fix building on FreeBSD 9, and regenerate
aclocal.m4 with the fix.  This improves upon the original fix in revision 78,
and should actually fix the problem this time.

Reported by cpet and VICODAN.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@152 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-16 10:13:10 +00:00
Kevin Easton 6c6ae94dd4 Changelog update for rev 150 change.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@151 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-16 09:10:06 +00:00
Kevin Easton 5222ce2f1d Move window_check_servers() call out of loop, otherwise the client does a
huge amount of work on each keystroke if you have a long server list and
start it up disconnected (-N).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@150 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-10 12:38:08 +00:00
Kevin Easton 87f24694b9 Remove unnecessary ns_init() function.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@149 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-10 11:22:14 +00:00
Kevin Easton 122849f247 Replace _getshort() and _getlong() with NS_GET16() and NS_GET32() respectively.
Fixes compilation on cygwin (and possibly other targets).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@148 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-08 12:53:16 +00:00
Kevin Easton 7978a87c9f Change async DNS resolver code to register its file descriptor with the IO
core.  This fixes /nslookup.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@147 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-08 11:24:48 +00:00
Kevin Easton ed16081a2b Remove bogus F_SETOWN use in /detach code.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@146 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-01 13:26:50 +00:00
Kevin Easton 5cf8ed2c79 Cleanup create_ipc_socket() and ensure it detects all errors in
connect_by_number().  Make function static since it is only used in one
source file.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@145 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-01 13:21:47 +00:00
Kevin Easton 71cc2bf5f4 Add FORMAT_WHOIS_SECURE for SSL connection info from ratbox, unreal and freenode servers (RPL_WHOISSECURE). Does not support
hybrid yet because it uses numeric 275, which clashes with unreal's RPL_STATSDLINE.

RIP dmr.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@144 13b04d17-f746-0410-82c6-800466cd88b0
2011-10-13 12:45:27 +00:00
Kevin Easton 15f6d8ac06 Pass through arguments of 338 numeric unchanged to script hook.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@143 13b04d17-f746-0410-82c6-800466cd88b0
2011-10-06 09:48:10 +00:00
Kevin Easton b355145d69 Add /FSET CHANNEL_URL to format the RPL_CHANNELURL (328) numeric sent by dalnet and atheme services.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@142 13b04d17-f746-0410-82c6-800466cd88b0
2011-10-04 12:47:01 +00:00
Kevin Easton 89b77f68fe Cleanups and simplifications in mircansi(), removal of some more warnings.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@141 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-07 14:41:06 +00:00
Kevin Easton 206df688ba Fix mircansi() so that it properly handles non-numeric characters
after a comma.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@140 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-07 12:48:35 +00:00
Kevin Easton cc0a27d7fe Rework stripansicodes() to take a const char * argument rather than const unsigned char *,
fixing a large number of warnings. 


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@139 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-07 10:13:18 +00:00
Kevin Easton 43aaf645e2 Use PC_SILENT macro in BX_prepare_command()
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@138 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-06 06:55:38 +00:00
Kevin Easton 736777bea3 Change instances of open-coded "3" in calls to prepare_command() with PC_SILENT macro.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@137 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-06 06:48:57 +00:00
Kevin Easton 02e4ced684 Add PC_TOPIC flag to prepare_command() for topic-change commands.
Clean up e_topic(), splitting out untopic() and using prepare_command()
to check for ops.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@136 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-05 12:57:31 +00:00
Kevin Easton 83ac47c4f5 Minor cleanup for error_not_opped().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@135 13b04d17-f746-0410-82c6-800466cd88b0
2011-08-30 14:52:56 +00:00
Kevin Easton c89a718fa1 Change the channel mode flags from const ints in names.c to #define macros in names.h.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@134 13b04d17-f746-0410-82c6-800466cd88b0
2011-08-30 14:50:42 +00:00
Kevin Easton 3f8952f20a Fix some memory leaks that occur when clearing the URL-grabber list.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@133 13b04d17-f746-0410-82c6-800466cd88b0
2011-06-01 12:53:30 +00:00
Kevin Easton 52753a9e15 Further cleanups in the URL grabber - remove unnecessary globals, change
url_list from extern to static.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@132 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-17 14:16:34 +00:00
Kevin Easton b628217600 Fix a memory leak in the URL grabber - as old URLs were expired from the list,
they weren't being freed.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@131 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-17 14:03:29 +00:00
Kevin Easton 41d0516849 Remove some dead code in funny_mode().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@130 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-16 13:16:25 +00:00
Kevin Easton 1569a5233f Fix a regression with the previous changes to $help() - topics with embedded
spaces are enclosed in quotes eg. $help("cdcc tresend").


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@129 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-03 11:55:34 +00:00
Kevin Easton 7c36bdd4ad Cleanups to $help() function, removing some half-baked functionality that
never worked properly.  Search LOAD_PATH for the SCRIPT_HELP file.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@128 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-02 12:34:39 +00:00
Kevin Easton c5b5fdd4af Sort the chelp index after loading - ensures that all topics are reachable.
Use correct define for PUBLIC_ACCESS.

Some cleanups - separate out help index freeing, change get_help_topic() to return
void.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@127 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-02 11:43:38 +00:00
Kevin Easton 1838a37a6c Cleanups in get_help_topic(). Topic now displays correctly, rather than the
argument supplied to /bhelp.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@126 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-18 14:30:03 +00:00
Kevin Easton ab170a123d Further simplifications and improvements to the chelp code.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@125 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-18 12:54:13 +00:00
Kevin Easton 47ce4ab1e1 Apply changes to BitchX.help from t3gah.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@124 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-18 12:38:21 +00:00
Kevin Easton 09c34c045f Further cleanups and fixes in chelp.c:read_file(). Now properly adds NULLs to
terminate the lists, that the code in get_help_topic() expects to be there - 
fixes a potential crash in /bhelp.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@123 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-17 11:58:16 +00:00
Kevin Easton df5547af72 Add .xxx TLD to country(), and some more const-correctness.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@122 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-17 03:33:00 +00:00
Kevin Easton 780ac2c149 Cleanup and rename replace_color() to put_color(), including sanity-checking of
foreground color code - this ensures that if a wild color code makes it this
far, it doesn't crash the client.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@121 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-08 13:10:05 +00:00
Kevin Easton fd9980b9c7 Fix spelling mistake.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@119 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-08 12:29:55 +00:00
Kevin Easton 7f293687b1 Correct help text for /bhelp, reported by t3gah.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@118 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-05 23:24:22 +00:00
Kevin Easton 9b92ec3c11 Cleanups and simplifications in read_file().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@117 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-05 11:59:06 +00:00
Kevin Easton c816dcec22 Add missing entry for new USERMODE_OTHERS /fset.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@116 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-05 05:47:49 +00:00
Kevin Easton 3f0ef54b18 Remove some dead code and add a sanity check to create_fsets().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@115 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-05 05:45:20 +00:00
Kevin Easton c45c6a69bf Cleanup p_mode() and correct handling of user mode changes where the source
and the target aren't the same (reported by gauze).  This doesn't happen
on standard servers, but is used by services on some networks.

Adds /FSET USERMODE_OTHER.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@114 13b04d17-f746-0410-82c6-800466cd88b0
2011-03-31 22:20:21 +00:00
Kevin Easton 719279790e Add some more TLDs to $country(), synchronised with the IANA list: .ax, .eu,
.me, .rs, .tl, .asia, .cat, .jobs, .tel and .travel.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@113 13b04d17-f746-0410-82c6-800466cd88b0
2011-03-31 08:32:23 +00:00
Kevin Easton b17b09949b Improve country() by using "static const" for lookup table (makes function 25% smaller)
and const-correctness.  Add .mobi TLD.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@112 13b04d17-f746-0410-82c6-800466cd88b0
2011-03-23 11:17:23 +00:00
Kevin Easton 94550b1fac Changelog update - Irix fixes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@111 13b04d17-f746-0410-82c6-800466cd88b0
2011-02-02 12:41:50 +00:00
Kevin Easton 3aa7f7765f Remove non-standard arithmetic on void *, and get offsetof() from <stddef.h> instead
of rolling our own.

Fixes building on Irix.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@110 13b04d17-f746-0410-82c6-800466cd88b0
2011-02-02 12:34:13 +00:00
Kevin Easton b43ecbaa85 Improve memory allocation routines to fix alignment and remove non-standard
void * arithmetic.

Fixes compilation on Irix.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@109 13b04d17-f746-0410-82c6-800466cd88b0
2011-02-02 12:15:29 +00:00
Kevin Easton 08cca81993 Rework cset functions to remove non-standard void * arithmetic.
Fixes compiling on Irix.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@108 13b04d17-f746-0410-82c6-800466cd88b0
2011-02-02 12:13:54 +00:00
Kevin Easton fc33f520ae Remove non-standard void * arithmetic (fixes compilation with Irix compiler).
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@107 13b04d17-f746-0410-82c6-800466cd88b0
2011-02-02 12:11:03 +00:00
Kevin Easton 9f3256cac7 A few updates to the quit messages.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@106 13b04d17-f746-0410-82c6-800466cd88b0
2011-02-02 11:11:28 +00:00
Kevin Easton 6711ef7f00 Correct use of IN6ADDR_ANY_INIT initialiser, fixes IPv6 build on Intel ICC.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@105 13b04d17-f746-0410-82c6-800466cd88b0
2010-12-16 21:15:15 +00:00
Kevin Easton d1e13bc526 Show correct message ("Remote end closed connection") when we get EOF
on a socket.

I also added a wrapper function around strerror() for dgets_errno, since
we did the same thing in a few places.  This all needs to be cleaned up
a little - the -1 value we use could in theory clash with an actual
errno error number.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@104 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-30 13:26:06 +00:00
Kevin Easton 7a59da1f2e Add /FSET WHOIS_CALLERID for +g mode notification on hybrid & ratbox.
This is numeric 716.  Hybrid shows it in WHOIS, and both show it when you
try to PRIVMSG someone who is +g (similar to AWAY).  So I've formatted it
to match the WHOIS block.

I also took the chance to fix up the ordering of the fsets, and remove
a bunch of redundant setting of default values.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@103 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-30 12:48:28 +00:00
Kevin Easton 5430be4c78 Add RPL_WHOISHOST (378) numeric from Unreal (and freenode).
Formats with /fset WHOIS_ACTUALLY.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@102 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-20 12:30:55 +00:00
Kevin Easton 4fab4aaebf Add svn:ignore Makefile to ignore generated Makefiles in plugin directories.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@101 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-10 13:35:49 +00:00
Kevin Easton 06c8ccdf3c Remove empty 'mail' directory (old plugin?)
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@100 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-09 01:11:17 +00:00
Kevin Easton 2f92982eac Build script fix to allow plugins to build on x86-64.
$(SHLIB_CFLAGS) is required on the compile line, not just the link line.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@99 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-09 01:08:14 +00:00
Kevin Easton f71e26acc7 Correct count in /CLONES (reported by t3gah), and format output nicely
using an /fset.

/CLONES now uses the same formats as the /U command.  Also tweaked those
formats at the same time.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@98 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-06 13:40:13 +00:00
Kevin Easton cb8e8c21ae Add definition of BIND_8_COMPAT to fix build problem on Mac OS X.
Every other UNIX in existence defines BIND_4_COMPAT in arpa/nameser.h, which
ensures that nameser_compat.h gets included.  Mac OS X changed it to 
BIND_8_COMPAT and stopped including it by default.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@97 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-06 12:46:03 +00:00
Kevin Easton 518186b85b Add changelog message for -z command line option fix.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@96 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-05 09:21:16 +00:00
Kevin Easton 3c0e23a7c5 Ensure that SHOW_AWAY_ONCE doesn't hide away status in /whois output, by
clearing last_away_msg when the 311 whois reply numeric is recieved.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@95 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-05 09:03:32 +00:00
Kevin Easton d6c105861c Fix auto-away time strangeness when server reconnection happens.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@94 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-05 08:37:04 +00:00
Tim Cava a72091bb0e Fix the -z command line option and the use of the IRCUSER environment variable.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@93 13b04d17-f746-0410-82c6-800466cd88b0
2010-07-30 09:52:17 +00:00
Tim Cava 28f8b2c9af Use the value passed to auto_away() instead of recalculating it, and rename
this variable "idle_mins". (From BX2)


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@92 13b04d17-f746-0410-82c6-800466cd88b0
2010-07-01 08:19:28 +00:00
Tim Cava 7269d14c75 When /AWAYMSG is used without an argument, tell the user their auto-away msg was unset,
instead of saying it was set to "nothing". (From BX2)


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@91 13b04d17-f746-0410-82c6-800466cd88b0
2010-06-30 05:50:12 +00:00
Kevin Easton 60d451fa92 Cleanup my_whois a bit.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@90 13b04d17-f746-0410-82c6-800466cd88b0
2010-06-27 13:05:32 +00:00
Kevin Easton 0fe403c70c Fix attribution.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@89 13b04d17-f746-0410-82c6-800466cd88b0
2010-06-27 00:50:35 +00:00
Kevin Easton 223926fdf2 Fix up /WILN, /WILC and /WILCR. last_ctcp is now the last CTCP request
recieved; last_ctcp_reply is the last reply recieved (used by /RELCR etc.)

All of the /WI* commands now do a /WII style full whois request.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@88 13b04d17-f746-0410-82c6-800466cd88b0
2010-06-26 14:43:22 +00:00
Kevin Easton 789ed916cd Backport changes from epic5 to make recv_nick, sent_nick and sent_body
per-server, and apply new version of do_oops from flewid (the BX2 version). 

This means that /oops, "/query .", "/query ,", "/msg ." and "/msg ," are now
per-server, along with the $. $, and $B aliases.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@87 13b04d17-f746-0410-82c6-800466cd88b0
2010-06-26 08:18:34 +00:00
Kevin Easton 56d5c9e643 Add a "const" qualifier to get rid of some warnings.
(*why* is the return value of inet_ntop() const char *? it just returns a
pointer to the user-supplied char * parameter!)



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@86 13b04d17-f746-0410-82c6-800466cd88b0
2010-06-26 08:01:55 +00:00
Kevin Easton 1a0e5ec166 The /cd command now handles getcwd() failing (eg if the current directory
has been removed).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@85 13b04d17-f746-0410-82c6-800466cd88b0
2010-05-02 08:18:29 +00:00
Kevin Easton 38cd097631 Remove symlinks from repository - not needed, Makefile regenerates 'em.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@84 13b04d17-f746-0410-82c6-800466cd88b0
2010-03-23 14:12:28 +00:00
Kevin Easton 8c099a4ce3 Fix alloca build warnings on freebsd (backport from epic).
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@83 13b04d17-f746-0410-82c6-800466cd88b0
2010-03-07 07:24:12 +00:00
Kevin Easton abb5e06233 Modify the RPL_WHOISACTUALLY numeric handling to work on Bahamut as well.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@82 13b04d17-f746-0410-82c6-800466cd88b0
2009-12-10 13:07:23 +00:00
Kevin Easton 0770358394 Correct misuse of RETURN_STR macro in function_gettmatch.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@81 13b04d17-f746-0410-82c6-800466cd88b0
2009-11-24 12:06:54 +00:00
Kevin Easton 7ac4b8520c Convert my_stricmp, my_strnicmp and wild_match from unsigned char * to char *.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@80 13b04d17-f746-0410-82c6-800466cd88b0
2009-11-24 10:21:30 +00:00
Kevin Easton f8c9021184 Fix minor memory leak in banlist.c:delay_flush_all.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@79 13b04d17-f746-0410-82c6-800466cd88b0
2009-11-18 10:30:46 +00:00
Kevin Easton db57885dfb Fix the definition of AC_CHECK_PLUGIN_SUPPORT in aclocal.m4, which was
making configure break on FreeBSD 9 (reported FreeBSD bitchx port maintainer
cpet <chris@officialunix.com>).



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@78 13b04d17-f746-0410-82c6-800466cd88b0
2009-11-18 10:13:19 +00:00
Kevin Easton b2a282feaa Fix a refcounting issue in the whowas list handling.
When a user in one of the whowas lists rejoins, their entry is removed from
the whowas list (and added to a channel nicklist).  However the count of
entries in the whowas list wasn't being decremented, so eventually the client
thinks the lists are full when they're really empty... at this point only one
user at a time can be in the lists (so /WHOLEFT after a netsplit would only
show one user).



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@77 13b04d17-f746-0410-82c6-800466cd88b0
2009-10-16 12:35:56 +00:00
Kevin Easton cb306c8947 Changelog entry for /hostname fix.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@76 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-27 12:48:25 +00:00
Kevin Easton 4e72a992b4 Fix argument-handling for the /hostname (/irchost) command - now you can do
/hostname 2 instead of /hostname #2.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@75 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-27 12:45:28 +00:00
Kevin Easton eab1834e64 Add 0::1 to list of ipv6 addressed ignored as vhost candidates.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@74 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-27 12:06:31 +00:00
Kevin Easton 5337b226fa Change the handle_server_stats so that the averages (eg. users per
channel) are correctly rounded. Added a divide_rounded() function
that rounds to nearest integer.  This also gets rid of the messy
floating point divisions in that function.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@73 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-22 22:35:23 +00:00
Kevin Easton 0fc23ba148 Reinstate a new version of RPL_WHOISACTUALLY numeric handling.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@72 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-21 14:14:28 +00:00
Kevin Easton 771b2af59d Fixed two places where the client compared the source of a numeric against
get_server_name(from_server) instead of get_server_itsname(from_server) -
this meant that if the client had a different idea of the local server name
from the server (say, if you used a round-robin to connect), then the client
would incorrectly assume the numeric came from a remote server.

The symptoms were:

 * If your local server sent you a "you're not op" type message, BitchX would
report the channel had desynched.

 * If your local server send you a "channel doesn't exist" numeric (eg. if
you typed /mode #nosuchchannel to see if it existed), BitchX would not show
it. 


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@71 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-19 14:24:15 +00:00
Kevin Easton e338d2d9fd Fix the $servernum() function - no matter what string
you gave it, it would return the first server in the list
where server.itsname == server.name, due to a misplaced
variable.  It also returned an empty string for
$servernum(  ) when it should return the current server.

Also removed the useless function_serverport() function -
it was a character-for-character duplicate of
function_servports().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@70 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-17 13:38:09 +00:00
Kevin Easton 4decd6202b Fix snprintf buffer size.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@68 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-08 13:40:45 +00:00
Kevin Easton eb13453e50 Fix snprintf() call in /QUIT to make glibc2.9 happy.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@67 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-08 13:22:27 +00:00
Kevin Easton a6636dd449 Add missing third parameter to open().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@65 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-08 12:44:03 +00:00
Kevin Easton 7a046f56ab Add missing third argument to open().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@64 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-08 12:37:39 +00:00
Kevin Easton ef503e318e Fix .cmsg crash reported by zimzum.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@62 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-02 14:14:21 +00:00
Kevin Easton c0d80d4c8c Merge updated server list from 1.1 branch.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@61 13b04d17-f746-0410-82c6-800466cd88b0
2009-08-15 11:21:48 +00:00
Kevin Easton 1b370475ec Fixed the defaults for JOIN_NEW_WINDOW_TYPE and QUERY_NEW_WINDOW_TYPE.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@59 13b04d17-f746-0410-82c6-800466cd88b0
2009-08-11 14:08:53 +00:00
Kevin Easton 147ea72710 Some cleanups in quit message handling. Fixed a bug where a quit from a user
that isn't in a channel with the client (god knows how *that* happens, but
someone reported the bug...) could crash the client, because a NULL pointer 
is passed to logmsg().  The bug didn't show under glibc because it handles
the NULL pointer OK.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@58 13b04d17-f746-0410-82c6-800466cd88b0
2008-07-07 11:55:00 +00:00
Kevin Easton 8eb0a4fb3d More parantheses to suppress a gcc warning.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@57 13b04d17-f746-0410-82c6-800466cd88b0
2008-07-05 09:52:33 +00:00
Kevin Easton 1cba960190 Cleaned up the handling of channel mode changes a little, including fixing
buggy handling of certain key and limit mode changes.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@56 13b04d17-f746-0410-82c6-800466cd88b0
2008-07-04 09:55:59 +00:00
Kevin Easton 06f23669c6 Fix bug where you got disconnected if the server sent a 464 numeric
(bad password) that the client wasn't expecting.

The most common case is failing a CHALLENGE oper attempt.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@55 13b04d17-f746-0410-82c6-800466cd88b0
2008-07-02 09:48:22 +00:00
Kevin Easton 47e2d446fe Add parantheses to make gcc happy.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@54 13b04d17-f746-0410-82c6-800466cd88b0
2008-06-14 06:57:51 +00:00
Kevin Easton df93dcbbc0 Add /HOP and /DEHOP commands for halfop. Also did a little cleanup around
doop() and dodeop() - they could do with a bit more though.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@53 13b04d17-f746-0410-82c6-800466cd88b0
2008-06-14 06:51:03 +00:00
Kevin Easton 708e4b6f19 Change NICKSORT_OP to NICKSORT_STAT (sorts nicks by channel status -
chanop first, then halops, voices and others).  Added /SCAN -stat
to sort nicks using NICKSORT_OP.  Removed NICKSORT_VOICE - it was broken
anyway.

Removed "scan" plugin, this functionality is now covered by /SCAN -stat.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@52 13b04d17-f746-0410-82c6-800466cd88b0
2008-06-14 06:45:05 +00:00
Kevin Easton 5ecddf62fd Update Changelog for recent commits.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@51 13b04d17-f746-0410-82c6-800466cd88b0
2008-06-12 14:57:03 +00:00
Kevin Easton b5741b6ee2 Add %G (halfop symbol) to the default status line.
Also change the meaning of %= in the status line so that the voice
symbol is shown whether or not the user is opped.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@50 13b04d17-f746-0410-82c6-800466cd88b0
2008-06-12 14:55:00 +00:00
Kevin Easton 62e70f98e2 Add halfop (%) support to the $channel() scripting function.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@49 13b04d17-f746-0410-82c6-800466cd88b0
2008-06-12 14:52:16 +00:00
Kevin Easton b057339be6 Substantial rewrite of /SCAN (do_scan). Now provides total channel nick
count as well as filtered nick count to the header and footer formats -
default header formats updated to show it.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@48 13b04d17-f746-0410-82c6-800466cd88b0
2008-06-12 14:50:45 +00:00
Kevin Easton bca8ce0a1c Fix call to RESIZE.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@47 13b04d17-f746-0410-82c6-800466cd88b0
2008-06-05 14:16:16 +00:00
Kevin Easton 1e81f1ed7b Rework formatting of /NAMES and /SCAN output.
The formatting of /NAMES and /SCAN output has been substantially reworked.
The old /FSETs NAMES_BOTCOLOR, NAMES_FRIENDCOLOR, NAMES_NICKCOLOR,
NAMES_OPCOLOR, NAMES_SHITCOLOR and NAMES_VOICECOLOR have been replaced
with these new /FSETs:

....................NAMES_NICK %B$[10]0
................NAMES_NICK_BOT %G$[10]0
.............NAMES_NICK_FRIEND %Y$[10]0
.................NAMES_NICK_ME %W$[10]0
...............NAMES_NICK_SHIT %R$[10]0
....................NAMES_USER %K[ %n$1-%K]
.............NAMES_USER_CHANOP %K[%C$0%n$1-%K]
..............NAMES_USER_IRCOP %K[%R$0%n$1-%K]
..............NAMES_USER_VOICE %K[%M$0%n$1-%K]

The NAMES_NICK formats control how the nick itself is displayed, depending
on the status of the nick as recognised by BitchX (the priority order is
NAMES_NICK_ME > NAMES_NICK_BOT > NAMES_NICK_FRIEND > NAMES_NICK_SHIT >
NAMES_NICK).  The NAMES_USER formats control how the overall entry appears in
the /NAMES or /SCAN line, depending on the channel status of the nick (the
priority order is NAMES_USER_CHANOP > NAMES_USER_VOICE > NAMES_USER_IRCOP >
NAMES_USER).

You'll need to update any scripts or custom formats that altered the old
formats.  If you just use the defaults, the main difference you'll see is
that your own nick is now shown in white, and voiced users are shown with
the '+' sent by the server instead of the 'v'.  You can go back to the old
look by setting these formats:

/FSET NAMES_NICK_ME %B$[10]0
/FSET NAMES_USER_VOICE %K[%Mv%n$1-%K]



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@46 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-27 04:53:19 +00:00
Kevin Easton 56a414feb6 Spelling fix.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@45 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-15 09:21:40 +00:00
Kevin Easton 0d11b0afbe Modify /scan family of commands. Now shows halfops, /scans for shitlist
works, and a few other changes.  Some things might look a bit hinky,
more work needed.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@44 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-08 14:35:15 +00:00
Kevin Easton 0ce64de737 Show % (halfops) correctly in /names.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@43 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 23:02:29 +00:00
Kevin Easton e10dcbe7e2 If using recursive cparse, a %c character in the format string inserting
a % or $ should quote it (like %s does).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@42 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 23:02:07 +00:00
Kevin Easton dbfde76622 Update Changelog.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@41 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 11:11:41 +00:00
Kevin Easton d809649484 Merge r23 from branches/ircii-pana-1.1
Changes to allow compiling on gcc-4.0.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@40 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 11:07:31 +00:00
Kevin Easton cc9073707e Merge r22 from branches/ircii-pana-1.1
Fix spelling error in dcc.c


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@39 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 11:00:16 +00:00
Kevin Easton ee2fe058c2 Merge r11,r12,r13 from branches/ircii-pana-1.1
Implements new method to find vhosts (fixes CVE-2007-5839).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@38 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 10:57:26 +00:00
Kevin Easton 9beb1dcd55 Merge r6 & r7 from branches/ircii-pana-1.1
This is the convert_output_format_raw changes that fix CVE-2007-4584.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@37 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 10:48:02 +00:00
Kevin Easton a9267d0716 Merge r5 from branches/ircii-pana-1.1 (fixes for CVE-2007-3360).
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@36 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 10:26:50 +00:00
Kevin Easton ec0201e8a5 Update Changelog.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@35 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 09:19:25 +00:00
Kevin Easton 285b02c36a Add $ishalfop(<nick> <channel>) scripting function, as per EPIC.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@34 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 08:48:49 +00:00
Kevin Easton 998453de9f Remove declaration of stpcpy - no code in BitchX uses it.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@33 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 08:46:59 +00:00
Kevin Easton 5bfda51bce Simplify fixes to /fe, /fec (put /fe and /fec back into one loop).
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@32 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 08:38:12 +00:00
Kevin Easton b2bbf82bbf Updated for recent commit.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@31 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-01 08:22:02 +00:00
Kevin Easton a7ba47b046 Rewrite of the /FE scripting function, fixing these four problems:
fe ( x$chr(9)y ) a { echo $a }

(Crashes)

fe ( abc def ) xyz{ echo [$xyz] [$xy] }

(Uses wrong variable name)

fe ( abc def ) x{ echo $x }

(Endless loop)

fe ( abc def ) { echo x }

(Wrong error message)


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@30 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-01 08:20:42 +00:00
Kevin Easton 488475c296 Update for recent commits.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@28 13b04d17-f746-0410-82c6-800466cd88b0
2008-04-30 14:06:56 +00:00
Kevin Easton 49feda0e9d Fix logic of version check on module load.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@27 13b04d17-f746-0410-82c6-800466cd88b0
2008-04-30 13:59:33 +00:00
Kevin Easton 3de93b1dbc Far-reaching changes to make BitchX compatible with 64 bit architectures
like x86-64, where sizeof(int) != sizeof (void *).  This involves correctly
casting every function pointer from the global table to the correct
function type, which has the added benefit of allowing type-checking of
function arguments and return values.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@26 13b04d17-f746-0410-82c6-800466cd88b0
2008-04-30 13:57:56 +00:00
Kevin Easton 7eac4a00ce Roll version number for BitchX 1.2 series.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@25 13b04d17-f746-0410-82c6-800466cd88b0
2008-04-30 13:52:22 +00:00
Kevin Easton 064c9122d0 Rebuild configure from new configure.in.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@21 13b04d17-f746-0410-82c6-800466cd88b0
2008-03-12 13:26:52 +00:00
Kevin Easton 66463933a2 Merge configure changes from ircii-pana-1.1 branch.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@20 13b04d17-f746-0410-82c6-800466cd88b0
2008-03-12 13:26:04 +00:00
Kevin Easton b0d74f970d Merge from ircii-pana-1.1 branch (removal of tparm declaration) - see rev 16
change.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@17 13b04d17-f746-0410-82c6-800466cd88b0
2008-03-10 06:38:25 +00:00
Kevin Easton a1e377fcd5 Add svn keyword expansion to configure.in
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@15 13b04d17-f746-0410-82c6-800466cd88b0
2008-03-08 05:11:07 +00:00
Kevin Easton b2ec9c01bf Fix the test for GCC >= 2.7. This fixes a problem compiling on S390,
apparently.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@9 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-28 12:42:11 +00:00
Kevin Easton 9971c876ed Seed trunk from ircii-pana-1.1 branch.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@4 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-25 09:55:15 +00:00
Kevin Easton 533c3dbcbf Turn on SVN keyword replacement for $Date$, $Author$, $Revision$, $Id$ for all
*.c and *.h files.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/branches/ircii-pana-1.1@3 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-25 09:49:14 +00:00
Kevin Easton 437c3df5fe Seed the ircii-pana-1.1 maintenance branch from the tagged
ircii-pana-1.1-final.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/branches/ircii-pana-1.1@2 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-25 09:32:19 +00:00
Kevin Easton 28febcfea9 Initial import of the ircii-pana-1.1-final source tree.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/tags/ircii-pana-1.1-final@1 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-25 09:25:32 +00:00
272 changed files with 28659 additions and 22954 deletions
+4 -5
View File
@@ -594,13 +594,12 @@ KILL
%gUsage%n: %W/%nkill %Y<%Cnick%Y>%n %R[%nreason%R]%n
%Y*%n Requires irc operator status
- Kills %Y<%Cnick%Y>%n for %R[%nreason%R]%n
If no reason is given, a quote from the random kick file is used
*hopefully in a latter version of BitchX*
If no reason is given, a quote from the random kill file is used
L
See %YLEAVE%n
LASTLOG
%gUsage%n: %W/%nlastlog -file filename%G|%n-clear%G|%n-max #%G|%n
-liternal pat%G|%n-beep%G|%nlevel
-literal pat%G|%n-beep%G|%nlevel
- Shows more than a few pages back
LEAVE
%gUsage%n: %W/%nleave %Y<%Bchannel%Y>%n
@@ -795,10 +794,10 @@ RELCT
- Changes the topic to the last CTCP command issued
RELD
%gUsage%n: %W/%nreld
- Displays the last DCC msg recieved.
- Displays the last DCC msg received.
RELDT
%gUsage%n: %W/%nreldt
- Sets the topic to the last DCC message recieved.
- Sets the topic to the last DCC message received.
RELI
%gUsage%n: %W/%nreli
- Shows the last invite message received
+2
View File
@@ -0,0 +1,2 @@
# You can populate this file for randomly-chosen /KILL reasons.
# $0 is replaced by the target nick and $1 by your nick.
+2 -4
View File
@@ -10,7 +10,7 @@
${a} for president.
${a}: a modern client for a old world
${a}: a modern client for an old world
${a}: a new fragrance for men, by Calvin Klein
${a}: anything else would be uncivilized
${a}: better than a penis enlargement!
@@ -25,14 +25,12 @@ ${a} for president.
${a}: faster than a speeding bullet, more powerful than a locomotive
${a}: fit to feel groovy
${a}: for distribution only with a new PC
${a}: for me to POOP ON!
${a}: good to the last drop!
${a}: it adds that extra uNF to your sex life!
${a}: it does a body good
${a}: it isn't only my script, it's also my client
${a}: it keeps going and going and going and going and...
${a}: it makes bath-time lots of fun!
${a}: it tastes like poo
${a}: it won't get you laid
${a}: it'll get you in, out and on with life.
${a}: it's all day strong, all day long
@@ -84,7 +82,7 @@ ${a} for president.
${a}: the IRC client with hair on its balls
${a}: the NEW form of birth control!
${a}: the new hardcore, psycho, nitro client -- in a can
${a}: the official IRC client of the 2004 Olympic Games
${a}: the official IRC client of the ${((strftime(%Y)+3)/4)*4} Olympic Games
${a}: the ONLY bug-free client
${a}: the ONLY IRC client on Viagra!
${a}: the ONLY three day cure!
-7
View File
@@ -1,7 +0,0 @@
Under UNIX SV we need to change include/irc.h and remove
#include <arpa/inet.h> from the file. This causes a couple of new
warnings in dcc.c to appear, but everything works as advertised.
HPUX seems to have some header files problems.
in particular. #include <sys/types.h> can't be included before #include
<time.h> or #include <sys/time.h>
+1 -1
View File
@@ -6,7 +6,7 @@
* Copyright 1994 Jake Khuon.
* Copyright 1995, 1998 Jeremy Nelson and others ("EPIC Software Labs").
* Copyright 1996-2004 Colten Edwards et al.
* Copyright 2008-2012 Kevin Easton et al.
* Copyright 2008-2014 Kevin Easton et al.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
+407 -9
View File
@@ -1,18 +1,416 @@
[Changes 1.2-final]
* Fix ANSI color support in terminal emulators. (sbalneav, VICODAN)
[Changes 1.2.2]
* Add SASL support (flashback, VICODAN)
* Bump MAXPARA (maximum protocol message arguments) to 20 as per EPIC5. (caf)
* Update README and install files (VICODAN)
* Correctly handle a last argument prefixed with : for any protocol message,
for compatibility with inspircd. Reported by trn. (caf)
* Fix compilation on FreeBSD 10 (cpet)
* Fix SHOW_AWAY_ONCE so it shows away message if the nick has changed. (caf)
* Fix compilation errors on cygwin (VICODAN, soreau)
* Handle 301 numeric with missing message argument. Reported by trn. (caf)
[Changes 1.2c02]
* Bump the version to 1.2c02 and remove the svn from the version
* Display "Servers exhausted. Restarting." message at the right time. (caf)
[Changes 1.2c01]
* Fix bug where the initial server connection was only retried one less than
MAX_SERVER_RECONNECT times. (caf)
* Improve error messages for SSL connection failures. (caf)
* Correctly handle reconnection after failure of SSL connection setup.
Reported by g0z. (caf)
* Add /EXEC -WINTARGET <target> argument. (caf)
* Update command-line help text to explain server descriptions.
Reported by Ant. (caf)
* Replace last uses of bcopy() with memcpy(). (caf)
* Fix /HISTORY *pattern* and /HISTORY -CLEAR. (caf)
* Fix /SET TAB OFF. (caf)
* Count columns used by ND_SPACE character when splitting lines. (caf)
* Use target window width rather than terminal width to wrap /list -wide
output. (caf)
* Change arcfour example module to use ARC4CHAT instead of SCHAT as the DCC
type (SCHAT is already used by some other clients for SSL CHAT). (caf)
* Fix various problems with adding and removing module DCC bindings. The
same DCC type cannot be bound by more than one module simultaneously. The
remove_all_dcc_binds() function now only removes all DCC bindings for the
given module. (caf)
* Fix crash when unloading the arcfour module. (caf)
* Change add_dcc_bind() to collect all function pointer arguments into a
single struct. (caf)
* Fix redirecting to DCC CHATs with /REL* commands. (caf)
* Update arcfour example module to use exported dcc_chat_socketread()
callback. (caf)
* Export dcc_chat_socketread() and dcc_send_socketread() callbacks to modules,
so that modules implementing new DCC types can use these. (caf)
* Only echo sent WALLOPS if we are _not_ +w, because otherwise the server will
echo it to us anyway. (caf)
* Fix problem where reconnecting to SSL servers could stall. (caf)
* Fix memory leak when reconnecting to SSL servers. (caf)
* Add SSL version and cipher to SSL connect message. (caf)
* Add BITCHXRC_NAME to config.h. (caf)
* Correctly handle case when a nick comes between a -s flag and a server name
on the command line (reported by gauze). (caf)
* Show correct count of matching commands in /HELP. (caf)
* Simplify rsindex() and strsearch() exported functions. (caf)
* scr-bx now lists the detached screens if there is more than one that matches
the string supplied by the user. (caf)
* Rename exported function move_to_abs_word() to move_to_word(). (caf)
* Make "You can't hide an invisible window" message respect
/SET WINDOW_QUIET. (caf)
* Allow $mychannels() to query a window attached to a different server. (caf)
* Fix crash when passing $mychannels() a non-existent window refnum. (caf)
* Remove dll_functions, dll_numeric, dll_commands, dll_variable, dll_ctcp,
and dll_window variables from the module exports table. (caf)
* Add save_dllvar() function exported to modules, and switch cavlink
and nap plugins to use it. (caf)
* Shitlist level 3/4 should kick regardless of /CSET KICK_IF_BANNED.
Reported by Ancient. (caf)
* Correct spelling of some client messages. (gdinit)
* Support fractional-second intervals on recurring timers. (caf)
* Change $geom() to return current screen's geometry, not the original
terminal's. (caf)
* Fix $statsparse() scripting function to handle right-justified status
formats correctly and improve efficiency of all status formatting. (caf)
* Restore terminal settings after flushing output, not before. (caf)
* Remove exported function create_server_list(). (caf)
* Fix $myservers(1) to only return registered server refnums, so it now
works the way EPIC does which was always the intention. (caf)
* Fix CHANGE_NICK_ON_KILL feature. (caf)
* Improve error handling in /READLOG. (caf)
* Fix memory leak in /QUEUE -FLUSH. (caf)
* Messages sent by /SV and /PASTE should be logged in the send log. (caf)
* Change send_text() to combine command, hook and log arguments into one
set of flags. (caf)
* Update to build against modern libtcl (don't access tcl_interp->result
directly). (caf)
* Add /FSET SEND_ENCRYPTED_PUBLIC format. (caf)
* Correct order of arguments to /FSET SEND_ENCRYPTED_MSG and
SEND_ENCRYPTED_NOTICE and improve default formatting. (caf)
* Add /FSET ENCRYPTED_PUBLIC and ENCRYPTED_PUBLIC_NOTICE formats, and fix
use of ENCRYPTED_PRIVMSG and ENCRYPTED_NOTICE so they use the right number
of arguments. (caf)
* Move all handling of SED messages and notices into ctcp.c, re-enable
SED notices. (caf)
* Handle SED-encrypted CTCP replies properly. (caf)
* Add sent_nick flag to NickList struct, bump MODULE_VERSION. (caf)
* Write correct length to terminal for unflash sequences. (caf)
* Update source file dependencies in Makefile.in. (caf)
* Remove unused opendir.c. (caf)
* Remove unused scandir() compat implementation. (caf)
* Use the same compat.o and ircsig.o object files for the wserv and scr-bx
binaries as for the main binary. (caf)
* Simplify handling of /DETACH socket path. (caf)
* Remove netfinger client code (no-one is running fingerd anymore) and
repurpose /FINGER command to send a CTCP FINGER instead. (caf)
* Enable use of cached whowas info for /IG* and /UNIG* commands. (caf)
* Add support for OpenSSL 1.1.0 to configure script. (caf)
* /UNBAN <nick> can use cached whowas info to unset bans. (caf)
* Unsetting CMDCHARS sets it back to the default. (caf)
* Fix a double-free bug when a window on an alternate screen queries an exec
process. (caf)
* Use 127.0.0.1 for wserv socket, which fixes /WINDOW CREATE with IPv6. (caf)
* Allow INVITE and WALLOP floods to trigger auto-ignore. (caf)
* Change $indextoword() so that the return value numbers the words from 0
rather than 1, to align with documentation and EPIC4/5. (caf)
* Correct issue where flood detection could become unreliable. (caf)
* Cast check_ext_mail and check_ext_mail_status function pointers to the
correct type before using them. This might have caused a problem with
the qmail plugin on 64 bit architectures. (caf)
* Fix bug in DCC privileged port detection logic. (caf)
* Don't show DCC "Handshake failed" message twice, improve the message itself
and use the same one for privileged port / zero address. (caf)
* Use the same format in /DCC LIST for all waiting offers and tweak
the DCC_BAR_TYPE 1 format to show DCC state. (caf)
* Correctly show time since offer for DCC CHAT offers in /DCC LIST. (caf)
* Improve completion bar for /SET DCC_BAR_TYPE 1 so that it always matches
the completion percentage. (caf)
* Correctly align formatting of /DCC LIST line for /SET DCC_BAR_TYPE 1. (caf)
* Act on channel mode lock as half-op. (caf)
* Fix crash and memory leak in $aliasctl(COMMAND MATCH). (caf)
* Fix memory leaks in /CDCC PLIST and /CDCC NOTICE. (caf)
* Rename reserved identifiers from irc_std.h to fix building on under
latest cygwin. (caf)
* Ensure /BAN /DBAN /MB /MK /MUB /UNBAN commands send command to the right
server. (caf)
* Fix "implied" operators (eg. += ) under NEW_MATH. (caf)
* Add /SCANB command to scan for users on the userlist with the BOT flag. (caf)
* Wire up /FSET WHOIS_BOT for users on the userlist with the BOT flag. (caf)
* Use /FSET RELSN to format /RELSN relayed messages instead of
/FSET SEND_NOTICE. (caf)
* Change formatting of /FSETs SERVER_NOTICE_KLINE and SERVER_NOTICE_GLINE
to show the ban type, and improve formatting of SERVER_NOTICE_CLIENT_CONNECT
and SERVER_NOTICE_CLIENT_EXIT. (caf)
* Clean up handling of oper server notices, including removing some
obsolete notice types (eg "high-traffic mode"). (caf)
* Unify handling of SWATCH NONE between OperView and non-OperView. (caf)
* Don't double-up server notices in the /RELS list. (caf)
* Don't fire the SERVER_NOTICE hook more than once per notice. (caf)
* Fix display of the OperView SWATCH flags variable. (caf)
* Update default /fset SERVER_NOTICE value to remove extra space. (caf)
* Treat all NOTICEs before registration as local server notices. (caf)
* Add /on NOTICE_GROUP and /fset NOTICE_GROUP analogous to MSG_GROUP. (caf)
* Add configure check for <sys/sockio.h>. (caf)
* Improve /WINDOW DESCRIBE output a little. (caf)
* If we can't create a socket for the first address returned by getaddrinfo(),
try the other returned addresses. (caf)
* Only show version once with -v option (reported by cpet). (caf)
* Drop group privileges before droppping user privileges when execing. (caf)
* Apply patch from cpet to make autogen.sh prompt to run configure. (caf)
* Improve some messages in /window size (reported by cpet). (caf)
* Improve messages around DCC auto-get / auto-rename / auto-resume. (caf)
* Fix spelling of "receive" in all client output. (caf)
* Ignore DCC ACCEPT if RESUME wasn't requested. (caf)
* Fix /KB so that it kicks-then-bans as intended (reported by profiler). (caf)
* Fix $functioncall() scripting function (reported by |Rain|). (caf)
* Ensure close_server() clears the internal command queues for the right
server. (caf)
* Remove obsolete AIM plugin. (caf)
* Tighten up the handling of channel WALLs. (caf)
* Don't mangle ANSI sequences in NOTICEs. (caf)
* Use BitchX.kill in all cases for random /KILL messages, and install a
copy of this file. (caf)
* Fix potential crash in /unban, and change it so that it correctly matches
the user@ portion of the hostmask. (caf)
* Clean up the build by fixing up the (unsigned char *) / (char *) mismatches
that the compiler warns about. (caf)
* Fix bxconfigure crashing on very wide terminals (reported by cpet). (caf)
* Remove obsolete Chatnet 310 numeric support (WANT_CHATNET). (caf)
* Rework the lag check to make it simpler and more reliable. This adds
a /set LAG_CHECK_INTERVAL to control the frequency of lag checks. (caf)
* Minor fixes to enable compiling against TCL8.5. (caf)
* Wire up /set DOUBLE_STATUS_LINE (reported by presi). (caf)
* Fix ignoring of nick changes. (caf)
[Changes 1.2.1]
* Prefer <fcntl.h> over <sys/fcntl.h> (reported by ncopa). (caf)
* Fix overflow in say() when handling a maximum-length client message. (caf)
* Remove WANT_CHAN_NICK_SERV define and include network services commands
by default. (caf)
* Pass through externally-provided CPPFLAGS (reported by cpet). (caf)
* Don't set the mode on new channels until synched - this speeds up joining
lots of channels at connect time if one of them is new, and reduces the
chance of being flooded off the server. (caf)
* Correctly handle channel sync across multi-server. (caf)
* Fixes and improvements for channel logging. (caf)
* Use correct (MODECHAN and MODEUSER) display level for channel and user
modes. (caf)
* Allow %- status format to handle max-length topics (reported by oxy). (caf)
* Add /FSET WOHIS_LOGGEDIN for services login info on hybrid, ratbox and
ircu. (caf)
* Add sanity checking of incoming nicknames. (caf)
* /MV (massvoice) shouldn't send +v for already-voiced users. (caf)
* Fix lag check on recent 32 bit OpenBSD / NetBSD (reported by DJ). (caf)
* Fix key bindings that terminate with ^. (caf)
* Fix the $timer() scripting function. (caf)
* Fix the /TKB (timed kickban) command. (caf)
* Rewrite termcap/terminfo detection logic in configure and include term.h
in term.c for the system definition of tparm(). This fixes a crash on
NetBSD x86-64 (reported by jeezy), and should also ensure that terminfo
is used in preference to termcap on NetBSD. (caf)
* Fix output when built against termcap. (caf)
* Fix STATUS_NOTIFY so that it appears in the right window. (caf)
* Improve robustness of status formats handling. (caf)
* Use system setenv() in preference to compat bsd_setenv(). (caf)
* Allow selection of alternate hashing methods with $crypt(). (caf)
* Improve the initial seeding of the randm() fallback RNG. (caf)
* Strengthen the cookie generation algorithm for /detach. (caf)
* RANDOM_SOURCE now only affects the rand() scripting function. (caf)
* Make RANDOM_LOCAL_PORTS actually random. (caf)
* Show same message on local terminal as used in emergency exit QUIT. (caf)
* Remove unused XLINK CTCP reply handler. (caf)
* Ensure add_socketread() doesn't leak file descriptors. (caf)
* Fix listing bans on local channels (/BANS &channel). (flashback)
* Fix unbanning by number (/UNBAN #channel #number). (caf)
* Improve the list_channels() function. (caf)
* Use socklen_t instead of plain int where available. (flashback)
* Use <termios.h> in preference to <sys/termios.h> where it's available. (caf)
* Skip malformed abots.sav entries in read_abot(), avoiding null
dereferences found by Coverity. (flashback)
* Ensure proper handling of % when /FSET DCC is used. (caf)
* Improve robustness of CDCC save file loading. (caf)
* Fix open file leak in /LASTLOG found by Coverity. (caf)
* Fix file descriptor leak on SOCKS4 connection failure found by
Coverity. (caf)
* Fix out-of-bounds error in cryptit() found by Coverity. (flashback)
* Cleanup save_formats(). (caf)
* Fix off-by-one error in add_socketread() and set_socketwrite() found
by Coverity. (caf)
* Fix longstanding bug with ordering of rfc1459[] array. (caf)
* Fix crash after /SETAR -, reported by riderplus. (caf)
* Remove special handling of 484 numeric, which is no longer needed and
was buggy (making BitchX think that usermode +G was set). (caf)
* Add /OBITS command, shows obituaries for some BitchX friends. (caf)
* Fix abuses of the RESIZE macro. Reported by nenolod. (caf)
* Clears up a crash and some build warnings in the acro plugin. (caf)
* Applied patches from jdhore to clean up the plugin building
and installing process. (caf)
* Fix building on newer Cygwin (reported by VICODAN). (caf)
* Fix building plugins on FreeBSD-10 (reported by cpet). (caf)
* Messages sent to channels should use lastlog level PUBLIC, not MSG. (caf)
+46 -68
View File
@@ -1,54 +1,44 @@
Installation Instructions for BitchX 1.2-Final
Installation Instructions for BitchX 1.2
BitchX is known to compile on the following systems (maybe others as well):
* BSDI 2.0, 2.1, 3.1, 4.0
* FreeBSD 2.x, 3.x, 4.0 and above
* NetBSD 3.x, 4.x
* FreeBSD 2.x and above
* NetBSD 3 and above
* OpenBSD 2 and above
* SunOS 4.1.4, 5.x and above
* Linux (All)
* Mac OSX (All)
* IRIX 5, 6
* HP-UX 9.x, 10.x
* OSF/1 (DEC Alpha)
* Ultrix
* AIX
* OS/2 (with EMX)
* Windows 9x/2000/NT/XP/Vista/7 (with Cygwin)
* Windows 9x/2000/NT/XP (with Cygwin)
* QNX
As of April 2012 BitchX is now officially included in Fedora Linux 15,16,17,18
BitchX is also in the Red Hat EPEL repos (Extra Packages for Enterprise Linux).
To install on Fedora simply type "yum install BitchX" as root.
It is also included in the FreeBSD ports tree.
Introduction:
Problems may occur during the compilation process of BitchX. If
you do have a problem, please check http://github.com/BitchX/BitchX1.2/wiki
which has instructions on compilations. If you still need help please gather
as much information about the error (*FULL* output of "configure and "make")
and join #BitchX on freenode or EFNet.
BUGS:
Please submit bugs here: http://github.com/BitchX
Problems may occur during the compilation process of BitchX. Some common
problems are described below under "Compile Problems". If you do have a
problem you can't resolve, please gather as much information about the error
(*FULL* output of "make") and join #BitchX on EFNet, or use the Sourceforge
page at http://sourceforge.net/projects/bitchx/.
Several script writers tend to hang in the #BitchX on EFNet to
distribute their work to others. http://www.bitchx.ca/scripts is a great place
where scripts can be found. You can also check out the scripting forum at the
distribute their work to others. scripts.bitchx.org is a great place where
scripts can be found. You can also check out the scripting forum at the
previously mentioned forums site.
Some features will only work with certain servers -- IRCUMODE and
/4OP for example. Therefore, servers such as UnderNet, DalNet, and NewNet,
to name a few, will not respond to the user modes given. Scripts can cause
problems as well, usually due to bugs within the script. If there is a
known bug in the client, please contact the appropriate people, panasync
known bug in the client, please contact the appropriate people, caf
or any of the non-idling ops in #BitchX. If the bug can be reproduced
faithfully, then we have enough to determine how it can be resolved.
Please check out the wiki at http://www.github.com/BitchX/BitchX1.2/wiki
if you should have any troubles compiling. A number of common mistakes and problems
users run into are posted in the FAQ and sometimes on the Forums as well.
Please check out the FAQ at http://wiki.bitchx.org/faq:start if you
have any trouble compiling. A number of common mistakes and problems
users run into are posted in the FAQ.
Compiling BitchX:
@@ -68,11 +58,11 @@ are marked with an asterisk, "*")
options that can be given to "configure". "configure --help" will detail
all of them. Using at least "configure --with-plugins" is recommended
if you plan on using one or more of the many plugins that are
distributed with BitchX. Add "--with-gtk" if you have gtk and gnome-libs
and would like a graphical client. Add "--with-tcl" if you want Tcl script
support on i386 systems (Note: most users do not need this). tcl.o for
other architecures may be available on BitchX FTP sites. The source code
for tcl.o is not publically available.
distributed with BitchX. Add "--with-tcl" if you want Tcl script
support (Note: most users do not need this).
If you are not root, pass the --prefix=$HOME option to have BitchX
install to your home directory.
* 3) "include/config.h" may need tweaking if you intend to change the
default server list. To change, locate "DEFAULT_SERVER" and remove the
@@ -81,52 +71,40 @@ are marked with an asterisk, "*")
list). Alternatively, you can run "make bxconf" and use the graphical
configuration utility to change many of BitchX's options.
4) Execute "make" inside the BitchX directory. If any error messages are
shown (Error, *not* Warning messages!!!) that you are unable to resolve
on your own, seek help. "README" has more information on where you can go
for help.
4) Execute "make" inside the BitchX directory (on BSD-based platforms, use
"gmake" instead). If any error messages are shown (Error, *not* Warning
messages!!!) that you are unable to resolve on your own, seek help.
"README" has more information on where you can go for help.
* 5) Edit "include/defs.h". On some systems, configure may not properly
determine one or two definitions ("#define foo"). Search for
offending defines which cause make not to proceed compiling.
Usually, there should be a "#define" or "#undef" located on the line
make has shown. A reversal of the definition (change "#define" to
"#undef", or vice versa). Go on to step 6 once you have completed
this step. If problems still persist, see "README" for information on
where you can go for help. Note: DOING THIS STEP IS NOT RECOMMENDED.
If "configure" fails to properly define something for whatever reason,
PLEASE REPORT THIS AS A BUG to the current configure script maintainer
(see "README" for details), rather than trying to edit "include/defs.h"
by hand.
5) Execute "make install" (on BSD-based platforms, use "gmake install"
instead). This should install the BitchX binary to /usr/local/bin, or
to $HOME/bin if you supplied the "--prefix=$HOME" option in step 2.
* 6) Debugging information may be left into the compiled binary, so a
"strip source/BitchX" solves the rather large size seen previously.
However, "make install" (Step 7) should strip the binaries for you.
Users without superuser access will typically see a "permission denied"
error here if they try to install to the default prefix.
7) Execute "make install". This should install the BitchX binary to
"/usr/local/bin". Commonly, users may not have superuser access, thus a
refusal ("permission denied" message) will occur. If you still insist on
using "make install" to install BitchX, it is required that you change
the installation path defined in step 4 by using
"configure --prefix=/home/johndoe", for example, or use
"make install_local" to install the binary to your home directory.
However, it is recommened that you use the "--prefix=" method if you wish
to have a full BitchX installation with all of the help files installed.
Compile Problems:
* 8) It is not a requirement to use function-filled scripts with BitchX,
because the aim of BitchX is to create a scriptless client, or more
appropriately, a client less dependant upon scripts. With the development
of BitchX, scripts will become quickly outdated due to the
incompatibility caused by new commands, hooks, or hardcoded replacements
for a function in the script. This is merely a warning.
BitchX requires either the terminfo or termcap terminal-handling library.
This is commonly provided by the ncurses package, so if you get the error:
Cannot find terminfo or termcap - try installing the ncurses-dev / ncurses-devel package.
..then you should try to find the ncurses development package for your OS.
Some examples of what this package may be called:
Debian, Ubuntu: libncurses5-dev
Fedora, CentOS, OpenSuSE: ncurses-devel
Cygwin: libncurses-devel
--
Last Updated:
Dan Mashal
dan408@bitchx.ca
caf
caf@bitchx.org
January 7th, 2017
Previous authors:
Rob Andrews aka sin 03/26/2004
Rob Andrews <sin@bitchx.org>
David Walluck
BarK0de
BlackJac
-5
View File
@@ -1,5 +0,0 @@
SHELL = /bin/sh
default:
$(SHELL) ./configure --with-plugins
+43 -34
View File
@@ -61,7 +61,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -92,6 +92,7 @@ DEFAULT_MSGLOGFILE = @DEFAULT_MSGLOGFILE@
DEFAULT_BITCHX_HELP_FILE = @DEFAULT_BITCHX_HELP_FILE@
DEFAULT_SCRIPT_HELP_FILE = @DEFAULT_SCRIPT_HELP_FILE@
DEFAULT_BITCHX_KICK_FILE = @DEFAULT_BITCHX_KICK_FILE@
DEFAULT_BITCHX_KILL_FILE = @DEFAULT_BITCHX_KILL_FILE@
DEFAULT_BITCHX_QUIT_FILE = @DEFAULT_BITCHX_QUIT_FILE@
DEFAULT_BITCHX_IRCNAME_FILE = @DEFAULT_BITCHX_IRCNAME_FILE@
@@ -180,10 +181,14 @@ MFLAGS = \
## Makefile starts here.
all: Makefile .config.h $(_VERSION_) @EXTRAS@ dll done
all: source_all dll
@echo
@echo Now type \"$(MAKE_BIN) install\" to install $(_VERSION_) globally \(if you\'re root\), or
@echo else you can type \"$(MAKE_BIN) install_local\" to install $(_VERSION_) to your home
@echo directory.
.config.h:
@if test ! -f $(topdir)/.config.h ; then touch $(topdir)/.config.h; fi
touch $@
install: all installbin installdll installscript installman installhelp \
installtranslation reallydone
@@ -192,29 +197,40 @@ installeverything: install
everything: all
source_all: .config.h
@cd source && $(MAKE) all
$(_VERSION_): .config.h
cd source \
&& $(MAKE) all
@cd source && $(MAKE) $(_VERSION_)
dll/dummy:
dll: .config.h
@cd dll && $(MAKE) all
dll: .config.h Makefile dll/Makefile dll/dummy
cd dll \
&& $(MAKE) all
installdll: Makefile dll/Makefile installdirs dll
installdll: $(srcdir)/Makefile dll/Makefile installdirs dll
cd dll \
&& $(MAKE) 'DESTDIR=$(DESTDIR)' install
installdll_local: Makefile dll/Makefile
installdll_local: $(srcdir)/Makefile dll/Makefile
cd dll \
&& $(MAKE) 'PLUGINDIR=$(local_dir)/.BitchX/plugins'
installhelp: installdirs
cd $(top_srcdir)/bitchx-docs && \
find . -name .svn -prune -o -print | cpio -pdmu -R `id -un`:`id -gn` "$(DESTDIR)$(HELPDIR)"
(find "$(DESTDIR)$(HELPDIR)" -type f ! -name '*.bz2' ! -name '*.gz' | \
(xargs bzip2 -9f || xargs gzip -9f) || :) 2>/dev/null
for d in `find . -name .svn -prune -o -type d ! -name . -print`; do \
umask 022 && ../mkinstalldirs "$(DESTDIR)$(HELPDIR)/$$d"; \
for f in "$$d/"*; do \
if test -f "$$f"; then \
$(INSTALL_DATA) "$$f" "$(DESTDIR)$(HELPDIR)/$$d"; \
fi; \
done; \
done
for f in $(top_srcdir)/bitchx-docs/*; do \
if test -f "$$f"; then \
$(INSTALL_DATA) "$$f" "$(DESTDIR)$(HELPDIR)"; \
fi; \
done;
-(find "$(DESTDIR)$(HELPDIR)" -type f ! -name '*.bz2' ! -name '*.gz' | \
(xargs bzip2 -9f || xargs gzip -9f)) 2>/dev/null
installbin: installirc @INSTALL_EXTRAS@
@@ -226,6 +242,7 @@ installirc: installdirs $(_VERSION_)
$(INSTALL_DATA) $(top_srcdir)/BitchX.ircnames $(DESTDIR)$(IRCLIB)/$(DEFAULT_BITCHX_IRCNAME_FILE)
$(INSTALL_DATA) $(top_srcdir)/BitchX.quit $(DESTDIR)$(IRCLIB)/$(DEFAULT_BITCHX_QUIT_FILE)
$(INSTALL_DATA) $(top_srcdir)/BitchX.reasons $(DESTDIR)$(IRCLIB)/$(DEFAULT_BITCHX_KICK_FILE)
$(INSTALL_DATA) $(top_srcdir)/BitchX.kill $(DESTDIR)$(IRCLIB)/$(DEFAULT_BITCHX_KILL_FILE)
$(WINNT_INSTALL)
install_local: all local_installdirs installdll_local
@@ -236,20 +253,19 @@ install_local: all local_installdirs installdll_local
$(INSTALL_DATA) $(top_srcdir)/BitchX.ircnames $(DEFAULT_CTOOLZ_DIR)/$(DEFAULT_BITCHX_IRCNAME_FILE)
$(INSTALL_DATA) $(top_srcdir)/BitchX.quit $(DEFAULT_CTOOLZ_DIR)/$(DEFAULT_BITCHX_QUIT_FILE)
$(INSTALL_DATA) $(top_srcdir)/BitchX.reasons $(DEFAULT_CTOOLZ_DIR)/$(DEFAULT_BITCHX_KICK_FILE)
$(INSTALL_DATA) $(top_srcdir)/BitchX.kill $(DEFAULT_CTOOLZ_DIR)/$(DEFAULT_BITCHX_KILL_FILE)
wserv: .config.h $(srcdir)/source/wserv.c $(srcdir)/source/term.c Makefile
cd source \
&& $(MAKE) wserv
wserv:
@cd source && $(MAKE) wserv$(EXEEXT)
scr-bx: .config.h $(srcdir)/source/scr-bx.c $(srcdir)/source/term.c Makefile
cd source \
&& $(MAKE) scr-bx
scr-bx:
@cd source && $(MAKE) scr-bx$(EXEEXT)
installwserv: installdirs wserv
$(INSTALL) source/wserv $(DESTDIR)$(INSTALL_WSERV)
$(INSTALL) source/wserv$(EXEEXT) $(DESTDIR)$(INSTALL_WSERV)
installscr-bx: installdirs scr-bx
$(INSTALL) source/scr-bx $(DESTDIR)$(INSTALL_SCRBX)
$(INSTALL) source/scr-bx$(EXEEXT) $(DESTDIR)$(INSTALL_SCRBX)
installscript: installdirs
-@( \
@@ -297,7 +313,7 @@ local_installdirs:
config: bxconf
bxconf: Makefile $(srcdir)/bx-conf/Makefile.in
bxconf: $(srcdir)/Makefile $(srcdir)/bx-conf/Makefile.in
cd bx-conf \
&& $(MAKE) all
$(topdir)/bxconfigure || :
@@ -311,7 +327,7 @@ distclean: clean
-@(if test -f source/Makefile; then cd source; $(MAKE) distclean; fi)
-@(if test -f dll/Makefile; then cd dll; $(MAKE) distclean; fi)
-@(if test -f bx-conf/Makefile; then cd bx-conf; $(MAKE) distclean; fi)
-$(RM) config.status
-$(RM) config.status configure.lineno
-$(RM) config.cache config.log stamp-h stamp-h[0-9]*
-$(RM) include/defs.h include/sig.inc
-$(RM) *~ *.rej core *.orig .#*
@@ -321,8 +337,7 @@ distclean: clean
-$(RM) script/.#* macros/.#* translation/.#*
-$(RM) doc/*~ doc/BitchX.bat *.spec
-$(RM) Makefile
-$(CP) $(top_srcdir)/doc/Makefile $(top_srcdir)/Makefile
-$(CP) $(top_srcdir)/doc/Makefile Makefile
-$(RM) .config.h
export: distclean
$(top_srcdir)/autogen.sh || :
@@ -383,18 +398,12 @@ $(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in
cd $(top_srcdir) && autoheader
@mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in
done:
@echo
@echo Now type \"$(MAKE_BIN) install\" to install $(_VERSION_) globally \(if you\'re root\), or
@echo else you can type \"$(MAKE_BIN) install_local\" to install $(_VERSION_) to your home
@echo directory.
reallydone:
@echo
@echo $(_VERSION_) is now installed.
@echo Type \"$(INSTALL_IRC)\" to start.
.PHONY: clean done reallydone installdirs local_installdirs
.PHONY: clean all source_all dll $(_VERISON_) scr-bx wserv reallydone installdirs local_installdirs
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+111
View File
@@ -0,0 +1,111 @@
BitchX 1.2.1 README
===================
BitchX is a free software text-based IRC (Internet Relay Chat) client for
UNIX-like systems, originally based on ircII and heavily influenced by
EPIC. This is the release notes for the 1.2.1 release.
I'd like to send out a special thanks to all those who've contributed in
a large or small way to the BitchX 1.2.1 release, whether through bug reports,
patches, testing, coding, packaging, updating documentation, maintaining
IRC channels or websites, promotion or just keeping the faith:
flashback, Xavier, panasync, dialtone, sideshow, hop, Ancient, fudd, tau,
dan408, cpet, jeezy, zimzum, t3gah, darkfires, gauze, madsage, snadge,
packet, nyet, brabes, nenolod, jdhore, riderplus, DJ, oxy, ncopa.
This release has primarily focussed on fixing a lage number of bugs and
updating the code to suit a modern environment - the full list of changes is
in the Changelog. Notable changes in the 1.2.1 release that are particularly
user-visible or of interest to scripters are explained below.
Instructions on building and installing the client are in the INSTALL file,
and licensing info is found in the COPYRIGHT file.
The BitchX 1.2 series is dedicated to void. We'll miss you, man.
- caf
/NAMES and /SCAN
----------------
The formatting of /NAMES and /SCAN output has been substantially reworked.
The old /FSETs NAMES_BOTCOLOR, NAMES_FRIENDCOLOR, NAMES_NICKCOLOR,
NAMES_OPCOLOR, NAMES_SHITCOLOR and NAMES_VOICECOLOR have been replaced
with these new /FSETs:
....................NAMES_NICK %B$[10]0
................NAMES_NICK_BOT %G$[10]0
.............NAMES_NICK_FRIEND %Y$[10]0
.................NAMES_NICK_ME %W$[10]0
...............NAMES_NICK_SHIT %R$[10]0
....................NAMES_USER %K[ %n$1-%K]
.............NAMES_USER_CHANOP %K[%C$0%n$1-%K]
..............NAMES_USER_IRCOP %K[%R$0%n$1-%K]
..............NAMES_USER_VOICE %K[%M$0%n$1-%K]
The NAMES_NICK formats control how the nick itself is displayed, depending
on the status of the nick as recognised by BitchX (the priority order is
NAMES_NICK_ME > NAMES_NICK_BOT > NAMES_NICK_FRIEND > NAMES_NICK_SHIT >
NAMES_NICK). The NAMES_USER formats control how the overall entry appears in
the /NAMES or /SCAN line, depending on the channel status of the nick (the
priority order is NAMES_USER_CHANOP > NAMES_USER_VOICE > NAMES_USER_IRCOP >
NAMES_USER).
You'll need to update any scripts or custom formats that altered the old
formats. If you just use the defaults, the main difference you'll see is
that your own nick is now shown in white, and voiced users are shown with
the '+' sent by the server instead of the 'v'. You can go back to the old
look by setting these formats:
/FSET NAMES_NICK_ME %B$[10]0
/FSET NAMES_USER_VOICE %K[%Mv%n$1-%K]
Also, the NAMES header and NAMES_FOOTER formats are now called with $3 set
to the total number of nicks in the channel, and $4 to the mask given to
/SCAN (if any).
/SCAN now supports a new sort flag "-stat", which sorts the output by
channel status (chanops, then halfops, then voices, then the riff-raff).
This functionality was previously provided by the "scan" plugin, so this
plugin has been removed. If you want this to be the default, just set this
alias (the double-slash is necessary):
/ALIAS SCAN { //SCAN -STAT }
NEW FORMATS
-----------
In addition to the new NAMES_* formats mentioned above, these new /FSET
formats have been added:
CHANNEL_URL
USERMODE_OTHER
WHOIS_CALLERID
WHOIS_SECURE
WHOIS_LOGGEDIN
HALF-OP SUPPORT
---------------
New commands /HOP and /DEHOP have been added, to give and remove halfop
status (on servers that support it).
The scripting function $ishalfop(<nick> <channel) has been added (compatible
with EPIC), and support for halfops has been added to $channel().
The default status bar now shows your halfop status against your nick.
TCL
---
panasync OK'd releasing the tcl.c source, so this is now part of the main
client distribution. If you want TCL support, just pass --with-tcl to
./configure.
MULTISERVER
-----------
The "last nick sent to" and "last nick received from" are now tracked
per-server, so $. $, $B and the "." and "," message targets are all
per-server.
-54
View File
@@ -1,54 +0,0 @@
BitchX-1.1-Final Readme file by sin <sin@bitchx.org>
======================================================
BitchX is an IRC (Internet Relay Chat) client by Colten Edwards aka
panasync@efnet. BitchX was originally based on ircII 2.8, but is currently
based on the ircii-EPIC4 releases by Jeremy Nelson.
BitchX was originally started as a script by Trench and HappyCrappy
for the popular UNIX IRC client ircII. Around Christmas of 1994 the
script was patched directly into the client by panasync.
Now in 2004 we are looking to revive the development of the client by merging
it back to the current release of Epic and cleaning some of the features
that are no longer needed or supported and moving on with the building of
a whole new client. 10 years of BitchX and we're not nearly done yet.
The new client will be based upon the final release of EPIC4 and will exclude
a great number of the old features such as support for OS/2 and GTK which was
very old and bloated plus there were problems with the gtk client causing
quite a hit to the CPU. The upside is that the client will be pulled back
into a sane code base. Less bloat and overhead is always good for you the
user.
For persons interested in becoming involved in the new project please visit
our forums website at http://www.cyberpunkz.org or join EFnet #BitchX.
A special thanks to panasync.
Links:
======
http://www.bitchx.org/ <-- The official BitchX web site
ftp://ftp.bitchx.org/ <-- The official BitchX ftp site
http://scripts.bitchx.org/ <-- The official BitchX script web site
http://faq.bitchx.org/ <-- FAQ Website
http://bugs.bitchx.org/ <-- Bug Reporting tool
http://forums.bitchx.org/ <-- Q&A Forums (Ask for help here!)
http://we.got.net/~brian/ <-- Another BitchX script site (fudd's)
Contacts:
========
Readme File Maintainer: sin
FAQ Maintainers: sin, powuh, dovee, kreca, fudd, Xavier, tilt, venoma, shattah
ice-man, IRule, rain, novalogic, MHacker
Web Maintainers: novalogic & powuh
Lists Maintainer: raistlin@tacorp.net
Scripts Maintainer: powuh, sin
======================================================================
After reading this PLEASE read the FAQ: http://faq.bitchx.org
======================================================================
-119
View File
@@ -1,119 +0,0 @@
BitchX-1.2-Final Readme file by Dan Mashal <dan408@bitchx.ca>
======================================================
BitchX is an IRC (Internet Relay Chat) client by Colten Edwards aka
panasync@efnet. BitchX was originally based on ircII 2.8, but is currently
based on the ircii-EPIC4 releases by Jeremy Nelson.
BitchX was originally started as a script by Trench and HappyCrappy
for the popular UNIX IRC client ircII. Around Christmas of 1994 the
script was patched directly into the client by panasync.
As of 12/31/2012 we are releasing BitchX-1.2-final.
18 years of BitchX and we're not nearly done yet.
Fixes:
1) Compilation errors on gcc4
2) IPV6 support on BSD
3) ANSI output in terminal emulators
4) cygwin compilation errors
New features:
1) Built in SASL support. See: http://github.com/BitchX/BitchX1.2/wiki
2) tcl.c now included with BitchX - Does not work great.
3) /NAMES and /SCAN
-------------------
The formatting of /NAMES and /SCAN output has been substantially reworked.
The old /FSETs NAMES_BOTCOLOR, NAMES_FRIENDCOLOR, NAMES_NICKCOLOR,
NAMES_OPCOLOR, NAMES_SHITCOLOR and NAMES_VOICECOLOR have been replaced
with these new /FSETs:
....................NAMES_NICK %B$[10]0
................NAMES_NICK_BOT %G$[10]0
.............NAMES_NICK_FRIEND %Y$[10]0
.................NAMES_NICK_ME %W$[10]0
...............NAMES_NICK_SHIT %R$[10]0
....................NAMES_USER %K[ %n$1-%K]
.............NAMES_USER_CHANOP %K[%C$0%n$1-%K]
..............NAMES_USER_IRCOP %K[%R$0%n$1-%K]
..............NAMES_USER_VOICE %K[%M$0%n$1-%K]
The NAMES_NICK formats control how the nick itself is displayed, depending
on the status of the nick as recognised by BitchX (the priority order is
NAMES_NICK_ME > NAMES_NICK_BOT > NAMES_NICK_FRIEND > NAMES_NICK_SHIT >
NAMES_NICK). The NAMES_USER formats control how the overall entry appears in
the /NAMES or /SCAN line, depending on the channel status of the nick (the
priority order is NAMES_USER_CHANOP > NAMES_USER_VOICE > NAMES_USER_IRCOP >
NAMES_USER).
You'll need to update any scripts or custom formats that altered the old
formats. If you just use the defaults, the main difference you'll see is
that your own nick is now shown in white, and voiced users are shown with
the '+' sent by the server instead of the 'v'. You can go back to the old
look by setting these formats:
/FSET NAMES_NICK_ME %B$[10]0
/FSET NAMES_USER_VOICE %K[%Mv%n$1-%K]
Also, the NAMES header and NAMES_FOOTER formats are now called with $3 set
to the total number of nicks in the channel, and $4 to the mask given to
/SCAN (if any).
/SCAN now supports a new sort flag "-stat", which sorts the output by
channel status (chanops, then halfops, then voices, then the riff-raff).
4) /HOP and /DEHOP
---------------
New commands /HOP and /DEHOP have been added, to give and remove halfop
status (on servers that support it).
5) PLUGINS
-------
The "scan" plugin has been removed - its functionality is now built-in,
accessed by /scan -stat (see above). If you want this to be the default,
just set this alias (the double-slash is REQUIRED):
/ALIAS SCAN { //SCAN -STAT }
A special thanks to panasync.
Links:
======
http://www.bitchx.ca/ <-- New official BitchX web site
http://www.github.com/BitchX <-- github repos with the latest code
http://bitchx.svn.sourceforge.net/ <-- svn repo
http://www.bitchx.org/ <-- Old official BitchX web site
http://www.bitchx.ca/scripts <-- The official BitchX script web site
http://www.bitchx.ca/faq <-- FAQ Website
http://github.com/BitchX <-- Report bugs here
http://www.bitchx.org/forum <-- Forums
http://we.got.net/~brian/ <-- Another BitchX script site (fudd's)
For persons interested in becoming involved in the new project please visit
#BitchX on freenode or EFNet.
Contacts:
========
Lead developers: caf, flashback, panasync
Lead cheerleader: VICODAN
Readme File Maintainer: VICODAN
Fedora Maintainer: VICODAN
FAQ Maintainers: sin, powuh, dovee, kreca, fudd, Xavier, tilt, venoma, shattah
ice-man, IRule, rain, novalogic, MHacker, caf, VICODAN
Web Maintainers: VICODAN, panasync
Lists Maintainer: No more mailing lists as of right now.
Scripts Maintainer: VICODAN
======================================================================
After reading this PLEASE read the FAQ http://www.bitchx.ca/faq
======================================================================
-3
View File
@@ -1,3 +0,0 @@
BitchX1.3
=========
Time to fix the rest of the bugs.
Vendored
+7
View File
@@ -1344,6 +1344,13 @@ AC_DEFUN(AC_CHECK_PLUGIN_SUPPORT,
SHLIB_LD="ld -shared"
fi
;;
FreeBSD-1.*)
dnl It sucks that I to have to do this.
AC_MSG_ERROR(sorry, no plugins on $ac_cv_system_version)
;;
FreeBSD-2.*)
SHLIB_LD="ld -Bshareable"
;;
FreeBSD*)
SHLIB_CFLAGS="-fPIC"
SHLIB_LD="$CC -shared"
+11 -2
View File
@@ -152,9 +152,18 @@ do
done
if test x"$NOCONFIGURE" = x; then
read -p "Would you like to run configure? (y/n): " var
else
var=n
fi
case $var in
y|Y|yes|YES)
rm -f $srcdir/config.cache
echo Running $srcdir/configure $conf_flags "$@" ...
$srcdir/configure $conf_flags "$@"
else
;;
*)
echo Skipping configure process.
fi
;;
esac
+5 -15
View File
@@ -20,24 +20,14 @@ maintained by Colten Edwards and a few others. EPIC is maintained by Jeremy
Nelson aka "hop". Alot of changes that appear within BitchX are backported
to EPIC as I am a contributor to epic.
You can get a copy of the BitchX client via ftp from these mirrors:
Not all sites will be always up to date, but many of them try.
You can get a copy of the BitchX client from the official site:
Site Directory Maintainer
ftp.bitchx.com /pub/BitchX Mhacker/panasync
ftp.bitchx.org /pub/BitchX sideshow
If you want to mirror the BitchX client, please drop an email to Colten
Edwards (panasync@BitchX.com) telling him the host and directory where
we can count on you to keep a copy of the current version of the BitchX
client. The BitchX client takes about 1.2m, the help files take about 150k,
and from time to time there are other patches that range from 5k to 30k in
size.
http://www.bitchx.org/
A mailing list for all things related to BitchX exists. Send email to
majordomo@lists.bitchx.com with the words "subscribe bitchx" in the body
(and nothing else!). This list exists for bug reports, discussion about and
requests for new features, and anything else that has to do with BitchX.
bitchx-devel@lists.sourceforge.net This list exists for bug reports,
discussion about and requests for new features, and anything else that is
relevant to BitchX.
* BitchX is completely safe: There are no hidden trap doors.
We value your trust, and will not do anything to abuse it.
+3 -3
View File
@@ -15,7 +15,7 @@ similar to the Unix manual system.
The implication of this, however, is that HELP can't work the same way
as it used to. In order to read a helpfile now, its section number must
also be given. Thus, where one previously obtained help on WHOIS with
"/help whois", one must now use "/help 2 whois".
"/help whois", one must now use "/ehelp 2 whois".
Another change is the references to related topics in individual helpfiles,
which is another similarity to Unix man pages. To better help users ease
@@ -23,8 +23,8 @@ into the new format, all topic references in the "See Also" sections will
include a Unix-ish section reference, such as "whois(2)".
Also if your familar with a command and you find that it's not listed in
here, please write a description of it and email it to
edwards@bitchx.dimension6.com. Your input here, might help someone else.
here, please write a description of it and send it to
bitchx-devel@lists.sourceforge.net. Your input here, might help someone else.
++ If you have not yet read "/ehelp 7 new_user", please do so now. ++
-78
View File
@@ -1,78 +0,0 @@
[Drago(d@NULL.0x00.org)] we wanna hook /msg .name
[Drago(d@NULL.0x00.org)] from a dll
[Drago(d@NULL.0x00.org)] we did it
[Drago(d@NULL.0x00.org)] but the built in /msg handler is still executing
[Drago(d@NULL.0x00.org)] even though we are returing 1
ajoin and channel keys
<DavidW2> And there's a long standing bug.. a message from nick shouldn't go
to the current window if that window is on a dufferent server than
nick.. otherwise you msg nick and they're not there because they
are on another server
*note* this is caused by scripts and /xecho -C I believe.
<DavidW2> Notify signoff also go to the wrong window.. there seems to be a
bunch of problems about where the output goes if you're on
multiple servers... the same nick@host was on 2 servers.. signed off
server1, but showed in server2's window :/
6 [bestis(bestis@ls.sicom.fi)] some info to you msg log or something too:
the
result of whois.arin.net has NS2.NIC.FRIII192.93.0.4 when doing
just
echo $res.. and when putting that to the fe() it cores.. that I is
tab? so i need to rip those out to prevent coredumps, but that
would
be fixed in bx too.
<fudd> create a hidden window
<fudd> connect it to another server with /window server
<fudd> the switch back to window 1
<fudd> type /fprot off
<fudd> switch to window 2
<fudd> type it again
<fudd> switch back to window 1
<fudd> type it again
<fudd> the last time, its still echoed to window 2
<fudd> and so are all other client messages
[Catatonic(bjr@adsl-63-197-228-74.dsl.snfc21.pacbell.net)] i found a bug i
think. /ov +hide, switch to the ov window, type /ov -hide and
then
switch back to a regular window and type /ov -hide
fudd autojoin and keys
[OMCK(~count_0@nat-wohnheime.rz.uni-karlsruhe.de)] ok look, an user (OMSK
~volt@rz03.RZ-FDDI.FH-Karlsruhe.DE) deoped an protected user (host
doesn't matter), and look how bx 1.0c16 react --> ùíù
mode/[#TABEPHA] [+ob OMSK *!*volt@*.FH-Karlsruhe.DE] by GE|Grom
[OMCK(~count_0@nat-wohnheime.rz.uni-karlsruhe.de)] they op and ban them
(without a kick) at once
[OMCK(~count_0@nat-wohnheime.rz.uni-karlsruhe.de)] a friend of my took a
look
in the sources, he means there may be wrong in userlist.c line
1255
and 1257, but he's not sure
dragoon found /randomnick dragoon cores
<Lam> ok. i'm wondering how to check what window a channel is in, in case it
isnt's the primary/on top channel in that window? chanwin()
doesn't
do that
<Lam> as for $winlevel(), it would be nice if i have let's say
$levelwin(msg)
returning the window to which msgs are redirected
<flyghost:#BitchX> mode/#kittens [+ob DaBiatch *!*jaguar1@*.stuffed.org] by
flyidle <-- that happens on ircnet when my BitchX has to
helpout a protected user
<flyghost:#BitchX> instead of -o+b it does +ob <-- offender gets opped again
<flyghost> MASTER,DEOP,KICK,PBAN,PINVITE,REOP
<Zomba> try now, putting: /j #<tab>
[#a%p%s%s%sänÿ¿] [#bitchx ] [#trivia ] [ ]
+5 -3
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -158,13 +158,15 @@ PROGRAM = $(topdir)/bxconfigure
OBJS = ds_cell.o file_cpy.o
BXCONF_LIBS = -lcurses
.c.o:
$(CC) $(DEFS) $(CFLAGS) -c $<
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
all: $(PROGRAM)
$(PROGRAM): $(OBJS)
$(CC) -o $(PROGRAM) $(OBJS) $(LIBS)
$(CC) -o $(PROGRAM) $(OBJS) $(BXCONF_LIBS)
clean:
$(RM) $(OBJS) $(PROGRAM) *~
+2 -2
View File
@@ -302,9 +302,9 @@ int ls_dispatch (CELL * c)
while (c -> termkey == 0/* && c->start*/) {
hit = FALSE;
if (c->redraw && ((*c -> ListPaintProc) != NULL))
if (c->redraw && (c->ListPaintProc != NULL))
(*c -> ListPaintProc) (c);
if (*c -> UpdateStatusProc != NULL)
if (c->UpdateStatusProc != NULL)
(*c -> UpdateStatusProc) (c);
if (c -> termkey == 0) {
if ((*c -> OtherGetKeyProc) != NULL && c->other_getkey)
+47 -36
View File
@@ -195,8 +195,6 @@ Configure compile_default[] = {
{ "Mirc resume support"," Support Mirc\'s Broken resume","MIRC_BROKEN_DCC_RESUME", ON, BOOL_TYPE, NULL},
{ "Mode Compression", "Code for performing mode compression on mass mode changes", "COMPRESS_MODES", ON, BOOL_TYPE, NULL},
{ "MAX # of urls in list", "Max Number of URLS to save in memory", "DEFAULT_MAX_URLS", 30, INT_TYPE, edit_dir },
{ "ChatNet Support", "Support chatnet\'s numeric 310", "WANT_CHATNET", OFF,BOOL_TYPE, NULL},
{ "Notify BitchX.com", "Notify BitchX.com of our version", "SHOULD_NOTIFY_BITCHX_COM", ON, BOOL_TYPE, NULL},
{ "Want Userlist", "", "WANT_USERLIST", ON, BOOL_TYPE, NULL },
{ NULL, NULL, NULL, 0, 0, NULL }
};
@@ -239,7 +237,7 @@ Configure userlist_default[] = {
{ "Server op protection", "Values 0 for none, 1 for deop, 2 for announce only", "DEFAULT_HACKING", 0,INT_TYPE, edit_dir }, /* 0 1 2 */
{"Auto-Unban time", "", "DEFAULT_AUTO_UNBAN", 600, INT_TYPE, edit_dir },
{"Default Ban time", "", "DEFAULT_BANTIME", 600, INT_TYPE, edit_dir },
{"Send ctcp msg", "Send notice when ctcp command recieved", "DEFAULT_SEND_CTCP_MSG", ON, BOOL_TYPE, NULL },
{"Send ctcp msg", "Send notice when ctcp command received", "DEFAULT_SEND_CTCP_MSG", ON, BOOL_TYPE, NULL },
{"Send Op msg", "Send notice when auto-op sent", "DEFAULT_SEND_OP_MSG", ON, BOOL_TYPE, NULL },
{ NULL, NULL, NULL, 0, 0, NULL }
};
@@ -549,10 +547,9 @@ int clear_dlist (CELL *c)
while (c->start != NULL ) {
ptr = c->start;
c->start = c->start->nextlistptr;
if (ptr->datainfo.option)
free(ptr->datainfo.option);
if (ptr->datainfo.help)
free(ptr->datainfo.help);
free(ptr->datainfo.option);
free(ptr->datainfo.help);
free(ptr->datainfo.save);
free(ptr);
}
c->end = NULL;
@@ -570,25 +567,22 @@ int List_Exit(CELL *c) {
* etc.
*/
int status_update(CELL *c) {
char tmp[(200 + 1) * 2];
int center;
char tmp[(200 + 1) * 2];
int center;
center = ((c->ecol - 2) / 2) - (strlen(c->filename) / 2);
memset(tmp, 0, sizeof(tmp));
#if 0
memset(tmp, ' ', center);
strcat(tmp, c->filename);
mvwaddstr(c->window, c->srow - 2, c->scol , tmp);
#else
memset(tmp, ' ', c->ecol - 2);
memset(tmp, ' ', sizeof tmp - 1);
if (c->ecol - 2 < sizeof tmp)
tmp[c->ecol - 2] = 0;
else
tmp[sizeof tmp - 1] = 0;
mvwaddstr (c->window, c->srow - 2 , c->scol, tmp);
wattron(c->window,A_REVERSE);
mvwaddstr (c->window, c->srow - 2 , center, c->filename);
wattroff(c->window,A_REVERSE);
#endif
if (c->current->datainfo.help)
{
sprintf(tmp, " %-75s ", c->current->datainfo.help);
snprintf(tmp, sizeof tmp, " %-75s ", c->current->datainfo.help);
mvwaddstr(c->window, c->max_rows - 3, c->scol, tmp);
}
else
@@ -658,7 +652,7 @@ int File_Entry(CELL *c) {
char *fDisplay (dlistptr *ptr)
{
static char p[100];
sprintf(p, " %-36s ", (*ptr)->datainfo.option);
snprintf(p, sizeof p, " %-36s ", (*ptr)->datainfo.option);
return p;
}
@@ -671,8 +665,8 @@ int fredraw (CELL * c)
dlistptr p = c->list_start;
int i = 0;
char buff[200];
if (c->ecol - c->scol)
sprintf(buff, "%*s",c->ecol - c->scol + 1, " ");
if (c->ecol >= c->scol)
snprintf(buff, sizeof buff, "%*s", c->ecol - c->scol + 1, " ");
while (i <= c->erow - c->srow && p != NULL)
{
if (p == c->current) wattron(c->window,A_REVERSE);
@@ -694,9 +688,11 @@ char *cDisplay (dlistptr *ptr)
{
static char p[100];
if ((*ptr)->datainfo.type == BOOL_TYPE)
sprintf(p, " %-28s %8s", (*ptr)->datainfo.option, (*ptr)->datainfo.integer? "On":"Off");
snprintf(p, sizeof p, " %-28s %8s",
(*ptr)->datainfo.option, (*ptr)->datainfo.integer? "On":"Off");
else if ((*ptr)->datainfo.type == INT_TYPE)
sprintf(p, " %-28s %8d", (*ptr)->datainfo.option, (*ptr)->datainfo.integer);
snprintf(p, sizeof p, " %-28s %8d",
(*ptr)->datainfo.option, (*ptr)->datainfo.integer);
return p;
}
@@ -709,8 +705,8 @@ register int row = c->srow;
dlistptr p = c->list_start;
int i = 0;
char buff[200];
if (c->ecol - c->scol)
sprintf(buff, "%*s",c->ecol - c->scol + 1, " ");
if (c->ecol >= c->scol)
snprintf(buff, sizeof buff, "%*s",c->ecol - c->scol + 1, " ");
while (i <= c->erow - c->srow && p != NULL)
{
@@ -1088,8 +1084,8 @@ char *eDisplay (dlistptr *ptr)
{
static char p[100];
char str[40];
sprintf(str, "%d", (*ptr)->datainfo.integer);
sprintf(p, "%14s", str);
snprintf(str, sizeof str, "%d", (*ptr)->datainfo.integer);
snprintf(p, sizeof p, "%14s", str);
return p;
}
@@ -1103,8 +1099,8 @@ dlistptr p = c->list_start;
int i = 0;
char buff[200];
if (c->ecol - c->scol)
sprintf(buff, "%*s",c->ecol - c->scol + 1, " ");
if (c->ecol >= c->scol)
snprintf(buff, sizeof buff, "%*s",c->ecol - c->scol + 1, " ");
while (i <= c->erow - c->srow && p != NULL)
{
@@ -1123,9 +1119,14 @@ char buff[200];
}
int Edit_Entry(CELL *c) {
char tmp[180];
char tmp[200];
int n_spaces = c->ecol - 2 - c->scol - 4;
memset(tmp, ' ', sizeof(tmp)-1);
tmp[c->ecol - 2 - c->scol - 4] = 0;
if (n_spaces < sizeof tmp)
tmp[n_spaces] = 0;
else
tmp[sizeof tmp - 1] = 0;
mvwaddstr (c->window, c->srow - 1 , c->scol, tmp);
mvwaddstr (c->window, c->srow - 1, c->scol + 4, c->start->datainfo.option);
wrefresh(c->window);
@@ -1135,9 +1136,14 @@ char tmp[180];
int edit_enter (CELL *c)
{
char tmp[180];
char tmp[200];
int n_spaces = c->ecol - 2 - c->scol - 4;
memset(tmp, ' ', sizeof(tmp)-1);
tmp[c->ecol - 2 - c->scol - 4] = 0;
if (n_spaces < sizeof tmp)
tmp[n_spaces] = 0;
else
tmp[sizeof tmp - 1] = 0;
if (c->current->datainfo.type == INT_TYPE)
{
c->redraw = TRUE;
@@ -1193,9 +1199,14 @@ int end = 0;
int edit_exit(CELL *c)
{
char tmp[180];
char tmp[200];
int n_spaces = c->ecol - 2 - c->scol - 4;
memset(tmp, ' ', sizeof(tmp)-1);
tmp[c->ecol - 2 - c->scol - 4] = 0;
if (n_spaces < sizeof tmp)
tmp[n_spaces] = 0;
else
tmp[sizeof tmp - 1] = 0;
mvwaddstr (c->window, c->srow - 1 , c->scol, tmp);
mvwaddstr (c->window, c->srow , c->scol, tmp);
return TRUE;
Vendored Executable
+17184
View File
File diff suppressed because it is too large Load Diff
+49 -76
View File
@@ -3,21 +3,17 @@ dnl Copyright (c) 1999-2001 David Walluck
dnl All rights reserved.
AC_PREREQ(2.59)
AC_REVISION($Revision: 208 $)
AC_INIT
AC_CONFIG_SRCDIR([$srcdir/source/irc.c])
topdir="`pwd`"
AC_SUBST(topdir)
AC_CONFIG_HEADERS(include/defs.h)
dnl Get the version number from source/irc.c.
dnl Maybe it's better to set the VERSION in here instead.
VERSION=`sed -n -e 's/";$//' -e '/ const char irc_version.. = "/s///p' -e '/const char irc_version/q' < $srcdir/source/irc.c 2>/dev/null`
if test x"$VERSION" = x""; then
VERSION="BitchX-1.0"
fi
_VERSION_="BitchX"
VERSION_NUMBER="`echo "$VERSION" | sed 's/BitchX-//'`"
RELEASE_TAG="bitchx-1.2.1"
RELEASE="1.2.1"
VERSION_NUMBER="$RELEASE`"$srcdir/gitversion.sh" "$RELEASE_TAG" "$srcdir"`"
VERSION="$_VERSION_-$VERSION_NUMBER"
AC_DEFINE_UNQUOTED(VERSION_NUMBER, "$VERSION_NUMBER", Define BitchX version number here.)
AC_SUBST(VERSION_NUMBER)
echo Welcome to the "$VERSION" configuration
@@ -60,7 +56,7 @@ AC_CHECK_LIB(m, pow, LIBS="-lm $LIBS",)
dnl Checks for header files.
AC_HEADER_DIRENT
AC_CHECK_HEADERS([sys/socket.h sys/time.h sys/fcntl.h fcntl.h sys/file.h netinet/in.h netdb.h sys/un.h sys/filio.h regex.h arpa/nameser.h dirent.h sys/ndir.h sys/dir.h ndir.h])
AC_CHECK_HEADERS([sys/socket.h sys/sockio.h sys/time.h sys/fcntl.h fcntl.h sys/file.h netinet/in.h netdb.h sys/un.h sys/filio.h regex.h arpa/nameser.h dirent.h sys/ndir.h sys/dir.h ndir.h termios.h])
AC_CHECK_HEADERS([net/if.h], [], [],
[AC_INCLUDES_DEFAULT
@@ -87,7 +83,6 @@ AC_CHECK_DECLARATION(getpass, getpass, getpass, unistd.h, GETPASS_DECLARED)
AC_CHECK_DECLARATION(errno, errno, [int?( | )_?_?errno], errno.h, ERRNO_DECLARED)
AC_CHECK_DECLARATION(struct linger, struct_linger, [struct( | )*linger], sys/socket.h, STRUCT_LINGER_DECLARED)
AC_CHECK_DECLARATION(sun_len, sun_len, sun_len, sys/un.h, HAVE_SUN_LEN)
AC_CHECK_DECLARATION(bcopy, bcopy, bcopy, string.h, BCOPY_DECLARED)
AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist], , ,
[AC_INCLUDES_DEFAULT
@@ -105,13 +100,19 @@ AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AC_HEADER_TIME
AC_CHECK_TYPES([socklen_t], [], [], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif])
AC_CHECK_SIZEOF(unsigned int, 4)
if test x"$ac_cv_sizeof_unsigned_int" = x"4"; then
AC_DEFINE(UNSIGNED_INT32, 1, Define this if an unsigned long is 32 bits.)
AC_DEFINE(UNSIGNED_INT32, 1, Define this if an unsigned int is 32 bits.)
else
AC_CHECK_SIZEOF(unsigned long, 4)
if test x"$ac_cv_sizeof_unsigned_long" = x"4"; then
AC_DEFINE(UNSIGNED_LONG32, 1, Define this if an unsigned int is 32 bits.)
AC_DEFINE(UNSIGNED_LONG32, 1, Define this if an unsigned long is 32 bits.)
else
AC_DEFINE(UNKNOWN_32INT, 1, Define this if you are unsure what is 32 bits.)
fi
@@ -169,6 +170,7 @@ if test x"$bx_cv_lib_resolver" != x"not found"; then
OLDLIBS="$LIBS"
LIBS="-liphlpapi $LIBS"
AC_LINK_IFELSE([[
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <iphlpapi.h>
@@ -195,7 +197,7 @@ if test x"$cross_compiling" != x"yes"; then
AC_FUNC_SETPGRP
fi
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(socket gethostname gettimeofday strtoul strlcpy strlcat stpcpy vsnprintf snprintf setsid strerror uname getrusage sysconf getpgid killpg getlogin realpath fchdir getpass fpathconf getpwent setvbuf select mkstemp memmove scandir)
AC_CHECK_FUNCS(socket gethostname gettimeofday strtoul strlcpy strlcat stpcpy vsnprintf snprintf setsid strerror uname getrusage sysconf getpgid killpg getlogin realpath fchdir getpass fpathconf getpwent setvbuf select mkstemp memmove setenv)
dnl Need these for Solaris
AC_CHECK_FUNC(gethostbyname,,
AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS",))
@@ -565,7 +567,7 @@ case "$with_ssl" in
[AS_IF([test x"$with_ssl" = x"yes"],
[AC_MSG_FAILURE([--with-ssl given, but could not find OpenSSL.])],
[AC_MSG_WARN([OpenSSL not found, will not have SSL support.])])
], [AC_DEFINE(HAVE_SSL, 1, SSL Defined)])
], [])
;;
esac
@@ -589,62 +591,32 @@ AC_DEFINE_UNQUOTED(_VERSION_, "$_VERSION_", Define short BitchX version here.)
AC_SUBST(EXTRAS)
AC_SUBST(INSTALL_EXTRAS)
dnl Check for setupterm/tgetent. *DO NOT* check on CYGWIN or EMXOS2 because
dnl Check for setupterm/tgetent. *DO NOT* check on EMXOS2 because
dnl term support is built-in.
if test -z "$CYGWIN" -a -z "$EMXOS2" -a -z "$MINGWIN32"; then
AC_MSG_CHECKING(whether to use use tgetent or setupterm)
AC_ARG_WITH(tgetent,
[ --with-tgetent Use tgetent (termcap) instead of setupterm (ncurses) ],
[ AC_MSG_RESULT(tgetent)
AC_CHECK_LIB(tinfo, tgetent, tinfo=1; LIBS="-ltinfo $LIBS",
AC_CHECK_LIB(mytinfo, tgetent, tinfo=1; LIBS="-lmytinfo $LIBS",
AC_CHECK_LIB(termcap, tgetent, termcap=1; LIBS="-ltermcap $LIBS",
AC_CHECK_LIB(termlib, tgetent, termlib=1; LIBS="-ltermlib $LIBS",
AC_CHECK_LIB(curses, tgetent, curses=1; LIBS="-lcurses $LIBS",
AC_MSG_WARN(cannot find tgetent - trying setupterm)
AC_CHECK_LIB(ncurses, setupterm, ncurses=1; LIBS="-lncurses $LIBS",
AC_CHECK_LIB(curses, setupterm, ncurses=1; LIBS="-lcurses $LIBS",
AC_CHECK_LIB(tinfo, setupterm, tinfo=1; LIBS="-ltinfo $LIBS",
AC_MSG_ERROR(cannot find tgetent or setupterm)))))))))],
[ AC_MSG_RESULT(setupterm)
AC_CHECK_LIB(ncurses, setupterm, ncurses=1; LIBS="-lncurses $LIBS",
AC_CHECK_LIB(curses, setupterm, curses=1; LIBS="-lcurses $LIBS",
AC_CHECK_LIB(tinfo, tgetent, tinfo=1; LIBS="-ltinfo $LIBS",
AC_CHECK_LIB(mytinfo, tgetent, tinfo=1; LIBS="-lmytinfo $LIBS",
AC_CHECK_LIB(tinfo, setupterm, tinfo=1; LIBS="-ltinfo $LIBS",
AC_MSG_WARN(cannot find setupterm - trying tgetent)
AC_CHECK_LIB(termlib, tgetent, termlib=1; LIBS="-ltermlib $LIBS",
AC_CHECK_LIB(termcap, tgetent, termcap=1; LIBS="-ltermcap $LIBS",
AC_CHECK_LIB(curses, tgetent, curses=1; LIBS="-lcurses $LIBS",
AC_MSG_ERROR(cannot find setupterm or tgetent)))))))))])
dnl Check for tputs and tparm.
if test x"$ncurses" = x"1"; then
AC_CHECK_DECLARATION(tparm, tparm, [tparm( | |)], ncurses.h, TPARM_DECLARED)
AC_CHECK_LIB(ncurses, tparm, AC_DEFINE(HAVE_TPARM, 1, Define this if you have the tparm function in an included lib.),)
AC_CHECK_HEADERS(ncurses.h ncurses/termcap.h termcap.h)
AC_CHECK_DECLARATION(tputs, tputs, [tputs( | |)], ncurses/termcap.h, TPUTS_DECLARED)
AC_CHECK_DECLARATION(tputs, tputs, [tputs( | |)], termcap.h, TPUTS_DECLARED)
AC_CHECK_LIB(ncurses, tputs, AC_DEFINE(HAVE_TPUTS, 1, Define this if you have the tputs function in an included lib.),)
fi
if test x"$curses" = x"1"; then
AC_CHECK_HEADERS(curses.h termcap.h)
AC_CHECK_DECLARATION(tparm, tparm, [tparm( | |)], curses.h, TPARM_DECLARED)
AC_CHECK_LIB(curses, tparm, AC_DEFINE(HAVE_TPARM, 1, Define this if you have the tparm function in an included lib.),)
AC_CHECK_DECLARATION(tputs, tputs, [tputs( | |)], curses.h, TPUTS_DECLARED)
AC_CHECK_LIB(curses, tputs, AC_DEFINE(HAVE_TPUTS, 1, Define this if you have the tputs function in an included lib.),)
AC_CHECK_DECLARATION(tputs, tputs, [tputs( | |)], termcap.h, TPUTS_DECLARED)
fi
if test x"$termcap" = x"1"; then
AC_CHECK_HEADERS(termcap.h)
AC_CHECK_DECLARATION(tparm, tparm, [tparm( | |)], termcap.h, TPARM_DECLARED)
AC_CHECK_LIB(termcap, tparm, AC_DEFINE(HAVE_TPARM, 1, Define this if you have the tparm function in an included lib.),)
AC_CHECK_DECLARATION(tputs, tputs, [tputs( | |)], termcap.h, TPUTS_DECLARED)
AC_CHECK_LIB(termcap, tputs, AC_DEFINE(HAVE_TPUTS, 1, Define this if you have the tputs function in an included lib.),)
fi
fi
if test x"$ncurses" = x"1" -o x"$tinfo" = x"1"; then
AC_DEFINE(HAVE_TERMINFO, 1, Define this if you have terminfo support.)
if test -z "$EMXOS2" -a -z "$MINGWIN32"; then
AC_MSG_CHECKING(whether to use use termcap in preference to terminfo)
AC_ARG_WITH(termcap,
[ --with-termcap Use termcap in preference to terminfo],
[ AC_MSG_RESULT(yes)
AC_SEARCH_LIBS([tgetent], [termcap termlib curses], [],
AC_MSG_ERROR([Cannot find termcap.]))],
[ AC_MSG_RESULT(no)
AC_SEARCH_LIBS([setupterm], [tinfo terminfo ncurses curses mytinfo],
AC_DEFINE(HAVE_TERMINFO, 1, [Define this if you have terminfo support.]),
[AC_MSG_WARN([Cannot find terminfo, falling back to termcap.])
AC_SEARCH_LIBS([tgetent], [termcap termlib curses], [],
AC_MSG_ERROR([Cannot find terminfo or termcap - try installing the ncurses-dev / ncurses-devel package.]))])])
AC_CHECK_FUNCS([tparm])
AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h curses.h], [break])
AC_CHECK_HEADERS([ncurses/termcap.h termcap.h ncurses/term.h term.h], [], [],
[[#if defined(HAVE_NCURSES_H)
#include <ncurses.h>
#elif defined(HAVE_NCURSES_NCURSES_H)
#include <ncurses/ncurses.h>
#elif defined(HAVE_CURSES_H)
#include <curses.h>
#endif
]])
fi
dnl Check for Tcl.
@@ -1006,7 +978,7 @@ GZIP_ENV="--best"
BZIP2="-9 --repetitive-best"
dnl Should I keep this or not?
if test -n "$EMXOS2" -o -n "$MINGWIN32"; then
if test -n "$CYGWIN" -o -n "$EMXOS2" -o -n "$MINGWIN32"; then
bindir="\$(IRCLIB)"
INSTALL_IRC="\$(IRCLIB)/\$(_VERSION_)\$(EXEEXT)"
IRCLIB="\${prefix}/BitchX"
@@ -1022,6 +994,7 @@ if test -n "$EMXOS2" -o -n "$MINGWIN32"; then
DEFAULT_BITCHX_HELP_FILE="BitchX.hlp"
DEFAULT_SCRIPT_HELP_FILE="BitchX.hlp"
DEFAULT_BITCHX_KICK_FILE="BitchX.kck"
DEFAULT_BITCHX_KILL_FILE="BitchX.kil"
DEFAULT_BITCHX_QUIT_FILE="BitchX.qt"
DEFAULT_BITCHX_IRCNAME_FILE="BitchX.nam"
WINNT_INSTALL="\$(INSTALL_DATA) \$(top_srcdir)/doc/BitchX.ico \$(DESTDIR)\$(IRCLIB); \$(INSTALL_DATA) \$(top_srcdir)/doc/BitchX.bat \$(DESTDIR)\$(IRCLIB); \$(INSTALL_DATA) \$(top_srcdir)/doc/bx-rc \$(DESTDIR)\$(IRCLIB); \$(MV) \$(DESTDIR)\$(IRCLIB)/\$(VERSION)\$(EXEEXT) \$(DESTDIR)\$(IRCLIB)/\$(_VERSION_)\$(EXEEXT); \$(RM) \$(DESTDIR)\$(IRCLIB)/\$(_VERSION_).old"
@@ -1042,6 +1015,7 @@ else
DEFAULT_BITCHX_HELP_FILE="BitchX.help"
DEFAULT_SCRIPT_HELP_FILE="BitchX.help"
DEFAULT_BITCHX_KICK_FILE="BitchX.kick"
DEFAULT_BITCHX_KILL_FILE="BitchX.kill"
DEFAULT_BITCHX_QUIT_FILE="BitchX.quit"
DEFAULT_BITCHX_IRCNAME_FILE="BitchX.ircnames"
HINT_FILE="BitchX.hints"
@@ -1086,9 +1060,11 @@ AC_DEFINE_UNQUOTED(DEFAULT_BITCHX_HELP_FILE, "$DEFAULT_BITCHX_HELP_FILE", Defaul
AC_SUBST(DEFAULT_BITCHX_HELP_FILE)
AC_DEFINE_UNQUOTED(DEFAULT_SCRIPT_HELP_FILE, "$DEFAULT_SCRIPT_HELP_FILE", Default BitchX script file.)
AC_SUBST(DEFAULT_SCRIPT_HELP_FILE)
AC_DEFINE_UNQUOTED(DEFAULT_BITCHX_KICK_FILE, "$DEFAULT_BITCHX_KICK_FILE", Default BitchX kick file.)
AC_DEFINE_UNQUOTED(DEFAULT_BITCHX_KICK_FILE, "$DEFAULT_BITCHX_KICK_FILE", Default BitchX kick reasons file.)
AC_SUBST(DEFAULT_BITCHX_KICK_FILE)
AC_DEFINE_UNQUOTED(DEFAULT_BITCHX_QUIT_FILE, "$DEFAULT_BITCHX_QUIT_FILE", Default BitchX quit file.)
AC_DEFINE_UNQUOTED(DEFAULT_BITCHX_KILL_FILE, "$DEFAULT_BITCHX_KILL_FILE", Default BitchX kill reasons file.)
AC_SUBST(DEFAULT_BITCHX_KILL_FILE)
AC_DEFINE_UNQUOTED(DEFAULT_BITCHX_QUIT_FILE, "$DEFAULT_BITCHX_QUIT_FILE", Default BitchX quit reasons file.)
AC_SUBST(DEFAULT_BITCHX_QUIT_FILE)
AC_DEFINE_UNQUOTED(DEFAULT_BITCHX_IRCNAME_FILE, "$DEFAULT_BITCHX_IRCNAME_FILE", Default BitchX ircname file.)
AC_SUBST(DEFAULT_BITCHX_IRCNAME_FILE)
@@ -1100,12 +1076,9 @@ AC_CONFIG_FILES([
Makefile
bx-conf/Makefile
doc/BitchX.bat
doc/Makefile
dll/Makefile
dll/abot/Makefile
dll/acro/Makefile
dll/aim/Makefile
dll/aim/toc/Makefile
dll/amp/Makefile
dll/arcfour/Makefile
dll/autocycle/Makefile
@@ -1131,7 +1104,7 @@ AC_CONFIG_COMMANDS([default],[[ echo timestamp > stamp-h
AC_OUTPUT
echo
echo BitchX \(c\) 1996-2012 Colten Edwards et al
echo BitchX \(c\) 1996-2015 Colten Edwards et al
echo ----------------------------------------------------------
echo
echo The configuration script has finished. You should look through
-504
View File
@@ -1,504 +0,0 @@
Index: include/ircaux.h
===================================================================
--- include/ircaux.h (revision 210)
+++ include/ircaux.h (working copy)
@@ -256,6 +256,8 @@
char *tparm (const char *, ...);
#endif
+ int my_base64_encode (const void *, int, char **);
+
#ifndef HAVE_STRTOUL
unsigned long strtoul (const char *, char **, int);
#endif
Index: include/modval.h
===================================================================
--- include/modval.h (revision 210)
+++ include/modval.h (working copy)
@@ -505,11 +505,11 @@
#define close_all_server (*(void (*)(void ))global[CLOSE_ALL_SERVER])
#define read_server_file (*(int (*)(char *))global[READ_SERVER_FILE])
-#define add_to_server_list (*(void (*)(char *, int , char *, char *, char *, int , int ))global[ADD_TO_SERVER_LIST])
+#define add_to_server_list (*(void (*)(char *, int , char *, char *, char *, char *, char *, int , int ))global[ADD_TO_SERVER_LIST])
#define build_server_list (*(int (*)(char *))global[BUILD_SERVER_LIST])
#define display_server_list (*(void (*)(void ))global[DISPLAY_SERVER_LIST])
#define create_server_list (*(char *(*)(char *))global[CREATE_SERVER_LIST])
-#define parse_server_info (*(void (*)(char *, char **, char **, char **, char **))global[PARSE_SERVER_INFO])
+#define parse_server_info (*(void (*)(char *, char **, char **, char **, char **, char **, char **))global[PARSE_SERVER_INFO])
#define server_list_size (*(int (*)(void ))global[SERVER_LIST_SIZE])
#define find_server_refnum (*(int (*)(char *, char **))global[FIND_SERVER_REFNUM])
Index: include/server.h
===================================================================
--- include/server.h (revision 210)
+++ include/server.h (working copy)
@@ -165,6 +165,8 @@
int ssl_error;
SSL* ssl_fd;
#endif
+ char *sasl_nick;
+ char *sasl_pass;
/* recv_nick: the nickname of the last person to send you a privmsg */
char *recv_nick;
@@ -185,7 +187,7 @@
int find_server_group (char *, int);
char * find_server_group_name (int);
- void BX_add_to_server_list (char *, int, char *, char *, char *, int, int);
+ void BX_add_to_server_list (char *, int, char *, char *, char *, char *, char *, int, int);
int BX_build_server_list (char *);
int connect_to_server (char *, int, int);
void BX_get_connected (int, int);
@@ -227,7 +229,7 @@
void BX_set_server_operator (int, int);
void BX_server_is_connected (int, int);
int BX_parse_server_index (char *);
- void BX_parse_server_info (char *, char **, char **, char **, char **);
+ void BX_parse_server_info (char *, char **, char **, char **, char **, char **, char **);
long set_server_bits (fd_set *, fd_set *);
void BX_set_server_itsname (int, char *);
void BX_set_server_version (int, int);
@@ -395,6 +397,10 @@
void clean_split_server_list (int, time_t);
void write_server_list(char *);
void write_server_file (char *);
+// void set_server_sasl_nick(int, const char *);
+ char *get_server_sasl_nick(int);
+// void set_server_sasl_pass(int, const char *);
+ char *get_server_sasl_pass(int);
#define USER_MODE 0x0001
#define USER_MODE_A USER_MODE << 0
Index: source/numbers.c
===================================================================
--- source/numbers.c (revision 210)
+++ source/numbers.c (working copy)
@@ -1407,6 +1407,17 @@
}
}
}
+ case 903: /* SASL authentication successful */
+ case 904: /* SASL authentication failed */
+ case 905: /* SASL message too long */
+ case 906: /* SASL authentication aborted */
+ case 907: /* You have already completed SASL authentication */
+ {
+ my_send_to_server(from_server, "CAP END");
+ if (do_hook(current_numeric, "%s %s", from, *ArgList))
+ display_msg(from, ArgList);
+ break;
+ }
case 305:
{
if (comm == 305 && get_server_away(from_server))
Index: source/compat.c
===================================================================
--- source/compat.c (revision 210)
+++ source/compat.c (working copy)
@@ -2401,3 +2401,58 @@
return count;
}
#endif
+
+/* ----------------------- start of base64 stuff ---------------------------*/
+/*
+ * Copyright (c) 1995-2001 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * This is licensed under the 3-clause BSD license, which is found above.
+ */
+
+static char base64_chars[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+/*
+ * Return a malloced, base64 string representation of the first 'size' bytes
+ * starting at 'data'. Returns strlen(*str).
+ */
+int my_base64_encode (const void *data, int size, char **str)
+{
+ char *s, *p;
+ int i;
+ unsigned c;
+ const unsigned char *q;
+
+// XXX
+// p = s = (char *)new_malloc(size * 4 / 3 + 4);
+ p = s = (char *)malloc(size * 4 / 3 + 4);
+ if (p == NULL)
+ return -1;
+ q = (const unsigned char *) data;
+ i = 0;
+ for (i = 0; i < size;) {
+ c = (unsigned)(unsigned char)q[i++];
+ c *= 256;
+ if (i < size)
+ c += (unsigned)(unsigned char)q[i];
+ i++;
+ c *= 256;
+ if (i < size)
+ c += (unsigned)(unsigned char)q[i];
+ i++;
+ p[0] = base64_chars[(c & 0x00fc0000) >> 18];
+ p[1] = base64_chars[(c & 0x0003f000) >> 12];
+ p[2] = base64_chars[(c & 0x00000fc0) >> 6];
+ p[3] = base64_chars[(c & 0x0000003f) >> 0];
+ if (i > size)
+ p[3] = '=';
+ if (i > size + 1)
+ p[2] = '=';
+ p += 4;
+ }
+ *p = 0;
+ *str = s;
+ return strlen(s);
+}
Index: source/server.c
===================================================================
--- source/server.c (revision 210)
+++ source/server.c (working copy)
@@ -700,7 +700,9 @@
char *cport = NULL,
*password = NULL,
*nick = NULL,
- *snetwork = NULL;
+ *snetwork = NULL,
+ *sasl_nick = NULL,
+ *sasl_pass = NULL;
/*
* First of all, check for an existing server refnum
@@ -708,10 +710,10 @@
if ((refnum = parse_server_index(server)) != -1)
return refnum;
/*
- * Next check to see if its a "server:port:password:nick:network"
+ * Next check to see if its a "server:port:password:nick:network:saslnick:saslpass"
*/
else if (index(server, ':') || index(server, ','))
- parse_server_info(server, &cport, &password, &nick, &snetwork);
+ parse_server_info(server, &cport, &password, &nick, &snetwork, &sasl_nick, &sasl_pass);
else if (index(server, '['))
{
@@ -727,7 +729,7 @@
}
}
/*
- * Next check to see if its "server port password nick"
+ * Next check to see if its "server port password nick network saslnick saslport"
*/
else if (rest && *rest)
{
@@ -735,6 +737,8 @@
password = next_arg(*rest, rest);
nick = next_arg(*rest, rest);
snetwork = next_arg(*rest, rest);
+ sasl_nick = next_arg(*rest, rest);
+ sasl_pass = next_arg(*rest, rest);
}
if (cport && *cport)
@@ -744,7 +748,7 @@
* Add to the server list (this will update the port
* and password fields).
*/
- add_to_server_list(server, port, password, nick, snetwork, 0, 1);
+ add_to_server_list(server, port, password, nick, snetwork, sasl_nick, sasl_pass, 0, 1);
return from_server;
}
@@ -756,7 +760,7 @@
* passes. If the server is not on the list, it is added to the end. In
* either case, the server is made the current server.
*/
-void BX_add_to_server_list (char *server, int port, char *password, char *nick, char *snetwork, int ssl, int overwrite)
+void BX_add_to_server_list (char *server, int port, char *password, char *nick, char *snetwork, char *sasl_nick, char *sasl_pass, int ssl, int overwrite)
{
extern int default_swatch;
if ((from_server = find_in_server_list(server, port)) == -1)
@@ -785,6 +789,11 @@
else if (!server_list[from_server].d_nickname)
malloc_strcpy(&(server_list[from_server].d_nickname), nickname);
+ if (sasl_nick && *sasl_nick)
+ malloc_strcpy(&(server_list[from_server].sasl_nick), sasl_nick);
+ if (sasl_pass && *sasl_pass)
+ malloc_strcpy(&(server_list[from_server].sasl_pass), sasl_pass);
+
make_notify_list(from_server);
make_watch_list(from_server);
set_umode(from_server);
@@ -808,6 +817,20 @@
else
new_free(&(server_list[from_server].d_nickname));
}
+ if (sasl_nick || !server_list[from_server].sasl_nick)
+ {
+ if (sasl_nick && *sasl_nick)
+ malloc_strcpy(&(server_list[from_server].sasl_nick), sasl_nick);
+ else
+ new_free(&(server_list[from_server].sasl_nick));
+ }
+ if (sasl_pass || !server_list[from_server].sasl_pass)
+ {
+ if (sasl_pass && *sasl_pass)
+ malloc_strcpy(&(server_list[from_server].sasl_pass), sasl_pass);
+ else
+ new_free(&(server_list[from_server].sasl_pass));
+ }
}
if (strlen(server) > strlen(server_list[from_server].name))
malloc_strcpy(&(server_list[from_server].name), server);
@@ -882,13 +905,13 @@
*
* With IPv6 patch it also supports comma as a delimiter.
*/
-void BX_parse_server_info (char *name, char **port, char **password, char **nick, char **snetwork)
+void BX_parse_server_info (char *name, char **port, char **password, char **nick, char **snetwork, char **sasl_nick, char **sasl_pass)
{
char *ptr, delim;
delim = (index(name, ',')) ? ',' : ':';
- *port = *password = *nick = NULL;
+ *port = *password = *nick = *sasl_nick = *sasl_pass = NULL;
if ((ptr = (char *) strchr(name, delim)) != NULL)
{
*(ptr++) = (char) 0;
@@ -920,7 +943,28 @@
if (!strlen(ptr))
*snetwork = NULL;
else
+ {
*snetwork = ptr;
+ if ((ptr = strchr(ptr, delim)) != NULL)
+ {
+ *(ptr++) = 0;
+ if (!strlen(ptr))
+ *sasl_nick = NULL;
+ else
+ {
+ *sasl_nick = ptr;
+ if ((ptr = strchr(ptr, delim)) != NULL)
+ {
+ *(ptr++) = 0;
+ if (!strlen(ptr))
+ *sasl_pass = NULL;
+ else
+ *sasl_pass = ptr;
+ }
+
+ }
+ }
+ }
}
}
}
@@ -941,8 +985,8 @@
* servername:port
* servername:port:password
* servername::password
- * servernetwork
- * servername:port:password:nick:servernetwork
+ * [servernetwork]
+ * servername:port:password:nick:servernetwork:saslnick:saslpass
* Note also that this routine mucks around with the server string passed to it,
* so make sure this is ok
*/
@@ -955,7 +999,9 @@
*password = NULL,
*port = NULL,
*nick = NULL,
- *snetwork = NULL;
+ *snetwork = NULL,
+ *sasl_nick = NULL,
+ *sasl_pass = NULL;
int port_num;
int i = 0;
@@ -995,7 +1041,7 @@
snetwork = NULL;
continue;
}
- parse_server_info(host, &port, &password, &nick, &snetwork);
+ parse_server_info(host, &port, &password, &nick, &snetwork, &sasl_nick, &sasl_pass);
if (port && *port)
{
if (!(port_num = my_atol(port)))
@@ -1004,7 +1050,7 @@
else
port_num = irc_port;
- add_to_server_list(host, port_num, password, nick, snetwork ? snetwork : default_network, do_use_ssl, 0);
+ add_to_server_list(host, port_num, password, nick, snetwork ? snetwork : default_network, sasl_nick, sasl_pass, do_use_ssl, 0);
i++;
}
servers = rest;
@@ -1273,7 +1319,7 @@
#endif
update_all_status(current_window, NULL, 0);
- add_to_server_list(server_name, port, NULL, NULL, NULL, 0, 1);
+ add_to_server_list(server_name, port, NULL, NULL, NULL, NULL, NULL, 0, 1);
server_list[from_server].closing = 0;
if (port)
@@ -1638,7 +1684,7 @@
{
if (!(server=new_next_arg(args,&args)))
{
- say("Not enough paramters - supply server name");
+ say("Not enough parameters - supply server name");
return;
}
say("Trying to establish ssl connection with server: %s",server);
@@ -2283,6 +2329,9 @@
int old_from_server = from_server;
if (server_list[ssn_index].password)
my_send_to_server(ssn_index, "PASS %s", server_list[ssn_index].password);
+
+ if (server_list[ssn_index].sasl_nick && server_list[ssn_index].sasl_pass)
+ my_send_to_server(ssn_index, "CAP REQ :sasl");
my_send_to_server(ssn_index, "USER %s %s %s :%s", username,
(send_umode && *send_umode) ? send_umode :
@@ -3794,3 +3843,41 @@
}
return i;
}
+
+#if 0
+void set_server_sasl_nick(int server, const char *nick)
+{
+ if (server <= -1 || server >= number_of_servers)
+ return;
+ if (nick)
+ malloc_strcpy(&server_list[server].sasl_nick, nick);
+ else
+ new_free(&server_list[server].sasl_nick);
+}
+#endif
+
+char *get_server_sasl_nick(int server)
+{
+ if (server <= -1 || server >= number_of_servers)
+ return NULL;
+ return server_list[server].sasl_nick;
+}
+
+#if 0
+void set_server_sasl_pass(int server, const char *pass)
+{
+ if (server <= -1 || server >= number_of_servers)
+ return;
+ if (pass)
+ malloc_strcpy(&server_list[server].sasl_pass, pass);
+ else
+ new_free(&server_list[server].sasl_pass);
+}
+#endif
+
+char *get_server_sasl_pass(int server)
+{
+ if (server <= -1 || server >= number_of_servers)
+ return NULL;
+ return server_list[server].sasl_pass;
+}
Index: source/parse.c
===================================================================
--- source/parse.c (revision 210)
+++ source/parse.c (working copy)
@@ -887,6 +887,79 @@
say("%s", ArgList[0]);
}
+/*
+ * This only handles negotiating the SASL capability with the PLAIN method. It would
+ * be good to add DH-BLOWFISH, and later, full capability support.
+ */
+static void p_cap(char *from, char **ArgList)
+{
+ char *caps, *p;
+
+ if (!strcmp(ArgList[1], "ACK"))
+ {
+ caps = LOCAL_COPY(ArgList[2]);
+ while ((p = next_arg(caps, &caps)) != NULL)
+ {
+ /* Only AUTHENTICATE before registration */
+ if (!strcmp(p, "sasl") && !is_server_connected(from_server))
+ {
+ my_send_to_server(from_server, "AUTHENTICATE PLAIN");
+ break;
+ }
+ }
+ }
+ else if (!strcmp(ArgList[1], "NAK"))
+ {
+ caps = LOCAL_COPY(ArgList[2]);
+ while ((p = next_arg(caps, &caps)) != NULL)
+ {
+ /* End capability negotiation to continue registration */
+ if (!strcmp(p, "sasl") && !is_server_connected(from_server))
+ {
+ my_send_to_server(from_server, "CAP END");
+ break;
+ }
+ }
+ }
+}
+
+static void p_authenticate(char *from, char **ArgList)
+{
+ char buf[512];
+ char *output = NULL;
+ char *nick, *pass;
+
+ /* "AUTHENTICATE command MUST be used before registration is complete" */
+ if (is_server_connected(from_server))
+ return;
+
+ if (!strcmp(ArgList[0], "+"))
+ {
+ nick = get_server_sasl_nick(from_server);
+ pass = get_server_sasl_pass(from_server);
+
+ /* "The client can abort an authentication by sending an asterisk as the data" */
+ if (!nick || !pass)
+ {
+ my_send_to_server(from_server, "AUTHENTICATE *");
+ return;
+ }
+
+ strlcpy(buf, nick, sizeof buf);
+ strlcpy(buf + strlen(nick) + 1, nick, sizeof buf);
+ strlcpy(buf + strlen(nick) * 2 + 2, pass, sizeof buf);
+
+ if (my_base64_encode(buf, strlen(nick) * 2 + strlen(pass) + 2, &output) != -1)
+ {
+ my_send_to_server(from_server, "AUTHENTICATE %s", output);
+// XXX new_free(&output);
+ free(output);
+ }
+ else
+ my_send_to_server(from_server, "AUTHENTICATE *");
+ }
+}
+
void add_user_who (WhoEntry *w, char *from, char **ArgList)
{
char *userhost;
@@ -1758,7 +1831,9 @@
protocol_command rfc1459[] = {
{ "ADMIN", NULL, NULL, 0, 0, 0},
+{ "AUTHENTICATE", p_authenticate, NULL, 0, 0, 0},
{ "AWAY", NULL, NULL, 0, 0, 0},
+{ "CAP", p_cap, NULL, 0, 0, 0},
{ "CONNECT", NULL, NULL, 0, 0, 0},
{ "ERROR", p_error, NULL, 0, 0, 0},
{ "ERROR:", p_error, NULL, 0, 0, 0},
+11
View File
@@ -0,0 +1,11 @@
bitchx (1.2.1-1) unstable; urgency=medium
* New upstream release
-- Kevin Easton <caf@bitchx.org> Mon, 25 Jul 2016 22:51:22 +1000
bitchx (1.2c01-svn-1) unstable; urgency=low
* Initial release
-- Nye Liu <nyet@nyet.org> Thu, 10 May 2012 19:03:28 -0800
+1
View File
@@ -0,0 +1 @@
8
+15
View File
@@ -0,0 +1,15 @@
Source: bitchx
Section: net
Priority: optional
Maintainer: Nye Liu <nyet@nyet.org>
Build-Depends: debhelper (>= 8.0.0), libncurses5-dev, libssl-dev
Standards-Version: 3.9.2
Homepage: https://sourceforge.net/projects/bitchx/
#Vcs-Git: git://git.debian.org/collab-maint/bitchx.git
#Vcs-Browser: http://git.debian.org/?p=collab-maint/bitchx.git;a=summary
Package: bitchx
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: terminal based IRC client
BitchX (ircii-pana) is a terminal based IRC client for UNIX systems.
+65
View File
@@ -0,0 +1,65 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: bitchx
Upstream-Contact: <bitchx-devel@lists.sourceforge.net>
Source: https://sourceforge.net/projects/bitchx/
Files: *
Copyright: 1990 Michael Sandroff
1991-1992 Troy Rollo
1992-1996 Matthew Green
1993-1998 Jeremy Nelson and others ("EPIC Software Labs").
1994 Jake Khuon
1996-2004 Colten Edwards et al.
2008-2012 Kevin Easton et al.
License: BSD
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of the author(s) may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Files: dll/europa/*
Copyright: 1999 Ed Schlunder <zilym@asu.edu>
License: GPL-2+
This is free software distributable under the terms of the GNU GPL-- See
the file COPYING for details.
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
Files: debian/*
Copyright: 2012 Nye Liu <nyet@curtisfong.org>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
Vendored
+13
View File
@@ -0,0 +1,13 @@
README
IPv6-support
doc/BitchX.devel
doc/BitchX.doc
doc/BitchX.faq
doc/BitchX.mailinglist
doc/BitchX.sites
doc/botlink.txt
doc/entire-faq.html
doc/functions.txt
doc/hooks.txt
doc/mirc-colors.txt
doc/plugins.txt
Vendored Executable
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
override_dh_auto_configure:
dh_auto_configure -- --enable-ipv6 --with-ssl --with-plugins
override_dh_compress:
dh_compress --exclude=.bz2
%:
dh $@ --builddirectory=build
+5 -6
View File
@@ -36,7 +36,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -155,13 +155,13 @@ MFLAGS = \
## Makefile starts here.
ALL_PLUGINS = abot acro aim amp arcfour autocycle blowfish cavlink cdrom encrypt europa fserv hint identd nap nicklist pkga possum qbx qmail wavplay xmms
ALL_PLUGINS = abot acro amp arcfour autocycle blowfish cavlink cdrom encrypt europa fserv hint identd nap nicklist pkga possum qbx qmail wavplay xmms
#PLUGINS = abot acro aim arcfour autocycle blowfish cavlink encrypt europa fserv hint identd nap pkga possum qbx qmail wavplay
#PLUGINS = abot acro arcfour autocycle blowfish cavlink encrypt europa fserv hint identd nap pkga possum qbx qmail wavplay
PLUGINS = @PLUGINS@
.c.o:
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $<
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $<
$(SHLIB_SUFFIX).o:
$(SHLIB_LD) $(SHLIB_CFLAGS) $< -o $@$(SHLIB_SUFFIX)
@@ -186,7 +186,7 @@ dummy:
dllinit.o:
@( \
if test x"$(PLUGINS)" != x""; then \
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/dllinit.c; \
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/dllinit.c; \
fi; \
)
@@ -203,7 +203,6 @@ install: all
)
@( \
if test x"$(PLUGINS)" != x""; then \
strip --strip-unneeded $(DESTDIR)$(PLUGINDIR)/*$(SHLIB_SUFFIX) || :; \
echo Your plugins [$(PLUGINS)] are now located in $(PLUGINDIR);\
fi; \
)
+2 -2
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -160,7 +160,7 @@ Makefile: Makefile.in
&& ./config.status
autobot.o: $(srcdir)/autobot.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/autobot.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/autobot.c
autobot$(SHLIB_SUFFIX): autobot.o ../dllinit.o
$(SHLIB_LD) autobot.o ../dllinit.o $(SHLIB_CFLAGS) -o autobot$(SHLIB_SUFFIX)
+4
View File
@@ -198,8 +198,12 @@ UserList *new;
chop(buffer, 1);
u = buffer;
h = strchr(u, '!');
if (!h)
continue;
*h++ = 0;
p = strchr(h, ',');
if (!p)
continue;
*p++ = 0;
if ((c = strchr(p, ',')))
*c++ = 0;
+2 -2
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -160,7 +160,7 @@ Makefile: Makefile.in
&& ./config.status
acro.o: $(srcdir)/acro.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/acro.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/acro.c
acro$(SHLIB_SUFFIX): acro.o ../dllinit.o
$(SHLIB_LD) acro.o ../dllinit.o $(SHLIB_CFLAGS) -o acro$(SHLIB_SUFFIX)
+110 -146
View File
@@ -9,9 +9,9 @@ int Acro_Init(IrcCommandDll **intp, Function_ptr *global_table)
{
initialize_module("Acromania");
add_module_proc(RAW_PROC, "acro", "PRIVMSG", NULL, 0, 0, acro_main, NULL);
add_module_proc(COMMAND_PROC, "scores", "scores", NULL, 0, 0, put_scores, NULL);
add_module_proc(COMMAND_PROC, "acro", "scores", NULL, 0, 0, put_scores, NULL);
gscores = read_scores();
read_scores();
if (!game)
game = init_acro(game);
put_it("BitchX Acromania dll v0.9b by By-Tor loaded...");
@@ -51,7 +51,7 @@ static int acro_main (char *comm, char *from, char *userhost, char **args)
send_to_server("PRIVMSG %s :Round %d", args[0], game->round);
send_to_server("PRIVMSG %s :The acronym for this round is %s. You have 60 seconds.", args[0], game->nym);
send_to_server("PRIVMSG %s :/msg %s \"acro <your answer>\"", args[0], get_server_nickname(from_server));
add_timer(0, "Acro", 60 * 1000, 1, (int(*)(void *))warn_acro, m_sprintf("%s", args[0]), NULL, NULL, "acro");
add_timer(0, "Acro", 60 * 1000, 1, warn_acro, m_sprintf("%s", args[0]), NULL, -1, "acro");
}
return 0;
}
@@ -76,25 +76,30 @@ BUILT_IN_DLL(put_scores)
*/
}
void warn_acro(char *chan)
int warn_acro(void *arg, char *subarg)
{
char *chan = arg;
send_to_server("PRIVMSG %s :30 seconds! Puzzle is: %s", chan, game->nym);
add_timer(0, "Acro", 30 * 1000, 1, (int(*)(void *))start_vote, m_sprintf("%s", chan), NULL, NULL, "acro");
add_timer(0, "Acro", 30 * 1000, 1, start_vote, m_sprintf("%s", chan), NULL, -1, "acro");
return 0;
}
void start_vote(char *chan)
int start_vote(void *arg, char *subarg)
{
char *chan = arg;
if (game->players >= MINPLAYERS)
{
send_to_server("PRIVMSG %s :Time's up, lets vote!\r\nPRIVMSG %s :/msg %s \"acro #\" to vote", chan, chan, get_server_nickname(from_server));
game->progress = 2;
show_acros(player, chan);
add_timer(0, "Acro", 30 * 1000, 1, (int(*)(void *))warn_vote, m_sprintf("%s", chan), NULL, NULL, "acro");
add_timer(0, "Acro", 30 * 1000, 1, warn_vote, m_sprintf("%s", chan), NULL, -1, "acro");
}
else if (game->extended < EXTENSIONS)
{
send_to_server("PRIVMSG %s :Aww, too few players! Puzzle is: %s", chan, game->nym);
add_timer(0, "Acro", 30 * 1000, 1, (int(*)(void *))start_vote, m_sprintf("%s", chan), NULL, NULL, "acro");
add_timer(0, "Acro", 30 * 1000, 1, start_vote, m_sprintf("%s", chan), NULL, -1, "acro");
game->extended++;
}
else
@@ -104,16 +109,22 @@ void start_vote(char *chan)
game->players = 0;
game->progress = 0;
}
return 0;
}
void warn_vote(char *chan)
int warn_vote(void *arg, char *subarg)
{
char *chan = arg;
send_to_server("PRIVMSG %s :30 seconds left to vote!", chan);
add_timer(0, "Acro", 30 * 1000, 1, (int(*)(void *))end_voting, m_sprintf("%s", chan), NULL, NULL, "acro");
add_timer(0, "Acro", 30 * 1000, 1, end_voting, m_sprintf("%s", chan), NULL, -1, "acro");
return 0;
}
void end_voting(char *chan)
int end_voting(void *arg, char *subarg)
{
char *chan = arg;
put_it("END_VOTING");
send_to_server("PRIVMSG %s :Voting complete, sorting scores...", chan);
gscores = end_vote(voter, player, gscores);
@@ -137,7 +148,7 @@ void end_voting(char *chan)
send_to_server("PRIVMSG %s :Round %d", chan, game->round);
send_to_server("PRIVMSG %s :The acronym for this round is %s. You have 60 seconds.", chan, game->nym);
send_to_server("PRIVMSG %s :/msg %s \"acro <your answer>\"", chan, get_server_nickname(from_server));
add_timer(0, "Acro", 60 * 1000, 1, (int(*)(void *))warn_acro, m_sprintf("%s", chan), NULL, NULL, "acro");
add_timer(0, "Acro", 60 * 1000, 1, warn_acro, m_sprintf("%s", chan), NULL, -1, "acro");
}
else
{
@@ -147,6 +158,7 @@ void end_voting(char *chan)
new_free(&game->nym);
init_acro(game);
}
return 0;
}
grec *init_acro(grec *gtmp)
@@ -225,13 +237,10 @@ prec *take_acro(grec *acro, prec *players, char *nick, char *host, char *stuff)
prec *tmp, *last = NULL;
if (!players)
{
players = (prec *)new_malloc(sizeof(prec));
players->nick = (char *)new_malloc(strlen(nick)+1);
players->host = (char *)new_malloc(strlen(host)+1);
players->acro = (char *)new_malloc(strlen(stuff)+1);
strcpy(players->nick, nick);
strcpy(players->host, host);
strcpy(players->acro, stuff);
players = new_malloc(sizeof(prec));
players->nick = m_strdup(nick);
players->host = m_strdup(host);
players->acro = m_strdup(stuff);
send_to_server("PRIVMSG %s :Answer set to \"%s\"\r\nPRIVMSG %s :You are player #%d", nick, stuff, nick, ++acro->players);
return players;
}
@@ -253,8 +262,7 @@ prec *take_acro(grec *acro, prec *players, char *nick, char *host, char *stuff)
return players;
}
else {
tmp->last = (char *)new_malloc(strlen(stuff)+1);
strcpy(tmp->last, stuff);
tmp->last = m_strdup(stuff);
send_to_server("PRIVMSG %s :You already submitted an answer, submit once more to change.", nick);
return players;
}
@@ -263,13 +271,10 @@ prec *take_acro(grec *acro, prec *players, char *nick, char *host, char *stuff)
}
if (acro->players < MAXPLAYERS && last)
{
tmp = last->next = (prec *)new_malloc(sizeof(prec));
tmp->nick = (char *)new_malloc(strlen(nick)+1);
tmp->host = (char *)new_malloc(strlen(host)+1);
tmp->acro = (char *)new_malloc(strlen(stuff)+1);
strcpy(tmp->nick, nick);
strcpy(tmp->host, host);
strcpy(tmp->acro, stuff);
tmp = last->next = new_malloc(sizeof(prec));
tmp->nick = m_strdup(nick);
tmp->host = m_strdup(host);
tmp->acro = m_strdup(stuff);
send_to_server("PRIVMSG %s :Answer set to \"%s\"\r\nPRIVMSG %s :You are player #%d", nick, stuff, nick, ++acro->players);
}
else
@@ -295,12 +300,10 @@ vrec *take_vote(grec *acro, vrec *voters, prec *players, char *nick, char *host,
}
if (!voters)
{
voters = (vrec *)new_malloc(sizeof(vrec));
voters->nick = (char *)new_malloc(strlen(nick)+1);
voters->host = (char *)new_malloc(strlen(host)+1);
voters = new_malloc(sizeof(vrec));
voters->nick = m_strdup(nick);
voters->host = m_strdup(host);
voters->vote = atoi(num)-1;
strcpy(voters->nick, nick);
strcpy(voters->host, host);
send_to_server("PRIVMSG %s :Vote recorded...", nick);
return voters;
}
@@ -315,68 +318,52 @@ vrec *take_vote(grec *acro, vrec *voters, prec *players, char *nick, char *host,
}
if (last && !last->next)
{
last = last->next = (vrec *)new_malloc(sizeof(vrec));
last->nick = (char *)new_malloc(strlen(nick)+1+sizeof(char *));
last->host = (char *)new_malloc(strlen(host)+1+sizeof(char *));
last = last->next = new_malloc(sizeof(vrec));
last->nick = m_strdup(nick);
last->host = m_strdup(host);
last->vote = atoi(num)-1;
strcpy(last->nick, nick);
strcpy(last->host, host);
send_to_server("PRIVMSG %s :Vote recorded...", nick);
}
return voters;
}
srec *read_scores()
void read_scores(void)
{
srec *tmp, *tmp2;
char buff[100], *p;
FILE *sf;
tmp = tmp2 = (srec *)new_malloc(sizeof(srec));
memset(buff, 0, sizeof(buff));
sf = fopen(SCOREFILE, "r");
if (!sf)
return 0;
while (!feof(sf))
FILE *infile;
srec *record;
unsigned long score;
char nick[64];
infile = fopen(SCOREFILE, "r");
if (infile == NULL)
return;
while (fscanf(infile, " %63[^ ,] , %lu", nick, &score) == 2)
{
if (fgets(buff, 51, sf))
{
if (tmp->nick)
tmp = tmp->next = (srec *)new_malloc(sizeof(srec));
if (buff[strlen(buff)-1] == '\n')
buff[strlen(buff)-1] = 0;
if (!*buff)
break;
if ((p = (char *)strchr(buff, ',')))
*p++ = 0;
else if (!p)
{
return tmp2;
fclose(sf);
}
tmp->nick = (char *)new_malloc(strlen(buff+1));
strcpy(tmp->nick, buff);
if (p)
tmp->score = strtoul(p, NULL, 10);
}
else
break;
record = new_malloc(sizeof(srec));
record->nick = m_strdup(nick);
record->score = score;
add_to_list((List **)&gscores, (List *)record);
}
fclose(sf);
return tmp2;
fclose(infile);
}
int write_scores(srec *tmp)
{
FILE *sf;
if (!tmp)
return 0;
tmp = sort_scores(tmp);
sf = fopen(SCOREFILE, "w");
if (!sf)
return 0;
for (; tmp; tmp = tmp->next)
if (tmp->score > 0)
fprintf(sf, "%s,%lu\n", tmp->nick, tmp->score);
fclose(sf);
return 1;
}
@@ -401,7 +388,7 @@ srec *end_vote(vrec *voters, prec *players, srec *stmp)
prec *tmp2 = NULL;
srec *tmp3 = NULL, *last;
if (!stmp && voters && players)
stmp = (srec *)new_malloc(sizeof(srec));
stmp = new_malloc(sizeof(srec));
for (tmp = voters; tmp; tmp = tmp->next)
{
gotscore = 0;
@@ -410,8 +397,7 @@ srec *end_vote(vrec *voters, prec *players, srec *stmp)
tmp2 = tmp2->next;
if (stmp && !stmp->nick)
{
stmp->nick = (char *)new_malloc(strlen(tmp2->nick)+1);
strcpy(stmp->nick, tmp2->nick);
stmp->nick = m_strdup(tmp2->nick);
stmp->score = 1;
continue;
}
@@ -427,49 +413,25 @@ srec *end_vote(vrec *voters, prec *players, srec *stmp)
}
if (!gotscore)
{
tmp3 = last->next = (srec *)new_malloc(sizeof(srec));
tmp3->nick = (char *)new_malloc(strlen(tmp2->nick)+1);
strcpy(tmp3->nick, tmp2->nick);
tmp3 = last->next = new_malloc(sizeof(srec));
tmp3->nick = m_strdup(tmp2->nick);
tmp3->score = 1;
}
}
return stmp;
}
srec *sort_scores(srec *stmp)
{
int i = 0;
srec *tmp;
srec **sort, **ctmp;
if (!stmp->next)
return stmp;
for (tmp = stmp; tmp; tmp = tmp->next)
i++;
ctmp = sort = (srec **)new_malloc(i*sizeof(srec *));
put_it("START SORTING");
put_scores(NULL, NULL, NULL, NULL, NULL);
for (tmp = stmp; tmp; tmp = tmp->next)
*ctmp++ = tmp;
qsort((void *)sort, i+1, sizeof(srec *), (int (*)(const void *, const void *))comp_score);
ctmp = sort;
for (tmp = *ctmp++; *ctmp; ctmp++)
tmp = tmp->next = *ctmp;
tmp->next = NULL;
tmp = *sort;
new_free(&sort);
put_scores(NULL, NULL, NULL, NULL, NULL);
put_it("END SCORES");
return tmp;
}
/*
* Here we sort deeze babys ... The return values are "opposite" so we can
* sort in descending order instead of ascending... Stupid declarations had
* me going for a while, no wonder it didnt sort right at first! :)
*/
int comp_score(srec **one, srec **two)
static int comp_score(const void *a, const void *b)
{
srec * const *one = a;
srec * const *two = b;
if ((*one)->score > (*two)->score)
return -1;
if ((*one)->score < (*two)->score)
@@ -478,87 +440,89 @@ int comp_score(srec **one, srec **two)
return strcasecmp((*one)->nick, (*two)->nick);
}
srec *sort_scores(srec *stmp)
{
size_t n = 0;
srec *tmp;
srec **sort, **ctmp;
if (!stmp->next)
return stmp;
for (tmp = stmp; tmp; tmp = tmp->next)
n++;
ctmp = sort = (srec **)new_malloc(n * sizeof sort[0]);
put_it("START SORTING");
put_scores(NULL, NULL, NULL, NULL, NULL);
for (tmp = stmp; tmp; tmp = tmp->next)
*ctmp++ = tmp;
qsort(sort, n, sizeof sort[0], comp_score);
tmp = sort[0];
for (ctmp = &sort[1]; ctmp < &sort[n]; ctmp++)
{
tmp->next = *ctmp;
tmp = *ctmp;
}
tmp->next = NULL;
tmp = sort[0];
new_free(&sort);
put_scores(NULL, NULL, NULL, NULL, NULL);
put_it("END SCORES");
return tmp;
}
void show_acros(prec *players, char *chan)
{
prec *tmp;
int i = 1;
char *line, buff[201];
if (!players)
return;
line = (char *)new_malloc(513);
memset(buff, 0, sizeof(buff));
for (tmp = players; tmp; tmp = tmp->next)
{
snprintf(buff, 198, "PRIVMSG %s :%2d: %s", chan, i++, tmp->acro);
strcat(buff, "\r\n");
if (strlen(line)+strlen(buff) >= 512)
{
send_to_server("%s", line);
memset(line, 0, 513);
}
strcat(line, buff);
memset(buff, 0, sizeof(buff));
}
if (line)
send_to_server("%s", line);
new_free(&line);
send_to_server("PRIVMSG %s :%2d: %s", chan, i++, tmp->acro);
}
void show_scores(grec *acro, srec *score, srec *gscore, char *chan)
{
char *line, buff[201];
int i;
line = (char *)new_malloc(513);
memset(buff, 0, sizeof(buff));
if (score)
score = sort_scores(score);
if (gscore && (acro->round >= acro->rounds))
gscore = sort_scores(gscore);
if (acro->round < acro->rounds)
sprintf(line, "PRIVMSG %s :Scores for round %d\r\nPRIVMSG %s :Nick Score\r\nPRIVMSG %s :-----------------\r\n", chan, acro->round, chan, chan);
send_to_server("PRIVMSG %s :Scores for round %d\r\nPRIVMSG %s :Nick Score\r\nPRIVMSG %s :-----------------", chan, acro->round, chan, chan);
else
sprintf(line, "PRIVMSG %s :Game over, tallying final scores...\r\nPRIVMSG %s : Game Score Overall Score\r\nPRIVMSG %s :Nick Score Nick Score\r\nPRIVMSG %s :----------------- -----------------\r\n", chan, chan, chan, chan);
send_to_server("PRIVMSG %s :Game over, tallying final scores...\r\nPRIVMSG %s : Game Score Overall Score\r\nPRIVMSG %s :Nick Score Nick Score\r\nPRIVMSG %s :----------------- -----------------", chan, chan, chan, chan);
for (i = 0; i < acro->top && (score || gscore); i++)
{
if ((acro->round < acro->rounds) && score)
{
snprintf(buff, 198, "PRIVMSG %s :%-9s %lu", chan, score->nick, score->score);
strcat(buff, "\r\n");
send_to_server("PRIVMSG %s :%-9s %lu", chan, score->nick, score->score);
score = score->next;
}
else if (acro->round == acro->rounds && (score || gscore))
{
if (!score && gscore)
{
snprintf(buff, 198, "PRIVMSG %s : %-9s %lu", chan, gscore->nick, gscore->score);
strcat(buff, "\r\n");
send_to_server("PRIVMSG %s : %-9s %lu", chan, gscore->nick, gscore->score);
gscore = gscore->next;
}
else if (score && !gscore)
{
snprintf(buff, 198, "PRIVMSG %s :%-9s %lu", chan, score->nick, score->score);
strcat(buff, "\r\n");
send_to_server("PRIVMSG %s :%-9s %lu", chan, score->nick, score->score);
score = score->next;
}
else if (gscore && score)
{
snprintf(buff, 198, "PRIVMSG %s :%-9s %-5lu %-9s %lu", chan, score->nick, score->score, gscore->nick, gscore->score);
strcat(buff, "\r\n");
send_to_server("PRIVMSG %s :%-9s %-5lu %-9s %lu", chan, score->nick, score->score, gscore->nick, gscore->score);
gscore = gscore->next;
score = score->next;
}
}
if (strlen(line)+strlen(buff) >= 512)
{
send_to_server("%s", line);
memset(line, 0, 513);
}
strcat(line, buff);
memset(buff, 0, sizeof(buff));
}
if (line)
send_to_server("%s", line);
new_free(&line);
}
void free_round(prec **players, vrec **voters)
+6 -7
View File
@@ -72,9 +72,9 @@ typedef struct {
/* srec -- linked list of scores */
typedef struct _srec {
struct _srec *next;
char *nick;
unsigned long score;
struct _srec *next;
} srec;
struct settings {
@@ -98,18 +98,17 @@ BUILT_IN_DLL(put_scores);
grec *init_acro(grec *);
void make_acro(grec *);
int valid_acro(grec *, char *);
srec *read_scores(void);
void read_scores(void);
int write_scores(srec *);
prec *take_acro(grec *, prec *, char *, char *, char *);
vrec *take_vote(grec *, vrec *, prec *, char *, char *, char *);
srec *end_vote(vrec *, prec *, srec *);
srec *sort_scores(srec *);
int comp_score(srec **one, srec **two);
void show_scores(grec *, srec *, srec *, char *);
void warn_acro(char *);
void start_vote(char *);
void warn_vote(char *);
void end_voting(char *);
int warn_acro(void *, char *);
int start_vote(void *, char *);
int warn_vote(void *, char *);
int end_voting(void *, char *);
void show_acros(prec *, char *);
void free_round(prec **, vrec **);
void free_score(srec **);
-199
View File
@@ -1,199 +0,0 @@
SHELL = @SHELL@
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
topdir = @topdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = @oldincludedir@
local_dir = $(HOME)
# Where the BitchX binary will be installed.
# "make install" will compile and install the program.
INSTALL_IRC = @INSTALL_IRC@
# Where the BitchX library will be. Generally this is the place that
# you put the scripts, help pages and translation tables. It is
# very important that you set this correctly.
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
LIBS = @LIBS@
# Tcl library.
TCL_LIBS = @TCL_LIBS@
# These are for Tcl support.
TCL_OBJS = @TCL_OBJS@
# You don't have the following, so you'll want to leave this blank.
TCL_SRCS = @TCL_SRCS@
# Set this to -g if you want to be able to debug the client, otherwise
# use -O to have the compiler do some optimization instead.
CFLAGS = @CFLAGS@
# Set this to -s if you want the binary to be stripped.
LDFLAGS = @LDFLAGS@
# These are for the cd device player.
CD_SRCS = @CD_SRCS@
CD_OBJS = @CD_OBJS@
# This is the executable suffix for the target operating system.
EXEEXT = @EXEEXT@
# Extra files.
DEFAULT_CTOOLZ_DIR = @DEFAULT_CTOOLZ_DIR@
DEFAULT_MSGLOGFILE = @DEFAULT_MSGLOGFILE@
DEFAULT_BITCHX_HELP_FILE = @DEFAULT_BITCHX_HELP_FILE@
DEFAULT_SCRIPT_HELP_FILE = @DEFAULT_SCRIPT_HELP_FILE@
DEFAULT_BITCHX_KICK_FILE = @DEFAULT_BITCHX_KICK_FILE@
DEFAULT_BITCHX_QUIT_FILE = @DEFAULT_BITCHX_QUIT_FILE@
DEFAULT_BITCHX_IRCNAME_FILE = @DEFAULT_BITCHX_IRCNAME_FILE@
# Full path of the directory for BitchX help files.
HELPDIR = @HELPDIR@
# Full path of the directory for the BitchX scripts.
INSTALL_SCRIPT = @INSTALL_SCRIPT@
# Default setting for IRCPATH where BitchX will look for
# its script files if the environment variable is undefined.
# Usually, this should contain the same path as used for INSTALL_SCRIPT in
# the Makefile, but it can contain multiple path elements
# separated by colons. The path MUST lead to an existing directory,
# because the 'global' script is expected to be found there.
IRCPATH = @IRCPATH@
# Path for TRANSLATION variable.
TRANSLATION_PATH = @TRANSLATION_PATH@
# This is where the optional plugins will be copied to.
PLUGINDIR = @PLUGINDIR@
# Plugin flags.
SHLIB_LD = @SHLIB_LD@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
SHLIB_SUFFIX = @SHLIB_SUFFIX@
# This command will be used to install the BitchX files on Win32/OS2EMX
# systems.
WINNT_INSTALL = @WINNT_INSTALL@
# This program allows you to use screen/xterm's to put new BitchX windows
# on new screen/xterm windows.
INSTALL_WSERV = @INSTALL_WSERV@
# This program allows you to screen BitchX and reattach to it later.
INSTALL_SCRBX = @INSTALL_SCRBX@
# Set gzip and bzip2 options.
GZIP_ENV = @GZIP_ENV@
BZIP2 = @BZIP2@
# Standard programs.
RM = @RM@
LN = @LN_S@
CP = @CP@
MV = @MV@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
VERSION = @VERSION@
_VERSION_ = @_VERSION_@
MAKE_BIN = @MAKE@
MAKE = $(MAKE_BIN) $(MFLAGS)
MFLAGS = \
'local_dir=$(HOME)' \
'INSTALL_IRC=$(INSTALL_IRC)' \
'IRCLIB=$(IRCLIB)' \
'CC=$(CC)' \
'CFLAGS=$(CFLAGS)' \
'HELPDIR=$(HELPDIR)' \
'INSTALL_WSERV=$(INSTALL_WSERV)' \
'IRCPATH=$(IRCPATH)' \
'TRANSLATION_PATH=$(TRANSLATION_PATH)' \
'LDFLAGS=$(LDFLAGS)' \
'LIBS=$(LIBS)' \
'LN=$(LN)' \
'RM=$(RM)' \
'TCL_SRCS=$(TCL_SRCS)' \
'TCL_OBJS=$(TCL_OBJS)' \
'CD_PLAY=$(CD_PLAY)' \
'CD_SRCS=$(CD_SRCS)' \
'CD_OBJS=$(CD_OBJS)' \
'TCL_LIBS=$(TCL_LIBS)' \
'PLUGINDIR=$(PLUGINDIR)' \
'_VERSION_=$(_VERSION_)' \
'VERSION=$(VERSION)' \
'INSTALL_DATA=$(INSTALL_DATA)' \
'INSTALL_SCRIPT=$(INSTALL_SCRIPT)' \
'EXEEXT=$(EXEEXT)' \
'SHLIB_CFLAGS=$(SHLIB_CFLAGS)' \
'SHLIB_SUFFIX=$(SHLIB_SUFFIX)'
## Makefile starts here.
AIMDEFS = $(DEFS) -I$(srcdir)/toc
PLUGIN_NAME = aim
OBJS = toc.o util.o cmd.o aim.o compat.o
all: Makefile toc aim$(SHLIB_SUFFIX)
Makefile: Makefile.in
cd $(topdir) \
&& ./config.status
compat.o: $(top_srcdir)/source/compat.c
$(CC) $(AIMDEFS) $(SHLIB_CFLAGS) $(CFLAGS) \
-c $(top_srcdir)/source/compat.c
toc.o: $(srcdir)/toc.c
$(CC) $(AIMDEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/toc.c
util.o: $(srcdir)/util.c
$(CC) $(AIMDEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/util.c
cmd.o: $(srcdir)/cmd.c
$(CC) $(AIMDEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/cmd.c
aim.o: $(srcdir)/aim.c
$(CC) $(AIMDEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/aim.c
aim$(SHLIB_SUFFIX): $(OBJS)
$(SHLIB_LD) $(OBJS) $(SHLIB_CFLAGS) -o aim$(SHLIB_SUFFIX) -Ltoc -ltoc
dummy:
toc: dummy
@(cd toc && $(MAKE) all)
clean:
cd toc && $(MAKE) clean
$(RM) *~ *.o *.so *.a *.dll *.def .#*
distclean: clean
cd toc && $(MAKE) distclean
$(RM) Makefile
install:
$(INSTALL) $(PLUGIN_NAME)$(SHLIB_SUFFIX) $(DESTDIR)$(PLUGINDIR)
-7
View File
@@ -1,7 +0,0 @@
Quite a bit borrowed from the napster module written by panasync.
libtoc (backened) was written (put together) by me also, and is mostly
composed of code from gaim (see freshmeat).
bx.patch is a small patch to modify bx to allow custom module completion
routines. If not patched, just remove -DBITCHX_PATCH from CFLAGS in the
Makefile
-409
View File
@@ -1,409 +0,0 @@
/*
* AOL Instant Messanger Module for BitchX
*
* By Nadeem Riaz (nads@bleh.org)
*
* aim.c
*
* Window, Init, Cleanup, and Version Routines
*/
#include <irc.h>
#include <struct.h>
#include <hook.h>
#include <ircaux.h>
#include <output.h>
#include <lastlog.h>
#include <status.h>
#include <vars.h>
#include <window.h>
#include <input.h>
#include <module.h>
#define INIT_MODULE
#include <modval.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "toc.h"
#include "aim.h"
char *name = "aim";
char *timer_id;
#ifdef BITCHX_PATCH
struct tab_key_struct tks;
int do_aim_tabkey_overwrite(int x, char *p, int *c, char **s) {
if ( get_dllint_var("aim_window") && current_window == get_window_by_name("AIM") )
return 1;
else
return 0;
}
char * get_next_buddy_complete() {
char *bud = NULL;
int a;
LLE t;
/*
* This is about as badly written as humany possible
* ^- some would say its even worse than that
*/
while ( 1 ) {
if ( tks.list == 1 ) {
/* We traverse the buddy list forwards */
LL mems;
if ( tks.pos > groups->items ) {
break;
}
t = groups->head;
for (a=0; a < tks.pos; a++)
t = t->next;
mems = ((struct group *)t->data)->members;
if ( tks.subpos == -1 )
tks.subpos = 1;
if ( tks.subpos > mems->items ) {
tks.pos++;
continue;
}
t = mems->head;
for (a=0; a<tks.subpos; a++)
t = t->next;
tks.subpos++;
bud = t->key;
break;
} else {
/* Traverse the msd'd them list in reverse (last msg'd = first completed) */
t = msgdthem->head;
tks.list = 0;
/* If we haven't msg'd anyone yet, go through the buddy list */
if ( msgdthem == NULL || msgdthem->items == 0) {
debug_printf("msgdthem == null or has no items");
tks.list = 1;
tks.pos = 1;
tks.subpos = -1;
continue;
}
/* Initilization */
if ( tks.pos == -1 ) {
debug_printf("set tks.pos to %d",msgdthem->items);
tks.pos = msgdthem->items;
}
for (a=0; a < tks.pos; a++) {
t = t->next;
}
bud = t->key;
debug_printf("tks.pos == %d name = %s",tks.pos,t->key);
tks.pos--;
/* No more msg'd them nicks, next call we switch over to buddy list */
if ( tks.pos == 0 ) {
tks.list = 1;
tks.pos = 1;
tks.subpos = -1;
}
break;
}
}
return bud;
}
char * aim_tabkey_overwrite(int x, char *p, int *c, char **s) {
char *z = NULL;
char *bud = NULL;
char *t;
(*c) = 0;
if ( state != STATE_ONLINE )
return NULL;
bud = get_next_buddy_complete();
if ( bud == NULL )
return NULL;
debug_printf("bud = %s",bud);
t = (char *) malloc(strlen(bud)+50);
sprintf(t,"/amsg %s ",bud);
m_s3cat(&z,space,t);
(*c) = 1;
return z;
}
char * amsg_complete_func(int x, char *p, int *c, char **s) {
/* statusprintf("x = %d",x); */
char *z = NULL;
char *inp;
int wc;
LLE g,m;
LL l;
(*c) = 0;
if ( state != STATE_ONLINE )
return NULL;
l = CreateLL();
debug_printf("possible = '%s' len = %d",p,strlen(p));
inp = m_strdup( get_input() ? get_input() : empty_string);
wc = word_count(inp);
debug_printf("input = %s wc = %d",inp,wc);
new_free(&inp);
if ( wc > 2 )
return NULL;
/* First go through people we've msg'd already */
for ( TLL(msgdus,g) ) {
if ( p && my_strnicmp(p, g->key, strlen(p)) )
continue;
AddToLL(l,g->key,NULL);
}
/* Then people who msg'd us */
for ( TLL(msgdthem,g) ) {
if ( p && my_strnicmp(p, g->key, strlen(p)) )
continue;
if ( ! FindInLL(l,g->key) )
AddToLL(l,g->key,NULL);
}
/* And last, the Buddy */
for ( TLL(groups,g) ) {
struct group *grp = (struct group *)g->data;
for ( TLL(grp->members,m) ) {
struct buddy *bud = (struct buddy *)m->data;
if ( p && my_strnicmp(p, bud->name, strlen(p)) )
continue;
if ( ! FindInLL(l,bud->name) )
AddToLL(l,bud->name,NULL);
}
}
if ( l->items == 1 && ! strcasecmp(l->head->next->key,p) ) {
char *bud = NULL;
(*c) = 1;
bud = get_next_buddy_complete();
debug_printf("We are going to go to get_next_buddy_comp!");
if ( bud )
m_s3cat(&z,space,bud);
else
debug_printf("set z to null because bud is null");
} else {
for( TLL(l,g) ) {
(*c)++;
debug_printf("adding %s",g->key);
m_s3cat(&z,space,g->key);
}
}
debug_printf("in test func!, p = %s",p);
FreeLL(l);
return (z);
}
#endif /* BITCHX_PATCH */
/* Window code, straight from nap module by panasync */
void update_aim_window(Window *tmp) {
char statbuff[1024];
char st[1024];
char *t;
char s[80];
int numbuds_online, numbuds_total;
if ( state == STATE_ONLINE ) {
t= ctime(&login_time);
t[strlen(t)-6] = '\0'; /* remove \n, year, & space -- NOT Y10K READY !@! */
sprintf(st,"Online since: %s", t);
} else
strcpy(st,"Offline");
if ( is_idle ) {
strcpy(s,"(Idle)");
} else if ( is_away ) {
strcpy(s,"(Away)");
} else {
strcpy(s,"");
}
/* Find the number of buddies online */
numbuds_online = numbuds_total = 0;
if ( groups != NULL ) {
LLE g,b;
struct group *grp;
struct buddy *bud;
for ( TLL(groups,g) ) {
grp = (struct group *) g->data;
numbuds_total += grp->members->items;
for( TLL(grp->members,b) ) {
bud = (struct buddy *) b->data;
if ( bud->present)
numbuds_online++;
}
}
}
sprintf(statbuff, " Buddies: %d/%d Lag: %d Evil: %d %s %%>%s ", numbuds_online, numbuds_total,(lag_ms / 1000000),my_evil,s,st);
set_wset_string_var(tmp->wset, STATUS_FORMAT1_WSET, statbuff);
sprintf(statbuff, " %%>%s ", st);
set_wset_string_var(tmp->wset, STATUS_FORMAT2_WSET, statbuff);
update_window_status(tmp, 1);
}
int build_aim_status(Window *tmp)
{
Window *tmp1;
if (!(tmp1 = tmp))
tmp1 = get_window_by_name("AIM");
if (tmp1)
{
update_aim_window(tmp1);
build_status(tmp1, NULL, 0);
update_all_windows();
return 1;
}
return 0;
}
void toggle_aimwin_hide (Window *win, char *unused, int onoff) {
Window *tmp;
if ((tmp = get_window_by_name("AIM")))
{
if (onoff)
{
if (tmp->screen)
hide_window(tmp);
build_aim_status(tmp);
update_all_windows();
cursor_to_input();
}
else
{
show_window(tmp);
resize_window(2, tmp, 6);
build_aim_status(tmp);
update_all_windows();
cursor_to_input();
}
}
}
void toggle_aimwin (Window *win, char *unused, int onoff){
Window *tmp;
if (onoff)
{
if ((tmp = get_window_by_name("AIM")))
return;
if ((tmp = new_window(win->screen)))
{
resize_window(2, tmp, 6);
tmp->name = m_strdup("AIM");
#undef query_cmd
tmp->query_cmd = m_strdup("asay");
tmp->double_status = 0;
tmp->absolute_size = 1;
tmp->update_status = update_aim_window;
tmp->server = -2;
set_wset_string_var(tmp->wset, STATUS_FORMAT1_WSET, NULL);
set_wset_string_var(tmp->wset, STATUS_FORMAT2_WSET, NULL);
set_wset_string_var(tmp->wset, STATUS_FORMAT3_WSET, NULL);
set_wset_string_var(tmp->wset, STATUS_FORMAT_WSET, NULL);
if (get_dllint_var("aim_window_hidden"))
hide_window(tmp);
else
set_screens_current_window(tmp->screen, tmp);
build_aim_status(tmp);
update_all_windows();
cursor_to_input();
}
}
else
{
if ((tmp = get_window_by_name("AIM")))
{
if (tmp == target_window)
target_window = NULL;
delete_window(tmp);
update_all_windows();
cursor_to_input();
}
}
}
char *Aim_Version(IrcCommandDll *intp) {
return AIM_VERSION;
}
int Aim_Cleanup(IrcCommandDll **interp, Function_ptr *global_table) {
if ( state == STATE_ONLINE )
toc_signoff();
#ifdef BITCHX_PATCH
overwrite_tabkey_comp(NULL,NULL);
debug_printf("Didn't remove completions, thats probably gonna cause problems");
#endif
remove_module_proc(VAR_PROC, name, NULL, NULL);
remove_module_proc(COMMAND_PROC,name,NULL,NULL);
remove_module_proc(ALIAS_PROC,name,NULL,NULL);
return 3;
}
int Aim_Init(IrcCommandDll **interp, Function_ptr *global_table) {
char buffer[BIG_BUFFER_SIZE+1];
char *p;
initialize_module(name);
add_module_proc(VAR_PROC, name, "aim_user", NULL, STR_TYPE_VAR, 0, NULL, NULL);
add_module_proc(VAR_PROC, name, "aim_pass", NULL, STR_TYPE_VAR, 0, NULL, NULL);
add_module_proc(VAR_PROC, name, "aim_prompt", (char *)convert_output_format("%K[%YAIM%K]%n ", NULL, NULL), STR_TYPE_VAR, 0, NULL, NULL);
add_module_proc(VAR_PROC, name, "aim_permdeny_mode", NULL, INT_TYPE_VAR, 1, NULL, NULL);
add_module_proc(VAR_PROC, name, "aim_toc_host", TOC_HOST, STR_TYPE_VAR, 0, NULL, NULL);
add_module_proc(VAR_PROC, name, "aim_toc_port", NULL, INT_TYPE_VAR, TOC_PORT, NULL, NULL);
add_module_proc(VAR_PROC, name, "aim_auth_host", AUTH_HOST, STR_TYPE_VAR, 0, NULL, NULL);
add_module_proc(VAR_PROC, name, "aim_auth_port", NULL, INT_TYPE_VAR, AUTH_PORT, NULL, NULL);
add_module_proc(VAR_PROC, name, "aim_permdeny_mode", NULL, INT_TYPE_VAR, 1, NULL, NULL);
add_module_proc(VAR_PROC, name, "aim_minutes_to_idle", NULL, INT_TYPE_VAR, time_to_idle/60, achange_idle, NULL);
add_module_proc(VAR_PROC, name, "aim_window", NULL, BOOL_TYPE_VAR, 0, toggle_aimwin, NULL);
add_module_proc(VAR_PROC, name, "aim_window_hidden", NULL, BOOL_TYPE_VAR, 0, toggle_aimwin_hide, NULL);
add_module_proc(COMMAND_PROC, name, "amsg", "amsg", 0, 0, amsg, "<screen name|buddy chat> <message> instant messages");
add_module_proc(COMMAND_PROC, name, "asignon", "asignon", 0, 0, asignon, "logs into aol instant messanger");
add_module_proc(COMMAND_PROC, name, "asignoff", "asignoff", 0, 0, asignoff, "logs off of aol instant messanger");
add_module_proc(COMMAND_PROC, name, "abl", "abl", 0, 0, abl, "<command> <args...> Modify your buddy list\n/abl show -- Shows buddy list\n/abl add [group] <buddy> -- Adds buddy to group in buddy list\n/abl del <buddy> Removes buddy from buddy llist\n/abl addg <group> Create group group\n/abl delg <group> <newgroup|1> delete group group");
add_module_proc(COMMAND_PROC, name, "apd", "apd", 0, 0, apd, "<command> <args...> Modify your permit/deny lists\n/apd show -- Shows your permit & deny list\n/apd mode <permitall|denyall|permitsome|denysome> -- change your mode\n/apd addp <sn> -- Adds sn to your permit list\n/apd delp <sn> -- Removes sn from your permit list\n/apd addd <sn> -- Adds <sn> to your deny list\n/apd deld <sn> -- Removes sn from your deny list");
add_module_proc(COMMAND_PROC, name, "adir", "adir", 0, 0, adir, "<command> <args...> Use the user directory\n/adir get <sn> Get sn's dir info\n/adir search -- Not implemented yet\n/adir set <first name> <middle name> <last name> <maiden name> <city> <state> <country> <email> <allow web searches? 1|0>");
add_module_proc(COMMAND_PROC, name, "awarn", "awarn", 0, 0, awarn, "<aim screen name> [anon] warns user");
add_module_proc(COMMAND_PROC, name, "awhois", "awhois", 0, 0, awhois, "<screen name> displays info on sn (sn has to be in buddy list)");
add_module_proc(COMMAND_PROC, name, "asave", "asave", 0, 0, asave, "Saves AIM settings");
add_module_proc(COMMAND_PROC, name, "asay", "asay", 0, 0, achat, "<message> send a message to the current buddy chat");
add_module_proc(COMMAND_PROC, name, "apart", "apart", 0, 0, achat, "<buddy chat> leave buddy chat");
add_module_proc(COMMAND_PROC, name, "ajoin", "ajoin", 0, 0, achat, "<buddy chat> join buddy chat (first searches invite list, if its in it then joins that one, otherwise creats anew)");
add_module_proc(COMMAND_PROC, name, "achats", "achats", 0, 0, achat, "display buddy chats you are on");
add_module_proc(COMMAND_PROC, name, "ainvite", "ainvite", 0, 0, achat, "<screen name> <buddy chat> <msg> invite user to buddy chat with msg");
add_module_proc(COMMAND_PROC, name, "anames", "anames", 0, 0, achat, "<buddy chat>");
add_module_proc(COMMAND_PROC, name, "acwarn", "acwarn", 0, 0, achat, "<buddy chat> <screen name> <anon>");
add_module_proc(COMMAND_PROC, name, "aaway", "aaway", 0, 0, aaway, "<away msg> Go away or come back if away");
add_module_proc(COMMAND_PROC, name, "aquery", "aquery", 0, 0, aquery, "query user");
add_module_proc(COMMAND_PROC, name, "ainfo", "ainfo", 0, 0, ainfo, "<command> <args>\n/ainfo set <your info...> Sets your info\n/ainfo get <screen name> Retreives sn's info");
#ifdef BITCHX_PATCH
add_completion_type("amsg", 2, CUSTOM_COMPLETION, &amsg_complete_func);
overwrite_tabkey_comp(&do_aim_tabkey_overwrite,&aim_tabkey_overwrite);
#endif
statusprintf("Aol Instant Messanger Module Loaded");
sprintf(buffer, "$0+AIM %s by panasync - $2 $3", AIM_VERSION);
fset_string_var(FORMAT_VERSION_FSET, buffer);
snprintf(buffer, BIG_BUFFER_SIZE, "%s/AIM.sav", get_string_var(CTOOLZ_DIR_VAR));
p = expand_twiddle(buffer);
load("LOAD", p, empty_string, NULL);
new_free(&p);
bx_init_toc();
return 0;
}
-88
View File
@@ -1,88 +0,0 @@
#ifndef _AIM_H
#define _AIM_H
#define AIM_VERSION "0.02"
#define AIM_DEBUG_LOG "/tmp/aim-bx.log"
/* Twice the actual length, we should never have problems */
#define MAX_STATUS_MSG_LEN 4096
#define cparse convert_output_format
/* Macro Fun */
#define CHECK_TOC_ONLINE() if ( state != STATE_ONLINE ) { statusprintf("Please connect to aim first (/asignon)"); return; }
#define VALID_ARG(x) !(!x || ! *x || ! strcasecmp(x,""))
#define REQUIRED_ARG(x,y,z) if ( ! VALID_ARG(x) ) { userage(y,z); return; }
/* cmd.c */
void asignon(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg);
void asignoff(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void amsg(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void abl(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg);
void apd(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg);
void awarn(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void apermdeny(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void aspermdeny(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void aarpermitdeny(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void awhois(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void asave (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void achat (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void adir (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void aaway (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg);
void aquery(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg);
void ainfo(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg);
void achange_idle(Window *w, char *s, int i);
extern char current_chat[512];
extern char away_message[2048];
extern LL msgdus;
extern LL msgdthem;
/* toc.c */
void bx_init_toc();
int toc_add_input_stream(int fd,int (*func)(int));
int toc_remove_input_stream(int fd) ;
int toc_main_interface(int type, char **args);
int toc_timer(int type, char **args);
extern void (*chatprintf)(char *, ...);
/* aim.c */
#ifdef BITCHX_PATCH
char * amsg_complete_func(int, char *, int *, char **);
char * get_next_buddy_complete();
int do_aim_tabkey_overwrite(int x, char *p, int *c, char **s);
char * aim_tabkey_overwrite(int x, char *p, int *c, char **s);
#endif
void update_aim_window(Window *tmp);
int build_aim_status(Window *tmp);
void toggle_aimwin_hide (Window *win, char *unused, int onoff);
void toggle_aimwin (Window *win, char *unused, int onoff);
int Aim_Cleanup(IrcCommandDll **interp, Function_ptr *global_table);
int Aim_Init(IrcCommandDll **interp, Function_ptr *global_table);
char *Aim_Version(IrcCommandDll *intp);
extern char *name;
extern char *timer_id;
#ifdef BITCHX_PATCH
struct tab_key_struct {
int list;
int pos;
int subpos;
};
extern struct tab_key_struct tks;
#endif
/* util.c */
void statusprintf(char *fmt, ...);
void statusput(int log_type, char *buf);
void msgprintf(char *fmt, ...);
void debug_printf(char *fmt, ...);
char *rm_space(char *s);
#endif /* _AIM_H */
-294
View File
@@ -1,294 +0,0 @@
--- .//dll/fserv/fserv.c.orig Tue Jan 18 21:00:07 2000
+++ .//dll/fserv/fserv.c Tue Jan 18 21:00:19 2000
@@ -1162,7 +1162,7 @@
add_module_proc(HOOK_PROC, "Fserv", NULL, "*", MSG_LIST, 1, NULL, search_proc);
add_module_proc(HOOK_PROC, "Fserv", NULL, "*", PUBLIC_OTHER_LIST, 1, NULL, search_proc);
- add_completion_type("fsload", 3, FILE_COMPLETION);
+ add_completion_type("fsload", 3, FILE_COMPLETION,NULL);
add_timer(0, empty_string, get_dllint_var("fserv_time"), 1, impress_me, NULL, NULL, -1, "fserv");
strcpy(FSstr, cparse(FS, NULL, NULL));
@@ -1177,4 +1177,4 @@
put_it("%s for help with this fserv, /fshelp", FSstr);
return 0;
}
-
\ No newline at end of file
+
--- .//dll/nap/nap.c.orig Wed Jan 19 14:17:52 2000
+++ .//dll/nap/nap.c Tue Jan 18 21:01:34 2000
@@ -2139,8 +2139,8 @@
add_module_proc(VAR_PROC, nap_name, "napster_format", NULL, STR_TYPE_VAR, 0, set_numeric_string, NULL);
add_module_proc(VAR_PROC, nap_name, "napster_dir", NULL, STR_TYPE_VAR, 0, NULL, NULL);
- add_completion_type("nload", 4, FILE_COMPLETION);
- add_completion_type("nreload", 4, FILE_COMPLETION);
+ add_completion_type("nload", 4, FILE_COMPLETION,NULL);
+ add_completion_type("nreload", 4, FILE_COMPLETION,NULL);
naphelp(NULL, NULL, NULL, NULL, NULL);
sprintf(buffer, "$0+Napster %s by panasync - $2 $3", nap_version);
--- .//include/module.h.orig Tue Jan 18 01:24:49 2000
+++ .//include/module.h Tue Jan 18 20:29:36 2000
@@ -633,7 +633,14 @@
CHECK_EXT_MAIL,
DEFAULT_OUTPUT_FUNCTION,
DEFAULT_STATUS_OUTPUT_FUNCTION,
- NUMBER_OF_GLOBAL_FUNCTIONS
+ NUMBER_OF_GLOBAL_FUNCTIONS,
+
+/* window.c again */
+ WINDOW_QUERY,
+
+/* input.c again */
+
+ OVERWRITE_TABKEY_COMP
};
extern Function_ptr global_table[];
--- .//include/modval.h.orig Tue Jan 18 16:50:22 2000
+++ .//include/modval.h Tue Jan 18 20:28:58 2000
@@ -360,7 +360,8 @@
#define getnextnick(x, y, z, a) ((NickTab *) (global[GETNEXTNICK]((int)x, (char *)y, (char *)z, (char *)a)))
#define getchannick(x, y) ((char *) (global[GETCHANNICK]((char *)x, (char *)y)))
#define lookup_nickcompletion(x, y) ((NickList *) (global[LOOKUP_NICKCOMPLETION]((ChannelList *)x, (char *)y)))
-#define add_completion_type(x, y, z) ((int) (global[ADD_COMPLETION_TYPE]((char *)x, (int)y, (enum completion)z)))
+#define add_completion_type(x, y, z, a) ((int) (global[ADD_COMPLETION_TYPE]((char *)x, (int)y, (enum completion)z, a)))
+#define overwrite_tabkey_comp(a,b) (global[OVERWRITE_TABKEY_COMP](a,b))
/* names.c */
#define is_channel(x) ((int) (global[IS_CHANNEL]((char *)x)))
--- .//include/input.h.orig Tue Jan 18 16:23:49 2000
+++ .//include/input.h Thu Jan 20 17:05:28 2000
@@ -157,11 +157,15 @@
DCC_COMPLETION,
LOAD_COMPLETION,
SERVER_COMPLETION,
- CDCC_COMPLETION
+ CDCC_COMPLETION,
+ CUSTOM_COMPLETION,
+ TABKEY_OVERWRITE
};
- char *get_completions (enum completion, char *, int *, char **);
- int add_completion_type (char *, int, enum completion);
+ char *get_completions (enum completion *, char *, int *, char **, char * (*)(int, char *, int *, char **));
+ int add_completion_type (char *, int, enum completion, char * (*)(int, char *, int *, char **));
+
+void overwrite_tabkey_comp(int (*)(int, char *, int *, char **), char * (*)(int, char *, int *, char **));
extern NickTab *tabkey_array;
extern NickTab *autoreply_array;
--- .//source/modules.c.orig Tue Jan 18 01:38:07 2000
+++ .//source/modules.c Tue Jan 18 20:53:49 2000
@@ -423,6 +423,7 @@
global_table[RECALCULATE_WINDOW_CURSOR] = (Function_ptr) recalculate_window_cursor;
global_table[MAKE_WINDOW_CURRENT] = (Function_ptr) make_window_current;
global_table[CLEAR_SCROLLBACK] = (Function_ptr) clear_scrollback;
+ global_table[WINDOW_QUERY] = (Function_ptr) window_query;
global_table[RESET_DISPLAY_TARGET] = (Function_ptr) reset_display_target;
global_table[SET_DISPLAY_TARGET] = (Function_ptr) set_display_target;
@@ -475,6 +476,7 @@
global_table[GETCHANNICK] = (Function_ptr) getchannick;
global_table[LOOKUP_NICKCOMPLETION] = (Function_ptr) lookup_nickcompletion;
global_table[ADD_COMPLETION_TYPE] = (Function_ptr) add_completion_type;
+ global_table[OVERWRITE_TABKEY_COMP] = (Function_ptr) overwrite_tabkey_comp;
/* names.c */
global_table[IS_CHANOP] = (Function_ptr) is_chanop;
--- .//source/input.c.orig Tue Jan 18 15:58:30 2000
+++ .//source/input.c Thu Jan 20 20:10:02 2000
@@ -62,6 +62,9 @@
NickTab *tabkey_array = NULL, *autoreply_array = NULL;
+int (*do_over_write_tabkey_complete)(int, char *, int *, char **) = NULL;
+char * (*over_write_tabkey_complete_func)(int, char *, int *, char **) = NULL;
+
const int WIDTH = 10;
@@ -2119,7 +2122,8 @@
struct _ext_name_type *next;
char *name;
int len;
- enum completion type;
+ enum completion type;
+ char * (*comp_func)(int, char *, int *, char **);
} Ext_Name_Type;
Ext_Name_Type *ext_completion = NULL;
@@ -2161,7 +2165,14 @@
return NULL;
}
-char *get_completions(enum completion type, char *possible, int *count, char **suggested)
+void overwrite_tabkey_comp(int (*check)(int, char *, int *, char **) , char * (*overwrite)(int, char *, int *, char **) )
+{
+ do_over_write_tabkey_complete = check;
+ over_write_tabkey_complete_func = overwrite;
+ return;
+}
+
+char *get_completions(enum completion *t, char *possible, int *count, char **suggested, char * (*cf)(int, char *, int *, char **))
{
char *booya = NULL;
char *path = NULL;
@@ -2169,6 +2180,7 @@
glob_t globbers;
int numglobs = 0, i;
int globtype = GLOB_MARK;
+enum completion type = *t;
#if defined(__EMX__) || defined(WINNT)
if (possible && *possible)
@@ -2191,6 +2203,18 @@
case TABKEY_COMPLETION:
{
NickTab *n = tabkey_array;
+ /*
+ * bad hack
+ * better idea would be to make this into a list
+ * and allow multiple modules to create over writes
+ * then, go to the first module that says it wants to
+ * do a tab_complete
+ */
+ if ( do_over_write_tabkey_complete != NULL && over_write_tabkey_complete_func != NULL && do_over_write_tabkey_complete((int) type, possible, count, suggested) ) {
+ *t = TABKEY_OVERWRITE;
+ return over_write_tabkey_complete_func((int) type, possible, count, suggested);
+ }
+ /* put_it("opted not do!"); */
*count = 0;
if (possible)
{
@@ -2377,6 +2401,18 @@
#endif
break;
}
+ case CUSTOM_COMPLETION:
+ {
+ char *c;
+ if ( cf == NULL ) {
+ return NULL;
+ /* put_it("CF IS NULL!"); */
+ }
+ c = cf((int)type, possible, count ,suggested);
+ /* put_it(c); */
+ return c;
+ break;
+ }
default:
return NULL;
}
@@ -2507,6 +2543,7 @@
int got_space = 0;
char *get = NULL;
Ext_Name_Type *extcomp = ext_completion;
+char * (*cf)(int, char *, int *, char **) = NULL;
/*
* is this the != second word, then just complete from the
@@ -2597,6 +2634,7 @@
case CDCC:
if (wcount == 2 || wcount == 3)
type = CDCC_COMPLETION;
+
break;
}
break;
@@ -2609,6 +2647,7 @@
if (!my_strnicmp(p, extcomp->name, extcomp->len))
{
type = extcomp->type;
+ cf = extcomp->comp_func;
break;
}
}
@@ -2628,7 +2667,7 @@
#endif
do_more_tab:
count = 0;
- if ((get = get_completions(type, possible, &count, &suggested)))
+ if ((get = get_completions(&type, possible, &count, &suggested, cf)))
{
char buffer[BIG_BUFFER_SIZE+1];
char *p = NULL;
@@ -2640,8 +2679,11 @@
p = extract(get_input(), 0, wcount - 2);
else if (suggested && *suggested)
p = m_3dup("/", suggested, "");
- if (type == TABKEY_COMPLETION)
+
+ if (type == TABKEY_COMPLETION)
snprintf(buffer, BIG_BUFFER_SIZE, "%s %s%s%s ", (p && *p == '/') ? p : "/m", get, (p && (*p != '/'))?space:empty_string, (p && (*p != '/'))?p:empty_string);
+ else if ( type == TABKEY_OVERWRITE )
+ snprintf(buffer, BIG_BUFFER_SIZE, "%s",get);
else
{
if (wcount == 1 && got_space)
@@ -2729,10 +2771,11 @@
case SERVER_COMPLETION:
case TABKEY_COMPLETION:
case CHAN_COMPLETION:
+ case CUSTOM_COMPLETION:
{
char *n, *use = get;
n = new_next_arg(use, &use);
- count = 0;
+ count = 0;
while (n && *n)
{
strmcat(buffer, n, BIG_BUFFER_SIZE);
@@ -2750,6 +2793,7 @@
put_it("%s", convert_output_format(fget_string_var(FORMAT_COMPLETE_FSET),"%s", buffer));
break;
}
+ case TABKEY_OVERWRITE:
case NO_COMPLETION:
break;
default:
@@ -2776,15 +2820,16 @@
return;
}
-int add_completion_type(char *name, int len, enum completion type)
+int add_completion_type(char *name, int len, enum completion type, char * (*cf)(int, char *, int *, char **))
{
-Ext_Name_Type *new;
+ Ext_Name_Type *new;
if (!find_in_list((List **)&ext_completion, name, 0))
{
new = (Ext_Name_Type *)new_malloc(sizeof(Ext_Name_Type));
new->name = m_strdup(name);
new->len = len;
new->type = type;
+ new->comp_func =cf;
add_to_list((List **)&ext_completion, (List *)new);
return 1;
}
--- .//source/functions.c.orig Tue Jan 18 16:44:28 2000
+++ .//source/functions.c Thu Jan 20 17:10:53 2000
@@ -7020,8 +7020,9 @@
#ifdef WANT_TABKEY
char *ret, *possible;
int count = 0; /* 6 */
+enum completion comp_type = 3;
possible = next_arg(input, &input);
- ret = get_completions(3, possible, &count, NULL);
+ ret = get_completions(&comp_type, possible, &count, NULL, NULL);
return m_sprintf("%d %s", count, ret ? ret : empty_string);
#else
RETURN_EMPTY;
@@ -7033,8 +7034,9 @@
#ifdef WANT_TABKEY
char *ret, *possible;
int count = 0;/* 4 */
+enum completion comp_type = 7;
possible = next_arg(input, &input);
- ret = get_completions(7, possible, &count, NULL);
+ ret = get_completions(&comp_type, possible, &count, NULL, NULL);
return m_sprintf("%d %s", count, ret ? ret : empty_string);
#else
RETURN_EMPTY;
-716
View File
@@ -1,716 +0,0 @@
/*
* AOL Instant Messanger Module for BitchX
*
* By Nadeem Riaz (nads@bleh.org)
*
* cmd.c
*
* User commands (aliases) (client -> libtoc)
*/
#include <irc.h>
#include <struct.h>
#include <hook.h>
#include <ircaux.h>
#include <output.h>
#include <lastlog.h>
#include <status.h>
#include <vars.h>
#include <window.h>
#include <sys/stat.h>
#include <module.h>
#include <modval.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "toc.h"
#include "aim.h"
char current_chat[512];
char away_message[2048];
LL msgdus;
LL msgdthem;
/* Commands */
void asignon(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg) {
char *user;
char *pass;
char *tochost,*authhost;
int tocport, authport;
int x;
if ( state == STATE_ONLINE ) {
statusprintf("You are already online.");
statusprintf("Please disconnect first (/asignoff), before trying to reoconnect.");
return;
}
user = get_dllstring_var("aim_user");
pass = get_dllstring_var("aim_pass");
tochost = get_dllstring_var("aim_toc_host");
authhost = get_dllstring_var("aim_auth_host");
x = get_dllint_var("aim_permdeny");
tocport = get_dllint_var("aim_toc_port");
authport = get_dllint_var("aim_auth_port");
if ( ! VALID_ARG(user) || ! VALID_ARG(pass) ) {
statusprintf("Please set your password and user name, by doing");
statusprintf("/set aim_user <user name>");
statusprintf("/set aim_pass <password>");
return;
}
/* This doent change anything-- should rm it */
if ( x < 1 || x > 4)
permdeny = PERMIT_PERMITALL;
else
permdeny = x;
if ( VALID_ARG(tochost) )
strncpy(aim_host,tochost,513);
if ( tocport > 0 && tocport < (64*1024) )
aim_port = tocport;
if ( VALID_ARG(authhost) )
strncpy(login_host,authhost,513);
if ( authport > 0 && authport < (64*1024) )
login_port = authport;
if ( toc_login(user,pass) < 0) {
statusprintf("Couldn't connect to instant messanger");
}
if ( get_dllint_var("aim_window") )
build_aim_status(get_window_by_name("AIM"));
msgdthem = CreateLL();
msgdus = CreateLL();
}
void asignoff(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
if ( state != STATE_ONLINE ) {
statusprintf("Please connect to aim first (/aconnect)");
return;
}
delete_timer("aimtime");
toc_signoff();
if ( get_dllint_var("aim_window") )
build_aim_status(get_window_by_name("AIM"));
FreeLL(msgdthem);
FreeLL(msgdus);
}
void amsg(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
char *nick,*nnick,*loc;
CHECK_TOC_ONLINE();
/* loc = msg, nick = username to send msg to */
loc = LOCAL_COPY(args);
nick = new_next_arg(loc, &loc);
REQUIRED_ARG(nick,command,helparg);
if ( nick[0] == '#' ) {
struct buddy_chat *b;
nick++;
REQUIRED_ARG(nick,command,helparg);
b = (struct buddy_chat *) find_buddy_chat(nick);
if ( ! b ) {
statusprintf("Error not on buddy chat %s", nick);
return;
}
/* chatprintf("sent msg %s to buddy chat %s",loc,nick); */
serv_chat_send(b->id,loc);
} else {
char *ruser,*rnick;
nnick = (char *) malloc(strlen(nick)+10);
rnick = rm_space(nick);
ruser = rm_space(get_dllstring_var("aim_user"));
sprintf(nnick,"%s@AIM",rnick);
msgprintf("%s", cparse(fget_string_var(FORMAT_SEND_MSG_FSET),
"%s %s %s %s",update_clock(GET_TIME),
nnick, ruser, loc));
serv_send_im(nick,loc);
RemoveFromLLByKey(msgdthem,rnick);
AddToLL(msgdthem,rnick,NULL);
#ifdef BITCHX_PATCH
tks.list = 0;
tks.pos = -1;
#endif
free(rnick); free(ruser);
}
debug_printf("sending msg to %s '%s'",nick,loc);
return;
}
void abl(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg) {
char *cmd,*loc;
CHECK_TOC_ONLINE();
/* loc = msg, nick = username to send msg to */
loc = LOCAL_COPY(args);
cmd = new_next_arg(loc, &loc);
REQUIRED_ARG(cmd,command,helparg);
if ( ! strcasecmp(cmd,"show" ) ) {
struct buddy *b;
LLE tg,tb;
LL mems;
for ( TLL(groups,tg) ) {
mems = ((struct group *) tg->data)->members;
statusprintf("Group: %s", tg->key);
for ( TLL(mems,tb) ) {
b = (struct buddy *)tb->data;
statusprintf("\t\t%s %d",b->name,b->present);
}
}
} else if ( ! strcasecmp(cmd,"add") ) {
char *buddy,*group;
group = new_next_arg(loc, &loc);
REQUIRED_ARG(group,command,helparg);
if ( ! VALID_ARG(loc) ) {
buddy = group;
group = (char *) malloc(strlen("Buddies")+2);
strcpy(group,"Buddies");
} else {
buddy = new_next_arg(loc,&loc);
}
if ( user_add_buddy(group,buddy) > 0 ) {
statusprintf("Added buddy %s to group %s",buddy,group);
} else {
statusprintf("%s is already in your buddy list",buddy);
}
} else if ( ! strcasecmp(cmd,"del") ) {
char *buddy;
buddy = new_next_arg(loc,&loc);
REQUIRED_ARG(buddy,command,helparg);
if ( user_remove_buddy(buddy) > 0 ) {
statusprintf("Removed buddy %s",buddy);
} else {
statusprintf("%s is not in your buddy list",buddy);
}
} else if ( ! strcasecmp(cmd,"addg") ) {
char *group;
struct group *g;
group = new_next_arg(loc,&loc);
REQUIRED_ARG(group,command,helparg);
g = find_group(group);
if ( g ) {
statusprintf("Group %s already exists",args);
return;
}
add_group(group);
statusprintf("Created group %s",group);
} else if ( ! strcasecmp(cmd,"delg") ) {
char *group,*newgroup;
int ret;
group = new_next_arg(loc, &loc);
newgroup = new_next_arg(loc,&loc);
REQUIRED_ARG(group,command,helparg);
if ( ! VALID_ARG(newgroup) ) {
statusprintf("Usage: /abl delg <old group> 1 (delete group and all buddies in it)");
statusprintf(" /abl delg <old group> <new group> (delete group and move all buddies in it to new group)");
return;
}
if ( ! strcasecmp(newgroup,"1") )
ret = remove_group(group,NULL,2);
else
ret = remove_group(group,newgroup,1);
if ( ret > 0 )
statusprintf("Removed group %s",group);
else
statusprintf("Group %s doesn't exist",group);
} else
statusprintf("Error unknown buddy list management command: %s", cmd);
}
void awarn(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
char *buddy,*mode,*loc;
mode = NULL;
CHECK_TOC_ONLINE();
loc = LOCAL_COPY(args);
buddy = new_next_arg(loc, &loc);
mode = new_next_arg(loc,&loc);
REQUIRED_ARG(buddy,command,helparg);
if ( VALID_ARG(mode) && ! strcasecmp(mode,"anon") ) {
serv_warn(buddy,1);
} else {
serv_warn(buddy,0);
}
statusprintf("Warned: %s",buddy);
}
void apd(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
char *cmd,*loc;
loc = LOCAL_COPY(args);
cmd = new_next_arg(loc,&loc);
CHECK_TOC_ONLINE();
REQUIRED_ARG(cmd,command,helparg);
if ( ! strcasecmp(cmd,"show") ) {
LLE t;
statusprintf("User Mode: %s",((permdeny >= 1 && permdeny <= 4) ? PERMIT_MODES[permdeny] : "ERROR: Unknown"));
statusprintf("Permit:");
ResetLLPosition(permit);
while ( (t=GetNextLLE(permit)) ) {
statusprintf("\t\t%s",t->key);
}
ResetLLPosition(deny);
statusprintf("Deny:");
while ( (t=GetNextLLE(deny)) ) {
statusprintf("\t\t%s",t->key);
}
} else if ( ! strcasecmp(cmd,"mode") ) {
char *mode;
int newmode;
mode = new_next_arg(loc,&loc);
REQUIRED_ARG(mode,command,helparg);
if ( ! strcasecmp(mode,"permitall") ) {
newmode = PERMIT_PERMITALL;
} else if ( ! strcasecmp(mode,"denyall") ) {
newmode = PERMIT_DENYALL;
} else if ( ! strcasecmp(mode,"denysome") ) {
newmode = PERMIT_DENYSOME;
} else if ( ! strcasecmp(mode,"permitsome") ) {
newmode = PERMIT_PERMITSOME;
} else {
userage(command,helparg);
return;
}
if ( newmode == permdeny ) {
statusprintf("We are already in %s mode",mode);
return;
} else {
permdeny = newmode;
set_dllint_var("aim_permdeny_mode",permdeny);
serv_set_permit_deny();
serv_save_config();
}
statusprintf("Switch to %s mode",mode);
} else if ( !strcasecmp(cmd,"addp") ) {
char *buddy;
buddy = new_next_arg(loc,&loc);
REQUIRED_ARG(buddy,command,helparg);
if ( add_permit(buddy) < 0 ) {
statusprintf("%s is already in your permit list!");
return;
}
if ( permdeny != PERMIT_PERMITSOME )
statusprintf("Note: although %s will be added to your permit list, no tangible change will occur because you are in the improper mode (see help on apermdeny)",buddy);
statusprintf("Added %s to your permit list",buddy);
} else if ( !strcasecmp(cmd,"delp") ) {
char *buddy;
buddy = new_next_arg(loc,&loc);
REQUIRED_ARG(buddy,command,helparg);
if ( remove_permit(buddy) < 0 )
statusprintf("%s is not in your permit list!",buddy);
else
statusprintf("Remvoed %s from your permit list",buddy);
} else if ( !strcasecmp(cmd,"addd") ) {
char *buddy;
buddy = new_next_arg(loc,&loc);
REQUIRED_ARG(buddy,command,helparg);
if ( add_deny(buddy) < 0 ) {
statusprintf("%s is already in your deny list!");
return;
}
if ( permdeny != PERMIT_DENYSOME )
statusprintf("Note: although %s will be added to your deny list, no tangible change will occur because you are in the improper mode (see help on apermdeny)",buddy);
statusprintf("Added %s to your deny list",buddy);
} else if ( !strcasecmp(cmd,"deld") ) {
char *buddy;
buddy = new_next_arg(loc,&loc);
REQUIRED_ARG(buddy,command,helparg);
if ( remove_deny(buddy) < 0 )
statusprintf("%s is not in your deny list!",buddy);
else
statusprintf("Remvoed %s from your deny list",buddy);
} else
statusprintf("Error unknown permit/deny cmd %s",cmd);
}
void awhois(IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
char *buddy,*loc;
struct buddy *b;
loc = LOCAL_COPY(args);
buddy = new_next_arg(loc,&loc);
CHECK_TOC_ONLINE();
REQUIRED_ARG(buddy,command,helparg);
b = find_buddy(buddy);
if ( ! b ) {
statusprintf("%s is not in your buddy list and thus I have no info stored on him/her",buddy);
return;
}
statusprintf("%s", cparse("ÚÄÄÄÄÄ---Ä--ÄÄ-ÄÄÄÄÄÄ---Ä--ÄÄ-ÄÄÄÄÄÄÄÄÄ--- -- -", NULL));
statusprintf("%s", cparse("| User : $0-", "%s", b->name));
statusprintf("%s", cparse("³ Class : $0-", "%s", ((b->uc <= 5 && b->uc >= 0) ? USER_CLASSES[b->uc] : "Unknown")));
statusprintf("%s", cparse("³ Evil : $0-", "%d", b->evil));
statusprintf("%s", cparse("³ SignOn : $0-", "%s", my_ctime(b->signon)));
statusprintf("%s", cparse(": Idle : $0-", "%d", b->idle));
}
void asave (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
IrcVariableDll *newv = NULL;
FILE *outf = NULL;
char *expanded = NULL;
char buffer[BIG_BUFFER_SIZE+1];
if (get_string_var(CTOOLZ_DIR_VAR))
snprintf(buffer, BIG_BUFFER_SIZE, "%s/AIM.sav", get_string_var(CTOOLZ_DIR_VAR));
else
sprintf(buffer, "~/AIM.sav");
expanded = expand_twiddle(buffer);
if (!expanded || !(outf = fopen(expanded, "w")))
{
statusprintf("error opening %s", expanded ? expanded : buffer);
new_free(&expanded);
return;
}
for (newv = dll_variable; newv; newv = newv->next)
{
if (!my_strnicmp(newv->name, name, 3))
{
if (newv->type == STR_TYPE_VAR)
{
if (newv->string)
fprintf(outf, "SET %s %s\n", newv->name, newv->string);
}
else if (newv->type == BOOL_TYPE_VAR)
fprintf(outf, "SET %s %s\n", newv->name, on_off(newv->integer));
else
fprintf(outf, "SET %s %d\n", newv->name, newv->integer);
}
}
/* Buddy list, perm/deny list, etc. stored on AIM server */
/*
* Not sure what that does?
if (do_hook(MODULE_LIST, "NAP SAVE %s", buffer))
nap_say("Finished saving Napster variables to %s", buffer);
*/
statusprintf("Finished saving AIM variables to %s",buffer);
fclose(outf);
new_free(&expanded);
return;
}
void achat (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
char *arg1, *arg2, *arg3, *loc;
loc = LOCAL_COPY(args);
debug_printf("in achat!");
CHECK_TOC_ONLINE();
if ( ! strcasecmp(command,"asay") ) {
if ( VALID_ARG(current_chat) ) {
struct buddy_chat *b;
b = find_buddy_chat(current_chat);
if ( ! b ) {
statusprintf("Not on a buddy chat");
return;
}
serv_chat_send(b->id,loc);
} else
statusprintf("Not on a buddy chat");
} else if ( ! strcasecmp(command,"ajoin") ) {
arg1 = new_next_arg(loc,&loc);
REQUIRED_ARG(arg1,command,helparg);
if ( arg1[0] == '#' )
arg1++;
REQUIRED_ARG(arg1,command,helparg);
if ( find_buddy_chat(arg1) ) {
strncpy(current_chat,arg1,511);
return;
}
buddy_chat_join(arg1);
} else if ( ! strcasecmp(command,"apart") ) {
arg1 = new_next_arg(loc,&loc);
if ( VALID_ARG(arg1) && arg1[0] == '#' )
arg1++;
if ( VALID_ARG(arg1) ) {
if ( buddy_chat_leave(arg1) ) {
if ( ! strcasecmp(arg1,current_chat) ) {
/* Replace Current Chat */
strcpy(current_chat,"");
}
} else
statusprintf("Not on buddy chat %s",arg1);
} else {
if ( VALID_ARG(current_chat) ) {
buddy_chat_leave(current_chat);
/* Repalce Current Chat */
strcpy(current_chat,"");
} else
statusprintf("Not on a buddy chat");
}
} else if ( ! strcasecmp(command,"ainvite") ) {
arg1 = new_next_arg(loc,&loc);
arg2 = new_next_arg(loc,&loc);
arg3 = new_next_arg(loc,&loc);
REQUIRED_ARG(arg1,command,helparg);
if ( arg1[0] == '#' )
arg1++;
REQUIRED_ARG(arg1,command,helparg);
REQUIRED_ARG(arg2,command,helparg);
REQUIRED_ARG(arg3,command,helparg);
if ( buddy_chat_invite(arg1,arg2,arg3) < 0 ) {
statusprintf("Not on buddy chat %s",arg1);
}
} else if ( !strcasecmp(command,"achats") ) {
LLE t;
statusprintf("Currently on: ");
ResetLLPosition(buddy_chats);
while ( (t=GetNextLLE(buddy_chats)) ) {
statusprintf("\t\t%s",t->key);
}
} else if ( ! strcasecmp(command,"anames") ) {
char *chat;
arg1 = new_next_arg(loc,&loc);
if ( VALID_ARG(arg1) )
chat = arg1;
else
chat = current_chat;
if ( VALID_ARG(chat) ) {
struct buddy_chat *b;
LLE t;
b = find_buddy_chat(chat);
if ( ! b ) {
statusprintf("Not on buddy chat %s",chat);
return;
}
statusprintf("Names on %s",b->name);
ResetLLPosition(b->in_room);
while ( (t=GetNextLLE(b->in_room)) ) {
statusprintf("%s",t->key);
}
} else
statusprintf("Not on a buddy chat");
} else if ( ! strcasecmp(command,"acwarn") ) {
int anon = 0;
char *chat = NULL, *user = NULL, *mode = NULL;
arg1 = new_next_arg(loc, &loc);
arg2 = new_next_arg(loc,&loc);
arg3 = new_next_arg(loc,&loc);
if ( VALID_ARG(arg1) && VALID_ARG(arg2) && VALID_ARG(arg3) ) {
chat = arg1;
user = arg2;
mode = arg3;
} else if ( VALID_ARG(arg1) && VALID_ARG(arg2) ) {
chat = current_chat;
user = arg1;
mode = arg2;
} else if ( VALID_ARG(arg1) ) {
chat = current_chat;
user = arg2;
mode = NULL;
}
if ( VALID_ARG(mode) && ! strcasecmp(mode,"anon") )
anon = 1;
if ( chat[0] == '#' ) {
chat++;
REQUIRED_ARG(chat,command,helparg);
}
if ( buddy_chat_warn(chat,user,1) < 0 )
statusprintf("Not on buddy chat %s",chat);
else
statusprintf("Buddy Chat Warned %s",user);
} else
debug_printf("Unknown command in achat %s",command);
}
void adir (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
char *cmd,*loc;
loc = LOCAL_COPY(args);
cmd = new_next_arg(loc,&loc);
CHECK_TOC_ONLINE();
REQUIRED_ARG(cmd,command,helparg);
if ( !strcasecmp(cmd,"get") ) {
char *sn;
sn = new_next_arg(loc,&loc);
REQUIRED_ARG(sn,command,helparg);
serv_get_dir(sn);
} else if ( ! strcasecmp(cmd,"search") ) {
int fields = 0;
char *field,*data;
char *first,*middle,*last,*maiden;
char *city,*state,*country,*email;
first = middle = last = maiden = NULL;
city = state = country = email = NULL;
field = new_next_arg(loc,&loc);
while ( VALID_ARG(field) ) {
data = new_next_arg(loc,&loc);
if ( VALID_ARG(data) ) {
fields++;
if ( ! strcasecmp(field,"first") || ! strcasecmp(field,"-first") )
first = data;
else if ( ! strcasecmp(field,"middle") || ! strcasecmp(field,"-middle") )
middle = data;
else if ( ! strcasecmp(field,"last") || ! strcasecmp(field,"-last") )
last = data;
else if ( ! strcasecmp(field,"maiden") || ! strcasecmp(field,"-maiden") )
maiden = data;
else if ( ! strcasecmp(field,"city") || ! strcasecmp(field,"-city") )
city = data;
else if ( ! strcasecmp(field,"state") || ! strcasecmp(field,"-state") )
state = data;
else if ( ! strcasecmp(field,"country") || ! strcasecmp(field,"-country") )
country = data;
else if ( ! strcasecmp(field,"email") || ! strcasecmp(field,"-email") )
email = data;
else
statusprintf("Illegal field: %s",field);
} else {
statusprintf("No search item for field %s",field);
}
serv_dir_search(first,middle,last,maiden,city,state,country,email);
}
} else if ( ! strcasecmp(cmd,"set") ) {
char *first = new_next_arg(loc,&loc);
char *middle = new_next_arg(loc,&loc);
char *last = new_next_arg(loc,&loc);
char *maiden = new_next_arg(loc,&loc);
char *city = new_next_arg(loc,&loc);
char *state =new_next_arg(loc,&loc);
char *country = new_next_arg(loc,&loc);
char *email = new_next_arg(loc,&loc);
char *allow = new_next_arg(loc,&loc);
int x;
REQUIRED_ARG(allow,command,helparg);
if ( atoi(allow) ) {
x = 1;
} else {
x = 0;
}
/* apparently sending email messes this up? */
serv_set_dir(first,middle,last,maiden,city,state,country,email,x);
} else
debug_printf("Unknown command in adir %s",command);
}
void achange_idle(Window *w, char *s, int i) {
time_to_idle = i * 60;
debug_printf("time to idle = %d",time_to_idle);
}
void aaway (IrcCommandDll *intp, char *command, char *args, char *subargs, char *helparg) {
char *loc;
loc = LOCAL_COPY(args);
CHECK_TOC_ONLINE();
serv_set_away(args);
if ( is_away ) {
strncpy(away_message,args,2047);
statusprintf("You are now marked as away");
} else
statusprintf("You are now back.");
if ( get_dllint_var("aim_window") )
build_aim_status(get_window_by_name("AIM"));
}
void aquery(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg) {
Window *tmp = NULL;
char *loc,*n,*msg;
char say[10] = "say";
CHECK_TOC_ONLINE();
loc = LOCAL_COPY(args);
n = new_next_arg(loc,&loc);
if ( get_dllint_var("aim_window") ) {
strcpy(say,"asay");
tmp = get_window_by_name("AIM");
}
if ( ! tmp )
tmp = current_window;
if ( VALID_ARG(n) ) {
#ifdef BITCHX_PATCH
msg = (char *) malloc(strlen(n)+50);
sprintf(msg,"-cmd amsg %s",n);
debug_printf("Querying: %s",msg);
window_query(tmp,&msg,NULL);
#else
msg = (char *) malloc(strlen(n)+10);
sprintf(msg,"amsg %s",n);
debug_printf("nick = '%s' msg = '%s'",n,msg);
#undef query_cmd
tmp->query_cmd = m_strdup("amsg");
#undef query_nick
tmp->query_nick = m_strdup(n);
update_input(tmp);
#endif
} else {
#undef query_cmd
tmp->query_cmd = m_strdup(say);
}
debug_printf("Leaking memory in aquery");
}
void ainfo(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg) {
char *cmd,*loc;
loc = LOCAL_COPY(args);
cmd = new_next_arg(loc,&loc);
CHECK_TOC_ONLINE();
REQUIRED_ARG(cmd,command,helparg);
if ( ! strcasecmp(cmd,"get") ) {
char *nick = new_next_arg(loc,&loc);
REQUIRED_ARG(nick,command,helparg);
serv_get_info(nick);
} else if ( ! strcasecmp(cmd,"set") ) {
REQUIRED_ARG(loc,command,helparg);
serv_set_info(loc);
} else
statusprintf("Unknown command sent to ainfo: '%s'", cmd);
}
-158
View File
@@ -1,158 +0,0 @@
/*
* AOL Instant Messanger Module for BitchX
*
* By Nadeem Riaz (nads@bleh.org)
*
* toc.c
*
* Interface to libtoc (libtoc -> client)
*/
#include <irc.h>
#include <struct.h>
#include <hook.h>
#include <ircaux.h>
#include <output.h>
#include <lastlog.h>
#include <status.h>
#include <vars.h>
#include <window.h>
#include <sys/stat.h>
#include <module.h>
#include <modval.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "toc.h"
#include "aim.h"
int sock_read_id;
void (*chatprintf)(char *, ...) = statusprintf;
/* LIBToc Call back functions */
int toc_add_input_stream(int fd,int (*func)(int)) {
sock_read_id = add_socketread(fd, 0, 0, "bleh", func, func);
return 1;
}
int toc_remove_input_stream(int fd) {
close_socketread(sock_read_id);
return 1;
}
int toc_main_interface(int type, char **args) {
switch (type) {
case TOC_IM_IN: {
char *msg, *nick;
nick = rm_space(args[0]);
msg = strip_html(args[1]);
RemoveFromLLByKey(msgdus,nick);
AddToLL(msgdus,nick,NULL);
msgprintf("%s", cparse(fget_string_var(FORMAT_MSG_FSET),
"%s %s %s %s",update_clock(GET_TIME),
nick, "AIM", msg));
if ( is_away )
serv_send_im(args[0],away_message);
free(nick);
break;
}
case TOC_TRANSLATED_ERROR:
case TOC_CONNECT_MSGS:
statusprintf(args[0]);
break;
case TOC_BUDDY_LOGGED_OFF:
statusprintf("%s logged off",args[0]);
if ( get_dllint_var("aim_window") )
build_aim_status(get_window_by_name("AIM"));
break;
case TOC_BUDDY_LOGGED_ON:
statusprintf("%s logged on", args[0]);
if ( get_dllint_var("aim_window") )
build_aim_status(get_window_by_name("AIM"));
break;
case TOC_EVILED:
statusprintf("You have been warned by %s.", ((args[0] == NULL) ? "an anonymous person" : args[0]));
statusprintf("Your new warning level is %s%%" , args[1]);
if ( get_dllint_var("aim_window") )
build_aim_status(get_window_by_name("AIM"));
break;
case TOC_CHAT_JOIN:
chatprintf("Joined buddy chat %s",args[1]);
strncpy(current_chat,args[1],511);
break;
case TOC_BUDDY_LEFT_CHAT:
chatprintf("%s left %s",args[1],args[0]);
break;
case TOC_BUDDY_JOIN_CHAT:
chatprintf("%s joined %s",args[1],args[0]);
break;
case TOC_CHAT_LEFT:
chatprintf("Left chat id: %s",args[0]);
break;
case TOC_CHAT_IN: {
char *e,*name,*chat;
/* chatprintf("got msg from chat: <%s@AIM> %s",args[1],args[3]); */
/* Need to take better action here */
e = strip_html(args[3]);
name = rm_space(args[1]);
chat = rm_space(args[4]);
msgprintf("%s",cparse(fget_string_var(FORMAT_PUBLIC_OTHER_FSET), "%s %s %s %s", update_clock(GET_TIME), name, chat, e));
free(name); free(chat);
break;
}
case TOC_GOTO_URL:
statusprintf("GOTO_URL: %s",args[0]);
break;
case TOC_CHAT_INVITE:
statusprintf("Invited to %s by %s '%s'",args[0],args[2],args[3]);
break;
case TOC_LAG_UPDATE:
case TOC_WENT_IDLE:
if ( get_dllint_var("aim_window") )
build_aim_status(get_window_by_name("AIM"));
break;
case TOC_DIR_STATUS:
if ( atoi(args[0]) == 1 )
statusprintf("Directory information successfully changed.");
else
statusprintf("Error altering directory information, error code: %s",args[0]);
break;
default:
statusprintf("INTERNAL ERROR: Unknown toc type: %d",type);
}
return 1;
}
int toc_timer(int type, char **args) {
timer_id = add_timer(0,"aimtime",20000,0,&check_idle,NULL,NULL,0,"aimtime");
return 1;
}
/* int toc_buddy_logged_on( */
void bx_init_toc() {
init_toc();
strcpy(current_chat,"");
/* Setup Hanlders */
install_handler(TOC_IM_IN,&toc_main_interface);
install_handler(TOC_TRANSLATED_ERROR,&toc_main_interface);
install_handler(TOC_CONNECT_MSGS,&toc_main_interface);
install_handler(TOC_BUDDY_LOGGED_ON,&toc_main_interface);
install_handler(TOC_BUDDY_LOGGED_OFF,&toc_main_interface);
install_handler(TOC_EVILED,&toc_main_interface);
install_handler(TOC_CHAT_JOIN,&toc_main_interface);
install_handler(TOC_BUDDY_LEFT_CHAT,&toc_main_interface);
install_handler(TOC_BUDDY_JOIN_CHAT,&toc_main_interface);
install_handler(TOC_CHAT_LEFT,&toc_main_interface);
install_handler(TOC_CHAT_IN,&toc_main_interface);
install_handler(TOC_CHAT_INVITE,&toc_main_interface);
install_handler(TOC_GOTO_URL,&toc_main_interface);
install_handler(TOC_LAG_UPDATE,&toc_main_interface);
install_handler(TOC_WENT_IDLE,&toc_main_interface);
install_handler(TOC_DIR_STATUS,&toc_main_interface);
install_handler(TOC_REINSTALL_TIMER,&toc_timer);
}
-3
View File
@@ -1,3 +0,0 @@
- If you are in permitsome or denysome mdoe and remove someone from either
your permit or deny list, the changes do not take effect until you
resigon on.
-174
View File
@@ -1,174 +0,0 @@
SHELL = @SHELL@
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
topdir = @topdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = @oldincludedir@
local_dir = $(HOME)
# Where the BitchX binary will be installed.
# "make install" will compile and install the program.
INSTALL_IRC = @INSTALL_IRC@
# Where the BitchX library will be. Generally this is the place that
# you put the scripts, help pages and translation tables. It is
# very important that you set this correctly.
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
LIBS = @LIBS@
# Tcl library.
TCL_LIBS = @TCL_LIBS@
# These are for Tcl support.
TCL_OBJS = @TCL_OBJS@
# You don't have the following, so you'll want to leave this blank.
TCL_SRCS = @TCL_SRCS@
# Set this to -g if you want to be able to debug the client, otherwise
# use -O to have the compiler do some optimization instead.
CFLAGS = @CFLAGS@
# Set this to -s if you want the binary to be stripped.
LDFLAGS = @LDFLAGS@
# These are for the cd device player.
CD_SRCS = @CD_SRCS@
CD_OBJS = @CD_OBJS@
# This is the executable suffix for the target operating system.
EXEEXT = @EXEEXT@
# Extra files.
DEFAULT_CTOOLZ_DIR = @DEFAULT_CTOOLZ_DIR@
DEFAULT_MSGLOGFILE = @DEFAULT_MSGLOGFILE@
DEFAULT_BITCHX_HELP_FILE = @DEFAULT_BITCHX_HELP_FILE@
DEFAULT_SCRIPT_HELP_FILE = @DEFAULT_SCRIPT_HELP_FILE@
DEFAULT_BITCHX_KICK_FILE = @DEFAULT_BITCHX_KICK_FILE@
DEFAULT_BITCHX_QUIT_FILE = @DEFAULT_BITCHX_QUIT_FILE@
DEFAULT_BITCHX_IRCNAME_FILE = @DEFAULT_BITCHX_IRCNAME_FILE@
# Full path of the directory for BitchX help files.
HELPDIR = @HELPDIR@
# Full path of the directory for the BitchX scripts.
INSTALL_SCRIPT = @INSTALL_SCRIPT@
# Default setting for IRCPATH where BitchX will look for
# its script files if the environment variable is undefined.
# Usually, this should contain the same path as used for INSTALL_SCRIPT in
# the Makefile, but it can contain multiple path elements
# separated by colons. The path MUST lead to an existing directory,
# because the 'global' script is expected to be found there.
IRCPATH = @IRCPATH@
# Path for TRANSLATION variable.
TRANSLATION_PATH = @TRANSLATION_PATH@
# This is where the optional plugins will be copied to.
PLUGINDIR = @PLUGINDIR@
# Plugin flags.
SHLIB_LD = @SHLIB_LD@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
SHLIB_SUFFIX = @SHLIB_SUFFIX@
# This command will be used to install the BitchX files on Win32/OS2EMX
# systems.
WINNT_INSTALL = @WINNT_INSTALL@
# This program allows you to use screen/xterm's to put new BitchX windows
# on new screen/xterm windows.
INSTALL_WSERV = @INSTALL_WSERV@
# This program allows you to screen BitchX and reattach to it later.
INSTALL_SCRBX = @INSTALL_SCRBX@
# Set gzip and bzip2 options.
GZIP_ENV = @GZIP_ENV@
BZIP2 = @BZIP2@
# Standard programs.
RM = @RM@
LN = @LN_S@
CP = @CP@
MV = @MV@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
VERSION = @VERSION@
_VERSION_ = @_VERSION_@
MAKE_BIN = @MAKE@
MAKE = $(MAKE_BIN) $(MFLAGS)
MFLAGS = \
'local_dir=$(HOME)' \
'INSTALL_IRC=$(INSTALL_IRC)' \
'IRCLIB=$(IRCLIB)' \
'CC=$(CC)' \
'CFLAGS=$(CFLAGS)' \
'HELPDIR=$(HELPDIR)' \
'INSTALL_WSERV=$(INSTALL_WSERV)' \
'IRCPATH=$(IRCPATH)' \
'TRANSLATION_PATH=$(TRANSLATION_PATH)' \
'LDFLAGS=$(LDFLAGS)' \
'LIBS=$(LIBS)' \
'LN=$(LN)' \
'RM=$(RM)' \
'TCL_SRCS=$(TCL_SRCS)' \
'TCL_OBJS=$(TCL_OBJS)' \
'CD_PLAY=$(CD_PLAY)' \
'CD_SRCS=$(CD_SRCS)' \
'CD_OBJS=$(CD_OBJS)' \
'TCL_LIBS=$(TCL_LIBS)' \
'PLUGINDIR=$(PLUGINDIR)' \
'_VERSION_=$(_VERSION_)' \
'VERSION=$(VERSION)' \
'INSTALL_DATA=$(INSTALL_DATA)' \
'INSTALL_SCRIPT=$(INSTALL_SCRIPT)' \
'EXEEXT=$(EXEEXT)' \
'SHLIB_CFLAGS=$(SHLIB_CFLAGS)' \
'SHLIB_SUFFIX=$(SHLIB_SUFFIX)'
## Makefile starts here.
#DEBUG_CFLAGS = -g -DDEBUG_LIB_TOC
.c.o:
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) $(DEBUG_CFLAGS) -c $<
LOBJS = toc.o network.o util.o server.o interface.o buddy.o ll.o misc.o
all: libtoc.a
libtoc.a: $(LOBJS)
ar cru libtoc.a $(LOBJS)
Makefile: Makefile.in
cd $(topdir) \
&& ./config.status
clean:
$(RM) $(LOBJS) libtoc.a
distclean: clean
$(RM) Makefile
-438
View File
@@ -1,438 +0,0 @@
# Copyright (c) 1998-9 America Online, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Version: TOC1.0
This document describes the protocol between TOC and TOC clients.
The protocol is built on TCP. Framing is done by SFLAP,
described at the bottom of this document. Inside each
SFLAP frame is a TOC command.
The TOC protocol is ASCII based, and special attention
must be placed argument separation. The separator and
the rules of separation are different for messages inbound
to TOC and outbound to the client. The rules of separation
are described in sections below.
The TOC server is built mainly to service the TIC and TiK clients. Since
the TIC client is a Java applet, and downloadable, TOC will NOT support
multiple TOC protocol versions at the same time. Therefore, TiK
users will be forced to upgrade if the protocol version changes.
TOC sends down the protocol version it expects the client
to speak and understand. Note, the protocol version is a string.
Important Notes
===============
* TOC will drop the connection if a command exceeds the maximum
length, which is currently 2048 bytes. So the client needs to
spend special attention to im, chat, and config message lengths.
There is an 8k length maximum from TOC to the client.
* No commands should be sent to TOC (besides toc_signon) before
a SIGN_ON is received. If you do send a command before SIGN_ON
the command will be ignored, and in some case the connection
will be dropped.
* Initial permit/deny items should be sent after receiving SIGN_ON
but before sending toc_init_done, otherwise the user will flash
on peoples buddylist who the user has denied. You will probably
want to send the toc_add_buddies at this time also.
* After TOC sends the PAUSE message to a client, all messages sent
to TOC will be ignored, and in some cases the connection will
be dropped. Another SIGN_ON message will be sent to the client
when it is online again. The buddy list and permit/deny items must
be sent again, followed by the toc_init_done. In most cases the
SIGN_ON message will be sent between 1-2 seconds after the
PAUSE message. Therefore a client could choose to ignore the
PAUSE message and hope nothing bad happens.
Client -> TOC
==============
The commands and the arguments are usually separated by whitespaces. Arguments
with whitespace characters should be enclosed in quotes. Dollar signs,
curly brackets, square brackets, parentheses, quotes, and backslashes
must all be backslashed whether in quotes or not. It is usually
a good idea just to use quotes no matter what. All user names from clients
to TOC should be normalized (spaces removed and lowercased), and therefore
are the one exception to the always use quotes rule.
When sending commands to the server you will not get a response
back confirming that the command format was correct or not! However
in some cases if the command format was incorrect the connection
will be dropped.
RoastingString="Tic/Toc"
toc_signon <authorizer host> <authorizer port> <User Name> <Password>
<language> <version>
The password needs to be roasted with the Roasting String if
coming over a FLAP connection, CP connections don't use
roasted passwords. The language specified will be used
when generating web pages, such as the get info pages.
Currently the only supported language is "english".
If the language sent isn't found, the default "english"
language will be used. The version string will be used
for the client identity, and must be less then 50
characters.
Passwords are roasted when sent to the host. This is done so they
aren't sent in "clear text" over the wire, although they are still
trivial to decode. Roasting is performed by first xoring each byte
in the password with the equivalent modulo byte in the roasting
string. The result is then converted to ascii hex, and prepended
with "0x". So for example the password "password" roasts to
"0x2408105c23001130"
toc_init_done
Tells TOC that we are ready to go online. TOC clients should first
send TOC the buddy list and any permit/deny lists. However toc_init_done
must be called within 30 seconds after toc_signon, or the connection
will be dropped. Remember, it can't be called until after the SIGN_ON
message is received. Calling this before or multiple times after a
SIGN_ON will cause the connection to be dropped.
toc_send_im <Destination User> <Message> [auto]
Send a message to a remote user. Remember to quote and encode the
message. If the optional string "auto" is the last argument, then the
auto response flag will be turned on for the im.
toc_add_buddy <Buddy User 1> [<Buddy User2> [<Buddy User 3> [...]]]
Add buddies to your buddy list. This does not change your
saved config.
toc_remove_buddy <Buddy User 1> [<Buddy User2> [<Buddy User 3> [...]]]
Remove buddies from your buddy list. This does not change your
saved config.
toc_set_config <Config Info>
Set the config information for this user. The config information
is line oriented with the first character being the item type,
followed by a space, with the rest of the line being the item
value. Only letters, numbers, and spaces should be used. Remember
you will have to enclose the entire config in quotes.
Item Types:
g - Buddy Group (All Buddies until the next g or the end of config
are in this group.)
b - A Buddy
p - Person on permit list
d - Person on deny list
m - Permit/Deny Mode. Possible values are
1 - Permit All
2 - Deny All
3 - Permit Some
4 - Deny Some
toc_evil <User> <norm|anon>
Evil/Warn someone else. The 2nd argument is either the string
"norm" for a normal warning, or "anon" for an anonymous
warning. You can only evil people who have recently sent you
ims. The higher someones evil level, the slower they can
send message.
toc_add_permit [ <User 1> [<User 2> [...]]]
ADD the following people to your permit mode. If
you are in deny mode it will switch you to permit
mode first. With no arguments and in deny mode
this will switch you to permit none. If already
in permit mode, no arguments does nothing
and your permit list remains the same.
toc_add_deny [ <User 1> [<User 2> [... ]]]
ADD the following people to your deny mode. If
you are in permit mode it will switch you to
deny mode first. With no arguments and in permit
mode, this will switch you to deny none. If
already in deny mode, no arguments does nothing
and your deny list remains unchanged.
toc_chat_join <Exchange> <Chat Room Name>
Join a chat room in the given exchange. Exchange is
an integer that represents a group of chat rooms.
Different exchanges have different properties. For
example some exchanges might have room replication (ie
a room never fills up, there are just multiple
instances.) and some exchanges might have navigational
information, and some exchanges might have ... Currently
exchange should always be 4, however this may
change in the future. You will either
receive an ERROR if the room couldn't be joined
or a CHAT_JOIN message. The Chat Room Name
is case insensitive and consecutive spaces
are removed.
toc_chat_send <Chat Room ID> <Message>
Send a message in a chat room using the chat room
id from CHAT_JOIN. Since reflection is always on in
TOC, you do not need to add the message to your chat UI,
since you will get a CHAT_IN with the message.
Remember to quote and encode the message.
toc_chat_whisper <Chat Room ID> <dst_user> <Message>
Send a message in a chat room using the chat room
id from CHAT_JOIN. This message is directed at
only one person. (Currently you DO need to add this to
your UI.) Remember to quote and encode the message.
Chat whispering is different from IMs since it is linked
to a chat room, and should usually be displayed in the chat
room UI.
toc_chat_evil <Chat Room ID> <User> <norm|anon>
Evil/Warn someone else inside a chat room. The 3rd argument is either
the string "norm" for a normal warning, or "anon" for an anonymous
warning. Currently chat evil is not turned on in the chat complex.
toc_chat_invite <Chat Room ID> <Invite Msg> <buddy1> [<buddy2> [<buddy3> [...]]]
Once you are inside a chat room you can invite other people into
that room. Remember to quote and encode the invite message.
toc_chat_leave <Chat Room ID>
Leave the chat room.
toc_chat_accept <Chat Room ID>
Accept a CHAT_INVITE message from TOC. The server will send a
CHAT_JOIN in response.
toc_get_info <username>
Gets a user's info a GOTO_URL or ERROR message will be sent back to the
client.
toc_set_info <info information>
Set the LOCATE user information. This is basic HTML.
Remember to encode the info.
toc_set_away [<away message>]
if the away message is present, then the unavailable
status flag is set for the user. If the away message
is not present, then the unavailable status flag is
unset. The away message is basic HTML, remember to
encode the information.
toc_get_dir <username>
Gets a user's dir info a GOTO_URL or ERROR message will be sent back to the
client.
toc_set_dir <info information>
Set the DIR user information. This is a colon separated fields as in:
"first name":"middle name":"last name":"maiden name":"city":"state":"country":"email":"allow web searches"
Should return a DIR_STATUS msg. Having anything in the "allow web searches"
field allows people to use web-searches to find your directory info.
Otherwise, they'd have to use the client.
toc_dir_search <info information>
Perform a search of the Oscar Directory, using colon separated fields as in:
"first name":"middle name":"last name":"maiden name":"city":"state":"country":"email"
Returns either a GOTO_URL or ERROR msg.
toc_set_idle <idle secs>
Set idle information. If <idle secs> is 0 then the user isn't idle at all.
If <idle secs> is greater then 0 then the user has already been idle
for <idle secs> number of seconds. The server will automatically
keep incrementing this number, so do not repeatedly call with new
idle times.
TOC -> Client
==============
All user names from TOC to client are NOT normalized, and are
sent as they should be displayed. String are NOT encoded, instead
we use colons as separators. So that you can have colons inside
of messages, everything after the colon before :<Message> should
be considered part of the message (ie don't just "split" on colons,
instead split with a max number of results.)
SIGN_ON:<Client Version Supported>
This is sent after a successful toc_signon command is sent to TOC.
If the command was unsuccessful either the FLAP connection will
be dropped or you will receive a ERROR message.
CONFIG:<config>
A user's config. Config can be empty in which case the host was not able to
retrieve it, or a config didn't exist for the user. See toc_set_config
above for the format.
NICK:<Nickname>
Tells you your correct nickname (ie how it should be capitalized and
spacing)
IM_IN:<Source User>:<Auto Response T/F?>:<Message>
Receive an IM from some one. Everything after the third colon is
the incoming message, including other colons.
UPDATE_BUDDY:<Buddy User>:<Online? T/F>:<Evil Amount>:<Signon Time>:<IdleTime>:<UC>
This one command handles arrival/depart/updates. Evil Amount is
a percentage, Signon Time is UNIX epoc, idle time is in minutes, UC (User Class)
is a two/three character string.
uc[0]:
' ' - Ignore
'A' - On AOL
uc[1]
' ' - Ignore
'A' - Oscar Admin
'U' - Oscar Unconfirmed
'O' - Oscar Normal
uc[2]
'\0' - Ignore
' ' - Ignore
'U' - The user has set their unavailable flag.
ERROR:<Error Code>:Var args
* General Errors *
901 - $1 not currently available
902 - Warning of $1 not currently available
903 - A message has been dropped, you are exceeding
the server speed limit
* Chat Errors *
950 - Chat in $1 is unavailable.
* IM & Info Errors *
960 - You are sending message too fast to $1
961 - You missed an im from $1 because it was too big.
962 - You missed an im from $1 because it was sent too fast.
* Dir Errors *
970 - Failure
971 - Too many matches
972 - Need more qualifiers
973 - Dir service temporarily unavailable
974 - Email lookup restricted
975 - Keyword Ignored
976 - No Keywords
977 - Language not supported
978 - Country not supported
979 - Failure unknown $1
* Auth errors *
980 - Incorrect nickname or password.
981 - The service is temporarily unavailable.
982 - Your warning level is currently too high to sign on.
983 - You have been connecting and
disconnecting too frequently. Wait 10 minutes and try again.
If you continue to try, you will need to wait even longer.
989 - An unknown signon error has occurred $1
EVILED:<new evil>:<name of eviler, blank if anonymous>
The user was just eviled.
CHAT_JOIN:<Chat Room Id>:<Chat Room Name>
We were able to join this chat room. The Chat Room Id is
internal to TOC.
CHAT_IN:<Chat Room Id>:<Source User>:<Whisper? T/F>:<Message>
A chat message was sent in a chat room.
CHAT_UPDATE_BUDDY:<Chat Room Id>:<Inside? T/F>:<User 1>:<User 2>...
This one command handles arrival/departs from a chat room. The
very first message of this type for each chat room contains the
users already in the room.
CHAT_INVITE:<Chat Room Name>:<Chat Room Id>:<Invite Sender>:<Message>
We are being invited to a chat room.
CHAT_LEFT:<Chat Room Id>
Tells tic connection to chat room has been dropped
GOTO_URL:<Window Name>:<Url>
Goto a URL. Window Name is the suggested internal name of the window
to use. (Java supports this.)
DIR_STATUS:<Return Code>
PAUSE
Tells TIC to pause so we can do migration
Typical Signon Process
======================
Except for the section marked optional this is an sequential
process. Each line MUST occur before the following line.
* Client connects to TOC
* Client sends "FLAPON\r\n\r\n"
* TOC sends Client FLAP SIGNON
* Client sends TOC FLAP SIGNON
* Client sends TOC "toc_signon" message
* if login fails TOC drops client's connection
else TOC sends client SIGN_ON reply
* if Client doesn't support version it drops the connection
[BEGIN OPTIONAL]
* TOC sends Client CONFIG
* Client sends TOC permit/deny stuff
* Client sends TOC toc_add_buddy message
[END OPTIONAL]
* Client sends TOC toc_init_done message
SFLAP Documentation
===================
SFLAP is pretty much a FLAP connection except the DATA frame payload is a null
terminated string when traveling from client to host, it is NOT null
terminated when traveling from host to client. The FLAP Header is binary
data, and is in network byte order. The data portion is at offset 6, after the
header. The sequence number is sequential in each direction. So
packets from the server to client have one sequence number, while
the packets from the client to server have an independent
increasing number.
FLAP Header (6 bytes)
-----------
Offset Size Type
0 1 ASTERISK (literal ASCII '*')
1 1 Frame Type
2 2 Sequence Number
4 2 Data Length
Valid Frame Type Values
-----------------------
1 SIGNON
2 DATA
3 ERROR (Not used by TOC)
4 SIGNOFF (Not used by TOC)
5 KEEP_ALIVE
TOC SIGNON FRAME TYPE
---------------------
Sequence Number contains the initial sequence number used in each direction.
Data Length contains the payload length, with the payload described
below. The payload area is NOT null terminated.
Host To Client:
4 byte FLAP version (1)
Client To Host:
4 byte FLAP version (1)
2 byte TLV Tag (1)
2 byte Normalized User Name Length
N byte Normalized User Name (NOT null terminated)
TOC DATA FRAME TYPE
-------------------
Sequence Number contains the next sequence number.
Data Length is the length of the payload, including the null termination
from client to host.
-5
View File
@@ -1,5 +0,0 @@
Most of this code is from gaim, I just hacked it up a bit to un gtkify it
and separated it from the interface code. Anyway, I plan to completely
seperate this from the interface code and release it so anyone can add a
aim client to whatever they like.
-3
View File
@@ -1,3 +0,0 @@
- fix BUGS
- code cleanup
- create better docummentation on usage
-345
View File
@@ -1,345 +0,0 @@
/*
* gaim
*
* Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
/*
* Heavily modified by Nadeem Riaz (nads@bleh.org)
* for use in libtoc
*/
#include <string.h>
#include "ll.h"
#include "toc.h"
LL groups;
LL permit;
LL deny;
LL buddy_chats;
LL invited_chats;
struct buddy *add_buddy(char *group, char *buddy)
{
struct buddy *b;
struct group *g;
toc_debug_printf("adding '%s' to '%s'\n",buddy,group);
if ((b = find_buddy(buddy)) != NULL)
return b;
g = find_group(group);
if (g == NULL)
g = add_group(group);
b = (struct buddy *) malloc(sizeof(struct buddy));
if (!b)
return NULL;
b->present = 0;
snprintf(b->name, sizeof(b->name), "%s", buddy);
AddToLL(g->members,b->name,b);
b->idle = 0;
return b;
}
struct group *add_group(char *group)
{
struct group *g;
g = (struct group *) malloc(sizeof(struct group));
if (!g)
return NULL;
strncpy(g->name, group, sizeof(g->name));
AddToLL(groups, g->name, g);
g->members = CreateLL();
return g;
}
struct group *find_group(char *group)
{
struct group *g;
LLE e;
char *grpname = malloc(strlen(group) + 1);
strcpy(grpname, normalize(group));
for ( TLL(groups,e) ) {
g = (struct group *)e->data;
if (!strcasecmp(normalize(g->name), grpname)) {
free(grpname);
return g;
}
}
free(grpname);
return NULL;
}
struct buddy *find_buddy(char *who)
{
struct group *g;
struct buddy *b;
LLE tg,tb;
LL mems;
char *whoname = malloc(strlen(who) + 1);
strcpy(whoname, normalize(who));
for ( TLL(groups,tg) ) {
g = (struct group *) tg->data;
mems = g->members;
for ( TLL(mems,tb) ) {
b = (struct buddy *)tb->data;
if (!strcasecmp(normalize(b->name), whoname)) {
free(whoname);
return b;
}
}
}
free(whoname);
return NULL;
}
int user_remove_buddy(char *buddy) {
struct group *g;
struct buddy *b;
LLE e,m;
char *budname = malloc(strlen(buddy) + 1);
strcpy(budname, normalize(buddy));
for ( TLL(groups,e) ) {
g = (struct group *)e->data;
for ( TLL(g->members,m) ) {
b = (struct buddy *)m->data;
if ( ! strcasecmp(normalize(b->name),budname) ) {
RemoveFromLLByKey(g->members,buddy);
serv_remove_buddy(buddy);
serv_save_config();
free(budname);
return 1;
}
}
}
free(budname);
return -1;
}
int user_add_buddy(char *group, char *buddy) {
struct buddy *b;
b = find_buddy(buddy);
if ( b != NULL )
return -1;
add_buddy(group,buddy);
serv_add_buddy(buddy);
serv_save_config();
return 1;
}
/*
* mode 1 = move current group members to a enw group
* mode 2 = delete current group members from buddy list
*/
int remove_group(char *group, char *newgroup, int mode)
{
LL mem;
LLE t;
struct group *delg = find_group(group);
struct group *newg = NULL;
struct buddy *delb;
if ( ! delg ) {
return -1;
}
if ( mode == 1 ) {
newg = find_group(newgroup);
if ( ! newg ) {
newg = add_group(newgroup);
}
}
mem = delg->members;
for ( TLL(mem,t) ) {
delb = (struct buddy *)t->data;
if ( mode == 1 ) {
AddToLL(newg->members,delb->name,delb);
} else {
serv_remove_buddy(delb->name);
/* free(delb); */
}
}
RemoveFromLLByKey(groups,delg->name);
serv_save_config();
return 1;
}
int add_permit(char *sn) {
LLE t;
t = FindInLL(permit,sn);
if ( t )
return -1;
AddToLL(permit,sn,NULL);
if ( permdeny == PERMIT_PERMITSOME )
serv_add_permit(sn);
serv_save_config();
return 1;
}
int remove_permit(char *sn) {
LLE t;
t = FindInLL(permit,sn);
if ( ! t )
return -1;
RemoveFromLLByKey(permit,sn);
serv_save_config();
if (permdeny == PERMIT_PERMITSOME )
serv_set_permit_deny();
return 1;
}
int add_deny(char *sn) {
LLE t;
t = FindInLL(deny,sn);
if ( t )
return -1;
AddToLL(deny,sn,NULL);
if ( permdeny == PERMIT_DENYSOME )
serv_add_deny(sn);
serv_save_config();
return 1;
}
int remove_deny(char *sn) {
LLE t;
t = FindInLL(deny,sn);
if ( ! t )
return -1;
RemoveFromLLByKey(deny,sn);
if ( permdeny == PERMIT_DENYSOME ) {
/*
* DAMN AOL HOEBAGS to lazzy toinclude a delete from deny list
* Thus we need to first go into permit mode */
serv_set_permit_deny();
}
serv_save_config();
return 1;
}
int buddy_invite(char *chat, char *buddy, char *msg) {
LLE t;
struct buddy_chat *b;
t = FindInLL(buddy_chats,chat);
if ( ! t )
return -1;
b = (struct buddy_chat *)t->data;
serv_chat_invite(b->id, msg, buddy);
return 1;
}
/*
* Checks invite list first
* then tries to create chat
*/
void buddy_chat_join(char *chan) {
LLE t = FindInLL(invited_chats,chan);
if ( ! t ) {
/* Standard exchange is 4 */
toc_debug_printf("Creating chan %s",chan);
serv_join_chat(4,chan);
} else {
/* The chat is in our invite list */
int *d;
d = (int *) t->data;
serv_accept_chat(*d);
toc_debug_printf("Trying to join invited to %s %d",t->key, *d);
RemoveFromLLByKey(invited_chats,chan);
}
}
struct buddy_chat *find_buddy_chat(char *chat) {
LLE t;
t = FindInLL(buddy_chats,chat);
if ( ! t )
return NULL;
else
return (struct buddy_chat *) t->data;
}
int buddy_chat_leave(char *chan) {
LLE t;
struct buddy_chat *b;
t = FindInLL(buddy_chats,chan);
if ( ! t )
return -1;
b = (struct buddy_chat *) t->data;
serv_chat_leave(b->id);
/* Removed from buddy_chats in toc_callback */
return 1;
}
struct buddy_chat *buddy_chat_getbyid(int id) {
LLE t;
struct buddy_chat *b;
for ( TLL(buddy_chats,t) ) {
b = (struct buddy_chat *) t->data;
if ( id == b->id )
return b;
}
return NULL;
}
int buddy_chat_invite(char *chat, char *buddy, char *msg) {
LLE t;
struct buddy_chat *b;
t = FindInLL(buddy_chats,chat);
if ( ! t )
return -1;
b = (struct buddy_chat *) t->data;
serv_chat_invite(b->id, msg, buddy);
return 1;
}
int buddy_chat_warn(char *chat, char *user, int anon) {
LLE t;
struct buddy_chat *b;
t = FindInLL(buddy_chats,chat);
if ( ! t )
return -1;
b = (struct buddy_chat *) t->data;
serv_chat_warn(b->id, user, anon);
return 1;
}
-86
View File
@@ -1,86 +0,0 @@
/*
* interface.c
*
* by Nadeem Riaz (nads@bleh.org)
*
* Probably should be renamed misc.c (oh well)
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "toc.h"
int (*TOC_RAW_HANDLERS[30])(int, char *);
int (*TOC_HANDLERS[30])(int, char **);
void init_toc() {
int x;
groups = NULL;
permit = NULL;
deny = NULL;
buddy_chats = NULL;
invited_chats = NULL;
strcpy(aim_host,TOC_HOST);
aim_port = TOC_PORT;
strcpy(login_host,AUTH_HOST);
login_port = AUTH_PORT;
/* Init Handlers */
for (x=0;x<30;x++)
TOC_HANDLERS[x] = NULL;
for (x=0;x<30;x++)
TOC_RAW_HANDLERS[x] = NULL;
}
void init_lists() {
if ( groups == NULL ) {
groups = (LL) CreateLL();
SetFreeLLE(groups,&misc_free_group);
}
if ( permit == NULL )
permit = (LL) CreateLL();
if ( deny == NULL )
deny = (LL) CreateLL();
if ( buddy_chats == NULL ) {
buddy_chats = CreateLL();
SetFreeLLE(buddy_chats,&misc_free_buddy_chat);
}
if ( invited_chats == NULL ) {
invited_chats = CreateLL();
SetFreeLLE(invited_chats,&misc_free_invited_chats);
}
}
int install_handler(int type, int (*func)(int, char **)) {
TOC_HANDLERS[type] = func;
return 1;
}
int install_raw_handler(int type, int (*func)(int, char *)) {
TOC_RAW_HANDLERS[type] = func;
return 1;
}
int use_handler(int mode,int type, void *args) {
int ret = 0;
toc_debug_printf("use_handler: mode = %d type = %d",mode,type);
if ( mode == TOC_HANDLE ) {
if ( TOC_HANDLERS[type] == NULL )
toc_debug_printf("Error, no handler installed for %d type",type);
else
ret = TOC_HANDLERS[type](type, (char **) args);
} else if ( mode == TOC_RAW_HANDLE ) {
if ( TOC_RAW_HANDLERS[type] == NULL )
toc_debug_printf("Error, no raw handler installed for %d type",type);
else
ret = TOC_RAW_HANDLERS[type](type, (char *) args);
} else {
toc_debug_printf("Error: %d : unkown handle mode!",mode);
ret = -1;
}
return ret;
}
-148
View File
@@ -1,148 +0,0 @@
/*
* Simple linked list library (replaces GList stuff)
* Yea, it isnt efficient, but its only meant to be used for buddy lists (n < 100) THAT AINT LARGE :)
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ll.h"
/* Creation */
LL CreateLL() {
LL newlist;
LLE head;
newlist = (LL) malloc(sizeof(struct _ll));
head = (LLE) CreateLLE("head element",NULL,NULL);
if ( ! head )
return NULL;
newlist->head = head;
newlist->items = 0;
newlist->curr = head;
newlist->free_e = NULL;
return newlist;
}
LLE CreateLLE (char *key, void *data, LLE next) {
LLE newe;
newe = (LLE) malloc(sizeof(struct _lle));
if ( ! newe ) {
perror("MEM allocation errory!");
return NULL;
}
newe->key = (char *) malloc(strlen(key)+1);
strcpy(newe->key,key);
newe->data = data;
newe->next = next;
return newe;
}
void SetFreeLLE(LL List, void (*free_e)(void *)) {
List->free_e = free_e;
}
int AddToLL(LL List, char *key, void *data) {
LLE p = List->head;
LLE e;
while ( p->next != NULL ) {
p = p->next;
}
e = CreateLLE(key,data,NULL);
p->next = e;
List->items++;
return 1;
}
LLE FindInLL(LL List, char *key) {
LLE p = List->head->next;
while ( p != NULL ) {
/* debug_printf("p != null, key = '%s'",p->key); */
if ( ! strcasecmp(p->key,key) )
break;
p = p->next;
}
return p;
}
void *GetDataFromLLE(LLE e) {
if ( e == NULL )
return NULL;
else
return e->data;
}
/* Removing Items from List */
int RemoveFromLL(LL List, LLE e) {
LLE p = List->head;
LLE b = NULL;
while ( p != NULL && p != e ) {
b = p;
p = p->next;
}
if ( p == NULL )
return -1;
b->next = p->next;
FreeLLE(p, List->free_e);
List->items--;
return 1;
}
int RemoveFromLLByKey(LL List, char *key) {
LLE b = List->head;
LLE p = b->next;
while ( p != NULL ) {
if ( ! strcasecmp(p->key,key) )
break;
b = p;
p = p->next;
}
if ( p == NULL )
return -1;
b->next = p->next;
FreeLLE(p, List->free_e);
List->items--;
return 1;
}
/* For easy loop traversals */
LLE GetNextLLE(LL List) {
if ( List->curr != NULL )
List->curr = List->curr->next;
return List->curr;
}
void ResetLLPosition(LL List) {
List->curr = List->head;
}
/* Only Free the keys at the moment */
void FreeLLE(LLE e, void (*free_e)(void *)) {
if ( e->key != NULL )
free(e->key);
if ( free_e != NULL && e->data != NULL)
free_e(e->data);
free(e);
return;
}
void FreeLL(LL List) {
LLE e;
LLE n;
if ( List == NULL ) {
perror("SERIOUS ERROR: tried to free null list!");
return;
}
e = List->head->next;
free(List->head);
while ( e != NULL ) {
n = e->next;
FreeLLE(e, List->free_e);
e = n;
}
free(List);
return;
}
-44
View File
@@ -1,44 +0,0 @@
#ifndef _LL_H
#define _LL_H
/*
* Really bad list implementation
*/
#define TLL(list,e) e = list->head->next; e; e = e->next
struct _lle {
char *key;
void *data;
struct _lle *next;
};
typedef struct _lle * LLE;
struct _ll {
LLE head;
LLE curr;
void (*free_e)(void *);
int items;
};
typedef struct _ll * LL;
LL CreateLL();
void SetFreeLLE(LL List, void (*free_e)(void *));
LLE CreateLLE (char *key, void *data, LLE next);
int AddToLL(LL List, char *key, void *data);
LLE FindInLL(LL List, char *key);
void *GetDataFromLLE(LLE e);
int RemoveFromLL(LL List, LLE e);
int RemoveFromLLByKey(LL List, char *key);
LLE GetNextLLE(LL List);
void ResetLLPosition(LL List);
void FreeLLE(LLE e, void (*free_e)(void *));
void FreeLL(LL List);
/* Internal */
#endif // _LL_H
-59
View File
@@ -1,59 +0,0 @@
/*
* misc.c
*
* by Nadeem Riaz (nads@bleh.org)
*/
#include "toc.h"
char aim_host[512];
int aim_port;
char login_host[512];
int login_port;
char toc_addy[16];
char aim_username[80];
char aim_password[16];
char *quad_addr;
char debug_buff[1024];
char user_info[2048];
int registered;
char *USER_CLASSES[5] = {
"AOL User",
"AIM Admin",
"Trial Aim User",
"Normal Aim User",
"Unavailable"
};
char *PERMIT_MODES[4] = {
"Permit All",
"Deny All",
"Permit Some",
"Deny Some"
};
void save_prefs()
{
}
void misc_free_group(void *data) {
struct group *g;
g = (struct group *) data;
FreeLL(g->members);
free(g);
}
void misc_free_buddy_chat(void *data) {
struct buddy_chat *b;
b = (struct buddy_chat *) data;
FreeLL(b->in_room);
FreeLL(b->ignored);
free(b);
}
void misc_free_invited_chats(void *data) {
int *t;
t = (int *) data;
free(t);
}
-223
View File
@@ -1,223 +0,0 @@
/*
* gaim
*
* Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
/*
* Modified by Nadeem Riaz (nads@bleh.org) (just rewrote the get_address function)
* for use in libtoc
*/
#include <netdb.h>
#include <unistd.h>
#include <errno.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <sys/socket.h>
#include "toc.h"
#include "proxy.h"
int proxy_type = 0;
char proxy_host[256];
int proxy_port = 3128;
char *proxy_realhost = NULL;
unsigned int *get_address(char *hostname)
{
struct hostent *hp;
unsigned int *sin=NULL;
if ((hp = proxy_gethostbyname(hostname))) {
sin = (unsigned int *) malloc(sizeof(unsigned int));
bcopy((char *)(*(hp->h_addr_list)),(char *)sin,sizeof(hp->h_addr_list));
}
return sin;
}
int connect_address(unsigned int addy, unsigned short port)
{
int fd;
struct sockaddr_in sin;
sin.sin_addr.s_addr = addy;
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd > -1) {
quad_addr=strdup(inet_ntoa(sin.sin_addr));
if (proxy_connect(fd, (struct sockaddr *)&sin, sizeof(sin)) > -1) {
return fd;
}
}
return -1;
}
/*
* Proxy stuff
*/
/* this code is borrowed from cvs 1.10 */
static int
proxy_recv_line (int sock, char **resultp)
{
int c;
char *result;
size_t input_index = 0;
size_t result_size = 80;
result = (char *) malloc (result_size);
while (1)
{
char ch;
if (recv (sock, &ch, 1, 0) < 0)
fprintf (stderr, "recv() error from proxy server\n");
c = ch;
if (c == EOF)
{
free (result);
/* It's end of file. */
fprintf(stderr, "end of file from server\n");
}
if (c == '\012')
break;
result[input_index++] = c;
while (input_index + 1 >= result_size)
{
result_size *= 2;
result = (char *) realloc (result, result_size);
}
}
if (resultp)
*resultp = result;
/* Terminate it just for kicks, but we *can* deal with embedded NULs. */
result[input_index] = '\0';
if (resultp == NULL)
free (result);
return input_index;
}
struct hostent *proxy_gethostbyname(char *host)
{
if (proxy_type == PROXY_NONE)
return (gethostbyname(host));
if (proxy_realhost != NULL)
free(proxy_realhost);
/* we keep the real host name for the Connect command */
proxy_realhost = (char *) strdup(host);
return (gethostbyname(proxy_host));
}
int proxy_connect(int sockfd, struct sockaddr *serv_addr, int
addrlen )
{
struct sockaddr_in name;
int ret;
switch (proxy_type) {
case PROXY_NONE:
/* normal use */
return (connect(sockfd,serv_addr,addrlen));
break;
case PROXY_HTTP: /* Http proxy */
/* do the tunneling */
/* step one : connect to proxy */
{
struct hostent *hostinfo;
unsigned short shortport = proxy_port;
memset (&name, 0, sizeof (name));
name.sin_family = AF_INET;
name.sin_port = htons (shortport);
hostinfo = gethostbyname (proxy_host);
if (hostinfo == NULL) {
fprintf (stderr, "Unknown host %s.\n", proxy_host);
return (-1);
}
name.sin_addr = *(struct in_addr *) hostinfo->h_addr;
}
toc_debug_printf("Trying to connect ...\n");
if ((ret = connect(sockfd,(struct sockaddr *)&name,sizeof(name)))<0)
return(ret);
/* step two : do proxy tunneling init */
{
char cmd[80];
char *inputline;
unsigned short realport=ntohs(((struct sockaddr_in *)serv_addr)->sin_port);
sprintf(cmd,"CONNECT %s:%d HTTP/1.1\n\r\n\r",proxy_realhost,realport);
toc_debug_printf("<%s>\n",cmd);
if (send(sockfd,cmd,strlen(cmd),0)<0)
return(-1);
if (proxy_recv_line(sockfd,&inputline) < 0) {
return(-1);
}
toc_debug_printf("<%s>\n",inputline);
if (memcmp("HTTP/1.0 200 Connection established",inputline,35))
if (memcmp("HTTP/1.1 200 Connection established",inputline,35)) {
free(inputline);
return(-1);
}
while (strlen(inputline)>1) {
free(inputline);
if (proxy_recv_line(sockfd,&inputline) < 0) {
return(-1);
}
toc_debug_printf("<%s>\n",inputline);
}
free(inputline);
}
return ret;
break;
case PROXY_SOCKS:
fprintf(stderr,"Socks proxy is not yet implemented.\n");
return(-1);
break;
default:
fprintf(stderr,"Unknown proxy type : %d.\n",proxy_type);
break;
}
return(-1);
}
-244
View File
@@ -1,244 +0,0 @@
toc.c: In function `toc_callback':
toc.c:525: parse error before `;'
toc.c:525: warning: statement with no effect
toc.c:525: parse error before `)'
toc.c:528: break statement not within loop or switch
toc.c:515: warning: unused variable `buddy'
toc.c:532: `b' undeclared (first use in this function)
toc.c:532: (Each undeclared identifier is reported only once
toc.c:532: for each function it appears in.)
toc.c:536: `in' undeclared (first use in this function)
toc.c:537: `buddy' undeclared (first use in this function)
toc.c: At top level:
toc.c:571: parse error before `else'
toc.c:575: parse error before `2'
toc.c:575: warning: type defaults to `int' in declaration of `use_handler'
toc.c:575: warning: data definition has no type or storage class
toc.c:576: warning: type defaults to `int' in declaration of `idc'
toc.c:576: warning: initialization makes integer from pointer without a cast
toc.c:576: initializer element is not constant
toc.c:576: warning: data definition has no type or storage class
toc.c:577: parse error before string constant
toc.c:577: warning: type defaults to `int' in declaration of `sscanf'
toc.c:577: warning: data definition has no type or storage class
toc.c:579: warning: type defaults to `int' in declaration of `serv_got_chat_left'
toc.c:579: warning: parameter names (without types) in function declaration
toc.c:579: conflicting types for `serv_got_chat_left'
toc.h:191: previous declaration of `serv_got_chat_left'
toc.c:579: warning: data definition has no type or storage class
toc.c:581: warning: type defaults to `int' in declaration of `numargs'
toc.c:581: warning: data definition has no type or storage class
toc.c:582: warning: type defaults to `int' in declaration of `args'
toc.c:582: warning: initialization makes integer from pointer without a cast
toc.c:582: initializer element is not constant
toc.c:582: warning: data definition has no type or storage class
toc.c:583: warning: type defaults to `int' in declaration of `args'
toc.c:583: conflicting types for `args'
toc.c:582: previous declaration of `args'
toc.c:583: warning: passing arg 1 of `strdup' makes pointer from integer without a cast
toc.c:583: invalid initializer
toc.c:583: warning: data definition has no type or storage class
toc.c:584: warning: type defaults to `int' in declaration of `args'
toc.c:584: conflicting types for `args'
toc.c:583: previous declaration of `args'
toc.c:584: invalid initializer
toc.c:584: warning: data definition has no type or storage class
toc.c:585: parse error before `1'
toc.c:585: warning: type defaults to `int' in declaration of `use_handler'
toc.c:585: warning: data definition has no type or storage class
toc.c:589: conflicting types for `idc'
toc.c:576: previous declaration of `idc'
toc.c:591: `b' used prior to declaration
toc.c:593: parse error before `2'
toc.c:593: warning: type defaults to `int' in declaration of `use_handler'
toc.c:593: warning: data definition has no type or storage class
toc.c:594: warning: type defaults to `int' in declaration of `idc'
toc.c:594: conflicting types for `idc'
toc.c:589: previous declaration of `idc'
toc.c:594: warning: initialization makes integer from pointer without a cast
toc.c:594: initializer element is not constant
toc.c:594: warning: data definition has no type or storage class
toc.c:595: parse error before string constant
toc.c:595: warning: type defaults to `int' in declaration of `sscanf'
toc.c:595: warning: data definition has no type or storage class
toc.c:596: warning: type defaults to `int' in declaration of `who'
toc.c:596: conflicting types for `who'
toc.c:590: previous declaration of `who'
toc.c:596: warning: initialization makes integer from pointer without a cast
toc.c:596: initializer element is not constant
toc.c:596: warning: data definition has no type or storage class
toc.c:597: warning: type defaults to `int' in declaration of `whisper'
toc.c:597: conflicting types for `whisper'
toc.c:590: previous declaration of `whisper'
toc.c:597: warning: initialization makes integer from pointer without a cast
toc.c:597: initializer element is not constant
toc.c:597: warning: data definition has no type or storage class
toc.c:598: warning: type defaults to `int' in declaration of `m'
toc.c:598: conflicting types for `m'
toc.c:589: previous declaration of `m'
toc.c:598: initializer element is not constant
toc.c:598: warning: data definition has no type or storage class
toc.c:599: parse error before `while'
toc.c:608: warning: type defaults to `int' in declaration of `b'
toc.c:608: conflicting types for `b'
toc.c:591: previous declaration of `b'
toc.c:608: warning: initialization makes integer from pointer without a cast
toc.c:608: initializer element is not constant
toc.c:608: warning: data definition has no type or storage class
toc.c:609: parse error before `if'
toc.c:611: parse error before string constant
toc.c:611: warning: type defaults to `int' in declaration of `strcpy'
toc.c:611: warning: data definition has no type or storage class
toc.c:614: parse error before `->'
toc.c:614: warning: type defaults to `int' in declaration of `strcpy'
toc.c:614: warning: data definition has no type or storage class
toc.c:616: warning: type defaults to `int' in declaration of `numargs'
toc.c:616: redefinition of `numargs'
toc.c:581: `numargs' previously defined here
toc.c:616: warning: data definition has no type or storage class
toc.c:617: warning: type defaults to `int' in declaration of `args'
toc.c:617: conflicting types for `args'
toc.c:584: previous declaration of `args'
toc.c:617: warning: initialization makes integer from pointer without a cast
toc.c:617: initializer element is not constant
toc.c:617: warning: data definition has no type or storage class
toc.c:618: warning: type defaults to `int' in declaration of `args'
toc.c:618: conflicting types for `args'
toc.c:617: previous declaration of `args'
toc.c:618: warning: passing arg 1 of `strdup' makes pointer from integer without a cast
toc.c:618: invalid initializer
toc.c:618: warning: data definition has no type or storage class
toc.c:619: warning: type defaults to `int' in declaration of `args'
toc.c:619: conflicting types for `args'
toc.c:618: previous declaration of `args'
toc.c:619: warning: passing arg 1 of `strdup' makes pointer from integer without a cast
toc.c:619: invalid initializer
toc.c:619: warning: data definition has no type or storage class
toc.c:620: warning: type defaults to `int' in declaration of `args'
toc.c:620: conflicting types for `args'
toc.c:619: previous declaration of `args'
toc.c:620: warning: passing arg 1 of `strdup' makes pointer from integer without a cast
toc.c:620: invalid initializer
toc.c:620: warning: data definition has no type or storage class
toc.c:621: warning: type defaults to `int' in declaration of `args'
toc.c:621: conflicting types for `args'
toc.c:620: previous declaration of `args'
toc.c:621: warning: passing arg 1 of `strdup' makes pointer from integer without a cast
toc.c:621: invalid initializer
toc.c:621: warning: data definition has no type or storage class
toc.c:623: warning: type defaults to `int' in declaration of `args'
toc.c:623: conflicting types for `args'
toc.c:621: previous declaration of `args'
toc.c:623: invalid initializer
toc.c:623: warning: data definition has no type or storage class
toc.c:624: warning: type defaults to `int' in declaration of `args'
toc.c:624: conflicting types for `args'
toc.c:623: previous declaration of `args'
toc.c:624: invalid initializer
toc.c:624: warning: data definition has no type or storage class
toc.c:625: parse error before `1'
toc.c:625: warning: type defaults to `int' in declaration of `use_handler'
toc.c:625: warning: data definition has no type or storage class
toc.c:628: conflicting types for `who'
toc.c:596: previous declaration of `who'
toc.c:629: conflicting types for `idc'
toc.c:594: previous declaration of `idc'
toc.c:632: parse error before `2'
toc.c:632: warning: type defaults to `int' in declaration of `use_handler'
toc.c:632: warning: data definition has no type or storage class
toc.c:633: warning: type defaults to `int' in declaration of `name'
toc.c:633: warning: initialization makes integer from pointer without a cast
toc.c:633: initializer element is not constant
toc.c:633: warning: data definition has no type or storage class
toc.c:634: warning: type defaults to `int' in declaration of `idc'
toc.c:634: conflicting types for `idc'
toc.c:629: previous declaration of `idc'
toc.c:634: warning: initialization makes integer from pointer without a cast
toc.c:634: initializer element is not constant
toc.c:634: warning: data definition has no type or storage class
toc.c:635: parse error before string constant
toc.c:635: warning: type defaults to `int' in declaration of `sscanf'
toc.c:635: warning: data definition has no type or storage class
toc.c:636: warning: type defaults to `int' in declaration of `who'
toc.c:636: conflicting types for `who'
toc.c:628: previous declaration of `who'
toc.c:636: warning: initialization makes integer from pointer without a cast
toc.c:636: initializer element is not constant
toc.c:636: warning: data definition has no type or storage class
toc.c:637: warning: type defaults to `int' in declaration of `message'
toc.c:637: conflicting types for `message'
toc.c:629: previous declaration of `message'
toc.c:637: warning: initialization makes integer from pointer without a cast
toc.c:637: initializer element is not constant
toc.c:637: warning: data definition has no type or storage class
toc.c:639: warning: type defaults to `int' in declaration of `pid'
toc.c:639: conflicting types for `pid'
toc.c:630: previous declaration of `pid'
toc.c:639: warning: initialization makes integer from pointer without a cast
toc.c:639: initializer element is not constant
toc.c:639: warning: data definition has no type or storage class
toc.c:640: warning: type defaults to `int' in declaration of `pid'
toc.c:640: conflicting types for `pid'
toc.c:639: previous declaration of `pid'
toc.c:640: warning: initialization makes pointer from integer without a cast
toc.c:640: initializer element is not constant
toc.c:640: warning: data definition has no type or storage class
toc.c:641: warning: type defaults to `int' in declaration of `AddToLL'
toc.c:641: warning: parameter names (without types) in function declaration
toc.c:641: warning: data definition has no type or storage class
toc.c:642: warning: type defaults to `int' in declaration of `numargs'
toc.c:642: redefinition of `numargs'
toc.c:616: `numargs' previously defined here
toc.c:642: warning: data definition has no type or storage class
toc.c:643: warning: type defaults to `int' in declaration of `args'
toc.c:643: conflicting types for `args'
toc.c:624: previous declaration of `args'
toc.c:643: warning: initialization makes integer from pointer without a cast
toc.c:643: initializer element is not constant
toc.c:643: warning: data definition has no type or storage class
toc.c:644: warning: type defaults to `int' in declaration of `args'
toc.c:644: conflicting types for `args'
toc.c:643: previous declaration of `args'
toc.c:644: warning: passing arg 1 of `strdup' makes pointer from integer without a cast
toc.c:644: invalid initializer
toc.c:644: warning: data definition has no type or storage class
toc.c:645: warning: type defaults to `int' in declaration of `args'
toc.c:645: conflicting types for `args'
toc.c:644: previous declaration of `args'
toc.c:645: warning: passing arg 1 of `strdup' makes pointer from integer without a cast
toc.c:645: invalid initializer
toc.c:645: warning: data definition has no type or storage class
toc.c:646: warning: type defaults to `int' in declaration of `args'
toc.c:646: conflicting types for `args'
toc.c:645: previous declaration of `args'
toc.c:646: warning: passing arg 1 of `strdup' makes pointer from integer without a cast
toc.c:646: invalid initializer
toc.c:646: warning: data definition has no type or storage class
toc.c:647: warning: type defaults to `int' in declaration of `args'
toc.c:647: conflicting types for `args'
toc.c:646: previous declaration of `args'
toc.c:647: warning: passing arg 1 of `strdup' makes pointer from integer without a cast
toc.c:647: invalid initializer
toc.c:647: warning: data definition has no type or storage class
toc.c:648: warning: type defaults to `int' in declaration of `args'
toc.c:648: conflicting types for `args'
toc.c:647: previous declaration of `args'
toc.c:648: invalid initializer
toc.c:648: warning: data definition has no type or storage class
toc.c:649: parse error before `1'
toc.c:649: warning: type defaults to `int' in declaration of `use_handler'
toc.c:649: warning: data definition has no type or storage class
toc.c:653: warning: type defaults to `int' in declaration of `free'
toc.c:653: warning: parameter names (without types) in function declaration
toc.c:653: conflicting types for `free'
/usr/include/stdlib.h:484: previous declaration of `free'
toc.c:653: warning: data definition has no type or storage class
toc.c:654: warning: type defaults to `int' in declaration of `free'
toc.c:654: warning: parameter names (without types) in function declaration
toc.c:654: warning: data definition has no type or storage class
toc.c:655: parse error before `if'
toc.c:664: warning: type defaults to `int' in declaration of `free'
toc.c:664: warning: parameter names (without types) in function declaration
toc.c:664: warning: data definition has no type or storage class
toc.c:665: parse error before `}'
make: *** [toc.o] Error 1
-18
View File
@@ -1,18 +0,0 @@
#ifndef _PROXY_H
#define _PROXY_H
/* proxy types */
#define PROXY_NONE 0
#define PROXY_HTTP 1
#define PROXY_SOCKS 2 /* Not Implemented !! */
extern struct hostent * proxy_gethostbyname(char *host);
extern int proxy_connect(int sockfd, struct sockaddr *serv_addr, int addrlen );
extern int proxy_type;
extern char proxy_host[256];
extern int proxy_port;
extern char *proxy_realhost;
#endif /* _PROXY_H */
-520
View File
@@ -1,520 +0,0 @@
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#include "toc.h"
static time_t lastsent = 0;
time_t login_time = 0;
int my_evil;
int is_idle = 0;
int lag_ms = 0;
int time_to_idle = 600;
int is_away = 0;
static struct timeval lag_tv;
void serv_add_buddy(char *name)
{
char buf[1024];
snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name));
sflap_send(buf, -1, TYPE_DATA);
}
void serv_remove_buddy(char *name)
{
char buf[1024];
snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name));
sflap_send(buf, -1, TYPE_DATA);
}
int serv_got_im(char *name, char *message, int away)
{
/*
struct conversation *cnv;
int is_idle = -1;
*/
char *nname;
nname = strdup(normalize(name));
if (!strcasecmp(normalize(name), nname)) {
if (!strcmp(message, LAGOMETER_STR)) {
struct timeval tv;
int ms;
gettimeofday(&tv, NULL);
ms = 1000000 * (tv.tv_sec - lag_tv.tv_sec);
ms += tv.tv_usec - lag_tv.tv_usec;
lag_ms = ms;
use_handler(TOC_HANDLE,TOC_LAG_UPDATE,NULL);
return -1;
}
}
/*
cnv = find_conversation(name);
if (cnv == NULL)
cnv = new_conversation(name);
if (away)
write_to_conv(cnv, message, WFLAG_AUTO | WFLAG_RECV);
else
write_to_conv(cnv, message, WFLAG_RECV);
if (cnv->makesound && extrasounds)
play_sound(RECEIVE);
if (awaymessage != NULL) {
time_t t;
time(&t);
if ((cnv == NULL) || (t - cnv->sent_away) < 120)
return;
cnv->sent_away = t;
if (is_idle)
is_idle = -1;
serv_send_im(name, awaymessage->message, 1);
if (is_idle == -1)
is_idle = 1;
write_to_conv(cnv, awaymessage->message, WFLAG_SEND | WFLAG_AUTO);
}
*/
toc_debug_printf("Received im from %s : %s\n",name,message);
return 1;
}
void serv_finish_login()
{
char *buf;
buf = strdup(user_info);
escape_text(buf);
serv_set_info(buf);
free(buf);
use_handler(TOC_HANDLE,TOC_REINSTALL_TIMER,NULL);
time(&login_time);
serv_touch_idle();
serv_add_buddy(aim_username);
if (!registered)
{
/* show_register_dialog(); */
save_prefs();
}
}
void serv_add_buddies(LL buddies)
{
char buf[MSG_LEN];
LLE e;
int n, num = 0;
n = snprintf(buf, sizeof(buf), "toc_add_buddy");
for ( TLL(buddies,e) ) {
if (num == 20) {
sflap_send(buf, -1, TYPE_DATA);
n = snprintf(buf, sizeof(buf), "toc_add_buddy");
num = 0;
}
++num;
n += snprintf(buf + n, sizeof(buf) - n, " %s", normalize((char *)e->key));
}
sflap_send(buf, -1, TYPE_DATA);
}
void serv_got_update(char *name, int loggedin, int evil, time_t signon, time_t idle, int type)
{
struct buddy *b;
char *nname,**args;
b = find_buddy(name);
nname = strdup(normalize(name));
if (!strcasecmp(nname, normalize(aim_username))) {
/*
correction_time = (int)(signon - login_time);
update_all_buddies();
*/
my_evil = evil;
if (!b)
return;
}
if (!b) {
toc_debug_printf("Error, no such person\n");
return;
}
/* This code will 'align' the name from the TOC */
/* server with what's in our record. We want to */
/* store things how THEY want it... */
/*
if (strcmp(name, b->name)) {
GList *cnv = conversations;
struct conversation *cv;
char *who = g_malloc(80);
strcpy(who, normalize(name));
while(cnv) {
cv = (struct conversation *)cnv->data;
if (!strcasecmp(who, normalize(cv->name))) {
g_snprintf(cv->name, sizeof(cv->name), "%s", name);
if (find_log_info(name) || log_all_conv)
g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name);
else
g_snprintf(who, 63, CONVERSATION_TITLE, name);
gtk_window_set_title(GTK_WINDOW(cv->window), who);
*/
/* no free 'who', set_title needs it.
*/
/*
break;
}
cnv = cnv->next;
}
g_snprintf(b->name, sizeof(b->name), "%s", name); */
/*gtk_label_set_text(GTK_LABEL(b->label), b->name);*/
/* okay lets save the new config... */
/* } */
b->idle = idle;
b->evil = evil;
b->uc = type;
b->signon = signon;
if (loggedin) {
if (!b->present) {
b->present = 1;
args = (char **) malloc(sizeof(char *)*1);
args[0] = strdup(b->name);
use_handler(TOC_HANDLE,TOC_BUDDY_LOGGED_ON,args);
free(args[0]); free(args);
/* do_pounce(b->name); */
}
} else {
if ( b->present ) {
args = (char **) malloc(sizeof(char *)*1);
args[0] = strdup(b->name);
use_handler(TOC_HANDLE,TOC_BUDDY_LOGGED_OFF,args);
free(args[0]); free(args);
}
b->present = 0;
}
/*
set_buddy(b);
*/
}
void serv_send_im(char *name, char *message)
{
char buf[MSG_LEN - 7];
snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
message, ((is_away) ? " auto" : ""));
sflap_send(buf, strlen(buf), TYPE_DATA);
if (!is_away && strcasecmp(message,LAGOMETER_STR) != 0)
serv_touch_idle();
}
void serv_close()
{
toc_close();
}
void serv_save_config()
{
char *buf = malloc(BUF_LONG);
char *buf2 = malloc(MSG_LEN);
toc_build_config(buf, BUF_LONG / 2);
snprintf(buf2, MSG_LEN, "toc_set_config {%s}", buf);
sflap_send(buf2, -1, TYPE_DATA);
free(buf2);
free(buf);
}
void serv_warn(char *name, int anon)
{
char *send = malloc(256);
snprintf(send, 255, "toc_evil %s %s", name,
((anon) ? "anon" : "norm"));
sflap_send(send, -1, TYPE_DATA);
free(send);
}
void serv_add_permit(char *name)
{
char buf[1024];
snprintf(buf, sizeof(buf), "toc_add_permit %s", normalize(name));
sflap_send(buf, -1, TYPE_DATA);
}
void serv_add_deny(char *name)
{
char buf[1024];
snprintf(buf, sizeof(buf), "toc_add_deny %s", normalize(name));
sflap_send(buf, -1, TYPE_DATA);
}
void serv_set_permit_deny()
{
char buf[MSG_LEN];
char type[30];
int at;
LLE t;
LL l;
/* FIXME! We flash here. */
if (permdeny == PERMIT_PERMITALL || permdeny == PERMIT_PERMITSOME) {
strcpy(type,"toc_add_permit");
l = permit;
} else {
strcpy(type,"toc_add_deny");
l = deny;
}
sflap_send(type, -1, TYPE_DATA);
if ( permdeny == PERMIT_DENYALL || permdeny == PERMIT_PERMITALL ) {
if ( permdeny == PERMIT_DENYALL )
strcpy(type,"toc_add_permit");
else
strcpy(type,"toc_add_deny");
sflap_send(type, -1, TYPE_DATA);
return;
}
at = snprintf(buf, sizeof(buf), "%s",type);
for ( TLL(l,t) ) {
at += snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(t->key));
}
buf[at] = 0;
sflap_send(buf, -1, TYPE_DATA);
}
void serv_got_joined_chat(int id, char *name)
{
struct buddy_chat *b;
b = (struct buddy_chat *) malloc(sizeof(struct buddy_chat));
b->ignored = CreateLL();
b->in_room = CreateLL();
b->id = id;
b->init_chat = 0;
snprintf(b->name, 80, "%s", name);
AddToLL(buddy_chats,name,b);
}
void serv_got_chat_left(int id)
{
LLE t;
struct buddy_chat *b = NULL;
for ( TLL(buddy_chats,t) ) {
b = (struct buddy_chat *)t->data;
if (id == b->id) {
break;
}
b = NULL;
}
if (!b)
return;
RemoveFromLLByKey(buddy_chats,b->name);
toc_debug_printf("leaking memory in serv_got_chat_left");
}
void serv_accept_chat(int i)
{
char *buf = malloc(256);
snprintf(buf, 255, "toc_chat_accept %d", i);
sflap_send(buf, -1, TYPE_DATA);
free(buf);
}
void serv_join_chat(int exchange, char *name)
{
char buf[BUF_LONG];
snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name);
sflap_send(buf, -1, TYPE_DATA);
}
void serv_chat_invite(int id, char *message, char *name)
{
char buf[BUF_LONG];
snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name));
sflap_send(buf, -1, TYPE_DATA);
}
void serv_chat_leave(int id)
{
char *buf = malloc(256);
snprintf(buf, 255, "toc_chat_leave %d", id);
sflap_send(buf, -1, TYPE_DATA);
free(buf);
}
void serv_chat_whisper(int id, char *who, char *message)
{
char buf2[MSG_LEN];
snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message);
sflap_send(buf2, -1, TYPE_DATA);
}
void serv_chat_send(int id, char *message)
{
char buf[MSG_LEN];
snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message);
sflap_send(buf, -1, TYPE_DATA);
serv_touch_idle();
}
void serv_chat_warn(int id, char *user, int anon) {
char send[256];
snprintf(send, 255, "toc_chat_evil %d %s %s", id, user, ((anon) ? "anon" : "norm"));
sflap_send(send, -1, TYPE_DATA);
}
void serv_get_dir(char *name) {
char buf[MSG_LEN];
snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name));
sflap_send(buf, -1, TYPE_DATA);
}
void serv_set_dir(char *first, char *middle, char *last, char *maiden,
char *city, char *state, char *country, char *email, int web)
{
char buf2[BUF_LEN], buf[BUF_LEN];
/* sending email seems to mess this up? */
snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first,
middle, last, maiden, city, state, country,
(web == 1) ? "Y" : "");
escape_text(buf2);
snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2);
sflap_send(buf, -1, TYPE_DATA);
}
void serv_dir_search(char *first, char *middle, char *last, char *maiden,
char *city, char *state, char *country, char *email)
{
char buf[BUF_LONG];
snprintf(buf, sizeof(buf)/2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle, last, maiden, city, state, country, email);
toc_debug_printf("Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, city, state, country);
sflap_send(buf, -1, TYPE_DATA);
}
void serv_get_info(char *name)
{
char buf[MSG_LEN];
snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name));
sflap_send(buf, -1, TYPE_DATA);
}
void serv_set_info(char *info)
{
char buf[MSG_LEN];
snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info);
sflap_send(buf, -1, TYPE_DATA);
}
void serv_touch_idle() {
/* Are we idle? If so, not anymore */
if (is_idle > 0) {
is_idle = 0;
serv_set_idle(0);
use_handler(TOC_HANDLE,TOC_WENT_IDLE,NULL);
}
time(&lastsent);
}
void serv_set_idle(int time)
{
char buf[256];
snprintf(buf, sizeof(buf), "toc_set_idle %d", time);
sflap_send(buf, -1, TYPE_DATA);
}
int check_idle() {
time_t t;
time(&t);
use_handler(TOC_HANDLE,TOC_REINSTALL_TIMER,NULL);
gettimeofday(&lag_tv, NULL);
serv_send_im(aim_username, LAGOMETER_STR);
/*
if (report_idle != IDLE_GAIM)
return TRUE;
*/
if (is_idle || is_away)
return 1;
toc_debug_printf("time_to_idle = %d, current idle = %d, t = %d, last_sent = %d",time_to_idle,(t - lastsent),t,lastsent);
if ((t - lastsent) > time_to_idle) { /* 10 minutes! */
serv_set_idle((int)t - lastsent);
toc_debug_printf("went idle wieth time_to_idle = %d",time_to_idle);
use_handler(TOC_HANDLE,TOC_WENT_IDLE,NULL);
is_idle = 1;
}
return 1;
}
void serv_set_away(char *message) {
char buf[MSG_LEN];
if ( ! is_away && message ) {
is_away = 1;
snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message);
} else {
is_away = 0;
snprintf(buf, MSG_LEN, "toc_set_away");
}
sflap_send(buf, -1, TYPE_DATA);
}
-17
View File
@@ -1,17 +0,0 @@
CC = gcc
CFLAGS = -Wall -g
INCLUDES = -I../ -I../../
.c.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $<
LTOBJS = lltest.o
lltest: $(LTOBJS)
$(CC) -o lltest $(LTOBJS) ../ll.o
test: main.o
gcc -o test main.o ../libtoc.a
clean:
rm -rf lltest test main.o $(LTOBJS)
-60
View File
@@ -1,60 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "ll.h"
void myfunc(void *data) {
char *t;
t = (char *) data;
printf("GOT data = %s\n",t);
free(t);
}
int main() {
LL l = CreateLL();
LL z = CreateLL();
LLE e;
char *b;
FreeLL(z);
SetFreeLLE(l,&myfunc);
b = (char *) malloc(1000);
strcpy(b,"I like you, you like me");
AddToLL(l,"1",b);
b = (char *) malloc(1000);
strcpy(b,"or maybe not?");
AddToLL(l,"2",b);
b = (char *) malloc(1000);
strcpy(b,"I hope you do at least!@$");
AddToLL(l,"3",b);
b = (char *) malloc(1000);
strcpy(b,"8if you dont, why the fuxor not1@$");
AddToLL(l,"4",b);
ResetLLPosition(l);
while ( (e = GetNextLLE(l)) ) {
printf("key = %s, data = %s\n",e->key,(char *)e->data);
}
printf("Going to TLL Traversal\n");
for ( TLL(l,e) ) {
printf("key = %s, data = %s\n",e->key,(char *)e->data);
}
ResetLLPosition(l);
e = FindInLL(l,"3");
printf("result of find = %s\n",(char *)e->data);
RemoveFromLLByKey(l,"2");
while ( (e = GetNextLLE(l)) ) {
printf("key = %s, data = %s\n",e->key,(char *)e->data);
}
e = FindInLL(l,"9");
if ( e ) {
printf("Found 9\n");
} else {
printf("didnt find key 9\n");
}
FreeLL(l);
printf("l is freed, all good!\n");
l = CreateLL();
printf("back here\n");
printf("%d\n",sizeof(struct _lle));
printf("%d\n",sizeof(LLE));
return 1;
}
-61
View File
@@ -1,61 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <stdarg.h>
#include <unistd.h>
#include "toc.h"
extern int state;
int sfd;
int (*cb)(int);
int toc_got_im(char **args) {
printf("msg: %s %s",args[0],args[1]);
return 1;
}
int toc_remove_input_stream(int fd) {
return 1;
}
int toc_add_input_stream(int fd,int (*func)(int)) {
sfd = fd;
cb = func;
printf("got input stream!\n");
return 1;
}
void statusput(char *buf) {
printf("%s\n",buf);
}
void statusprintf(char *fmt, ...)
{
char data[MAX_OUTPUT_MSG_LEN];
va_list ptr;
va_start(ptr, fmt);
vsnprintf(data, MAX_OUTPUT_MSG_LEN - 1 , fmt, ptr);
va_end(ptr);
statusput(data);
return;
}
int main(int argc, char **argv) {
fd_set set;
init_toc();
printf("state: %d\n",state);
toc_login(argv[1],argv[2]);
install_handler(TOC_IM_IN,&toc_got_im);
printf("back from toc login call!\n");
while ( 1 ) {
FD_SET(sfd,&set);
if ( select(sfd+1,&set,NULL,NULL,NULL) ) {
if ( FD_ISSET(sfd,&set) ) {
printf("data on sock!\n");
cb(sfd);
}
}
FD_ZERO(&set);
}
return 1;
}
-869
View File
@@ -1,869 +0,0 @@
/*
* gaim
*
* Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
/*
* Heavily modified by Nadeem Riaz (nads@bleh.org)
* for use in libtoc
*/
#include <netdb.h>
#include <unistd.h>
#include <errno.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <sys/socket.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "toc.h"
/* descriptor for talking to TOC */
static int toc_fd;
static int seqno;
static unsigned int peer_ver=0;
int state;
/* static int inpa=-1; */
int permdeny = PERMIT_PERMITALL;
int toc_login(char *username, char *password)
{
char *config;
struct in_addr *sin;
char buf[80];
char buf2[2048];
toc_debug_printf("looking up host! %s", aim_host);
sin = (struct in_addr *)get_address(aim_host);
if (!sin) {
set_state(STATE_OFFLINE);
toc_msg_printf(TOC_CONNECT_MSGS,"Unable to lookup %s", aim_host);
return -1;
}
snprintf(toc_addy, sizeof(toc_addy), "%s", inet_ntoa(*sin));
snprintf(buf, sizeof(buf), "Connecting to %s", inet_ntoa(*sin));
toc_msg_printf(TOC_CONNECT_MSGS,"%s",buf);
toc_fd = connect_address(sin->s_addr, aim_port);
if (toc_fd < 0) {
set_state(STATE_OFFLINE);
toc_msg_printf(TOC_CONNECT_MSGS,"Connect to %s failed", inet_ntoa(*sin));
return -1;
}
free(sin);
toc_msg_printf(TOC_CONNECT_MSGS,"Signon: %s",username);
if (toc_signon(username, password) < 0) {
set_state(STATE_OFFLINE);
toc_msg_printf(TOC_CONNECT_MSGS,"Disconnected.");
return -1;
}
toc_msg_printf(TOC_CONNECT_MSGS,"Waiting for reply...");
if (toc_wait_signon() < 0) {
set_state(STATE_OFFLINE);
toc_msg_printf(TOC_CONNECT_MSGS,"Authentication Failed");
return -1;
}
snprintf(aim_username, sizeof(aim_username), "%s", username);
snprintf(aim_password, sizeof(aim_password), "%s", password);
save_prefs();
toc_msg_printf(TOC_CONNECT_MSGS,"Retrieving config...");
if ((config=toc_wait_config()) == NULL) {
toc_msg_printf(TOC_CONNECT_MSGS,"No Configuration\n");
set_state(STATE_OFFLINE);
return -1;
}
init_lists();
/* gtk_widget_hide(mainwindow);
show_buddy_list(); */
parse_toc_buddy_list(config);
/* refresh_buddy_window(); */
snprintf(buf2, sizeof(buf2), "toc_init_done");
sflap_send(buf2, -1, TYPE_DATA);
serv_finish_login();
return 0;
}
void toc_close()
{
seqno = 0;
state = STATE_OFFLINE;
toc_remove_input_stream(toc_fd);
close(toc_fd);
toc_fd=-1;
}
int toc_signon(char *username, char *password)
{
char buf[BUF_LONG];
int res;
struct signon so;
toc_debug_printf("State = %d\n", state);
strncpy(aim_username, username, sizeof(aim_username));
if ((res = write(toc_fd, FLAPON, strlen(FLAPON))) < 0)
return res;
/* Wait for signon packet */
state = STATE_FLAPON;
if ((res = wait_reply(buf, sizeof(buf)) < 0))
return res;
if (state != STATE_SIGNON_REQUEST) {
toc_debug_printf( "State should be %d, but is %d instead\n", STATE_SIGNON_REQUEST, state);
return -1;
}
/* Compose a response */
snprintf(so.username, sizeof(so.username), "%s", username);
so.ver = ntohl(1);
so.tag = ntohs(1);
so.namelen = htons(strlen(so.username));
sflap_send((char *)&so, ntohs(so.namelen) + 8, TYPE_SIGNON);
snprintf(buf, sizeof(buf),
"toc_signon %s %d %s %s %s \"%s\"",
login_host, login_port, normalize(username), roast_password(password), LANGUAGE, REVISION);
toc_debug_printf("Send: %s\n", buf);
return sflap_send(buf, -1, TYPE_DATA);
}
int toc_wait_signon()
{
/* Wait for the SIGNON to be approved */
char buf[BUF_LEN];
int res;
res = wait_reply(buf, sizeof(buf));
if (res < 0)
return res;
if (state != STATE_SIGNON_ACK) {
toc_debug_printf("State should be %d, but is %d instead\n",STATE_SIGNON_ACK, state);
return -1;
}
return 0;
}
int wait_reply(char *buffer, int buflen)
{
int res=6;
struct sflap_hdr *hdr=(struct sflap_hdr *)buffer;
char *c;
while((res = read(toc_fd, buffer, 1))) {
if (res < 0)
return res;
if (buffer[0] == '*')
break;
}
res = read(toc_fd, buffer+1, sizeof(struct sflap_hdr) - 1);
if (res < 0)
return res;
res += 1;
toc_debug_printf( "Rcv: %s %s\n",print_header(buffer), "");
while (res < (sizeof(struct sflap_hdr) + ntohs(hdr->len))) {
res += read(toc_fd, buffer + res, (ntohs(hdr->len) + sizeof(struct sflap_hdr)) - res);
/* while(gtk_events_pending())
gtk_main_iteration(); */
}
if (res >= sizeof(struct sflap_hdr))
buffer[res]='\0';
else
return res - sizeof(struct sflap_hdr);
switch(hdr->type) {
case TYPE_SIGNON:
memcpy(&peer_ver, buffer + sizeof(struct sflap_hdr), 4);
peer_ver = ntohl(peer_ver);
seqno = ntohs(hdr->seqno);
state = STATE_SIGNON_REQUEST;
break;
case TYPE_DATA:
if (!strncasecmp(buffer + sizeof(struct sflap_hdr), "SIGN_ON:", strlen("SIGN_ON:")))
state = STATE_SIGNON_ACK;
else if (!strncasecmp(buffer + sizeof(struct sflap_hdr), "CONFIG:", strlen("CONFIG:"))) {
state = STATE_CONFIG;
} else if (state != STATE_ONLINE && !strncasecmp(buffer + sizeof(struct sflap_hdr), "ERROR:", strlen("ERROR:"))) {
c = strtok(buffer + sizeof(struct sflap_hdr) + strlen("ERROR:"), ":");
translate_toc_error_code(c);
toc_debug_printf("ERROR CODE: %s\n",c);
}
toc_debug_printf("Data: %s\n",buffer + sizeof(struct sflap_hdr));
break;
default:
toc_debug_printf("Unknown/unimplemented packet type %d\n",hdr->type);
}
return res;
}
int sflap_send(char *buf, int olen, int type)
{
int len;
int slen=0;
struct sflap_hdr hdr;
char obuf[MSG_LEN];
/* One _last_ 2048 check here! This shouldn't ever
* get hit though, hopefully. If it gets hit on an IM
* It'll lose the last " and the message won't go through,
* but this'll stop a segfault. */
if (strlen(buf) > (MSG_LEN - sizeof(hdr))) {
buf[MSG_LEN - sizeof(hdr) - 3] = '"';
buf[MSG_LEN - sizeof(hdr) - 2] = '\0';
}
toc_debug_printf("%s [Len %d]\n", buf, strlen(buf));
if (olen < 0)
len = escape_message(buf);
else
len = olen;
hdr.ast = '*';
hdr.type = type;
hdr.seqno = htons(seqno++ & 0xffff);
hdr.len = htons(len + (type == TYPE_SIGNON ? 0 : 1));
toc_debug_printf("Escaped message is '%s'\n",buf);
memcpy(obuf, &hdr, sizeof(hdr));
slen += sizeof(hdr);
memcpy(&obuf[slen], buf, len);
slen += len;
if (type != TYPE_SIGNON) {
obuf[slen]='\0';
slen += 1;
}
/* print_buffer(obuf, slen); */
return write(toc_fd, obuf, slen);
}
unsigned char *roast_password(char *pass)
{
/* Trivial "encryption" */
static char rp[256];
static char *roast = ROAST;
int pos=2;
int x;
strcpy(rp, "0x");
for (x=0;(x<150) && pass[x]; x++)
pos+=sprintf(&rp[pos],"%02x", pass[x] ^ roast[x % strlen(roast)]);
rp[pos]='\0';
return rp;
}
char *print_header(void *hdr_v)
{
static char s[80];
struct sflap_hdr *hdr = (struct sflap_hdr *)hdr_v;
snprintf(s,sizeof(s), "[ ast: %c, type: %d, seqno: %d, len: %d ]",
hdr->ast, hdr->type, ntohs(hdr->seqno), ntohs(hdr->len));
return s;
}
int toc_callback(int fd)
{
char *buf;
char *c;
char **args = NULL;
char *dup,*raw;
char *l;
int numargs =0;
buf = malloc(BUF_LONG);
if (wait_reply(buf, BUF_LONG) < 0) {
toc_signoff();
toc_debug_printf("need to do proper sign off on this\n");
toc_msg_printf(TOC_CONNECT_MSGS,"Connection Closed");
return -1;
}
dup = strdup(buf+sizeof(struct sflap_hdr));
raw = rindex(dup,':');
c=strtok(buf+sizeof(struct sflap_hdr),":"); /* Ditch the first part */
if (!strcasecmp(c,"UPDATE_BUDDY")) {
char *uc, *t;
int logged, evil, idle, type = 0;
time_t signon;
time_t time_idle;
numargs = 7;
args = (char **) malloc(sizeof(char *)*numargs);
use_handler(TOC_RAW_HANDLE,TOC_UPDATE_BUDDY,raw);
c = strtok(NULL,":"); /* c is name */
args[0] = strdup(c);
l = strtok(NULL,":"); /* l is T/F logged status */
args[1] = strdup(l);
t = strtok(NULL, ":");
args[2] = strdup(t);
sscanf(t, "%d", &evil);
t = strtok(NULL, ":");
args[3] = strdup(t);
sscanf(t, "%ld", &signon);
t = strtok(NULL, ":");
args[4] = strdup(t);
sscanf(t, "%d", &idle);
uc = strtok(NULL, ":");
args[5] = strdup(uc);
if (!strncasecmp(l,"T",1))
logged = 1;
else
logged = 0;
if (uc[0] == 'A')
type |= UC_AOL;
switch(uc[1]) {
case 'A':
type |= UC_ADMIN;
break;
case 'U':
type |= UC_UNCONFIRMED;
break;
case 'O':
type |= UC_NORMAL;
break;
default:
break;
}
switch(uc[2]) {
case 'U':
type |= UC_UNAVAILABLE;
break;
default:
break;
}
if (idle) {
time(&time_idle);
time_idle -= idle*60;
} else
time_idle = 0;
serv_got_update(c, logged, evil, signon, time_idle, type);
args[6] = NULL;
use_handler(TOC_HANDLE,TOC_UPDATE_BUDDY,args);
} else if (!strcasecmp(c, "ERROR")) {
use_handler(TOC_RAW_HANDLE,TOC_ERROR,raw);
c = strtok(NULL,":");
translate_toc_error_code(c);
args = (char **) malloc(sizeof(char *)*1 + 1);
numargs = 1;
args[0] = strdup(c);
use_handler(TOC_HANDLE,TOC_ERROR,args);
toc_debug_printf("ERROR: %s",c);
} else if (!strcasecmp(c, "NICK")) {
use_handler(TOC_RAW_HANDLE,TOC_NICK,raw);
c = strtok(NULL,":");
snprintf(aim_username, sizeof(aim_username), "%s", c);
numargs = 2;
args = (char **) malloc(sizeof(char *)*numargs);
args[0] = strdup(c);
args[1] = NULL;
use_handler(TOC_HANDLE,TOC_NICK,args);
} else if (!strcasecmp(c, "IM_IN")) {
char *away, *message;
int a = 0;
use_handler(TOC_RAW_HANDLE,TOC_IM_IN,raw);
c = strtok(NULL,":");
away = strtok(NULL,":");
message = away;
while(*message && (*message != ':'))
message++;
message++;
if (!strncasecmp(away, "T", 1))
a = 1;
if ( serv_got_im(c, message,a) > 0 ) {
numargs = 3;
args = (char **) malloc(sizeof(char *)*numargs);
args[0] = strdup(c);
args[1] = strdup(message);
args[2] = NULL;
use_handler(TOC_HANDLE,TOC_IM_IN,args);
}
} else if (!strcasecmp(c, "GOTO_URL")) {
char *name;
char *url;
char tmp[256];
use_handler(TOC_RAW_HANDLE,TOC_GOTO_URL,raw);
name = strtok(NULL, ":");
url = strtok(NULL, ":");
snprintf(tmp, sizeof(tmp), "http://%s:%d/%s", toc_addy, aim_port, url);
/* fprintf(stdout, "Name: %s\n%s\n", name, url);
printf("%s", grab_url(tmp));*/
numargs = 2;
args = (char **) malloc(sizeof(char *)*numargs);
args[0] = strdup(tmp);
args[1] = NULL;
use_handler(TOC_HANDLE,TOC_GOTO_URL,args);
/* statusprintf("GOTO_URL: %s","tmp"); */
} else if (!strcasecmp(c, "EVILED")) {
int lev;
char *name = NULL;
char *levc;
use_handler(TOC_RAW_HANDLE,TOC_EVILED,raw);
levc = strtok(NULL, ":");
sscanf(levc, "%d", &lev);
name = strtok(NULL, ":");
toc_debug_printf("evil: %s | %d\n", name, lev);
numargs = 3;
my_evil = lev;
args = (char **) malloc(sizeof(char *)*numargs);
if ( name != NULL )
args[0] = strdup(name);
else
args[0] = NULL;
args[1] = strdup(levc);
args[2] = NULL;
use_handler(TOC_HANDLE,TOC_EVILED,args);
} else if (!strcasecmp(c, "CHAT_JOIN")) {
char *name,*idc;
int id;
use_handler(TOC_RAW_HANDLE,TOC_CHAT_JOIN,raw);
idc = strtok(NULL, ":");
sscanf(idc, "%d", &id);
name = strtok(NULL, ":");
serv_got_joined_chat(id, name);
numargs = 3;
args = (char **) malloc(sizeof(char *)*numargs);
args[0] = strdup(idc);
args[1] = strdup(name);
args[2] = NULL;
use_handler(TOC_HANDLE,TOC_CHAT_JOIN,args);
} else if (!strcasecmp(c, "DIR_STATUS")) {
char *status;
use_handler(TOC_RAW_HANDLE,TOC_DIR_STATUS,raw);
status = strtok(NULL,":");
numargs = 2;
args = (char **) malloc(sizeof(char *)*numargs);
args[0] = strdup(status);
args[1] = NULL;
use_handler(TOC_HANDLE,TOC_DIR_STATUS,args);
} else if (!strcasecmp(c, "CHAT_UPDATE_BUDDY")) {
int id;
char *in,*idc;
char *buddy;
LLE t;
struct buddy_chat *b = NULL;
use_handler(TOC_RAW_HANDLE,TOC_CHAT_UPDATE_BUDDY,raw);
idc = strtok(NULL, ":");
sscanf(idc, "%d", &id);
in = strtok(NULL, ":");
for ( TLL(buddy_chats,t) ) {
b = (struct buddy_chat *)t->data;
if (id == b->id)
break;
b = NULL;
}
if (!b)
return -2;
if (!strcasecmp(in, "T")) {
while((buddy = strtok(NULL, ":")) != NULL) {
/*
* Fuxin aim causes a problem here
*/
AddToLL(b->in_room, buddy,NULL);
if ( b->init_chat ) {
args = (char **) malloc(sizeof(char *)*3);
args[0] = strdup(b->name);
args[1] = strdup(buddy);
args[2] = NULL;
use_handler(TOC_HANDLE,TOC_BUDDY_JOIN_CHAT,args);
free(args[0]); free(args[1]); free(args); args = NULL;
}
}
/*
* init_chat is so that the user doenst get flooded
* with user joined chat when he first joins a chat
*/
b->init_chat = 1;
} else {
while((buddy = strtok(NULL, ":")) != NULL) {
RemoveFromLLByKey(b->in_room, buddy);
/*
* Since we might get multiple leave/joins at once
* we allocate & deallocate here
*/
args = (char **) malloc(sizeof(char *)*3);
args[0] = strdup(b->name);
args[1] = strdup(buddy);
args[2] = NULL;
use_handler(TOC_HANDLE,TOC_BUDDY_LEFT_CHAT,args);
free(args[0]); free(args[1]); free(args); args = NULL;
}
}
} else if (!strcasecmp(c, "CHAT_LEFT")) {
char *idc;
int id;
use_handler(TOC_RAW_HANDLE,TOC_CHAT_LEFT,raw);
idc = strtok(NULL, ":");
sscanf(idc, "%d", &id);
serv_got_chat_left(id);
numargs = 2;
args = (char **) malloc(sizeof(char *)*numargs);
args[0] = strdup(idc);
args[1] = NULL;
use_handler(TOC_HANDLE,TOC_CHAT_LEFT,args);
} else if (!strcasecmp(c, "CHAT_IN")) {
int id, w;
char *m,*idc;
char *who, *whisper, *chan;
struct buddy_chat *b;
use_handler(TOC_RAW_HANDLE,TOC_CHAT_IN,raw);
idc = strtok(NULL, ":");
sscanf(idc, "%d", &id);
who = strtok(NULL, ":");
whisper = strtok(NULL, ":");
m = whisper;
while(*m && (*m != ':')) m++;
m++;
if (!strcasecmp(whisper, "T"))
w = 1;
else
w = 0;
/* serv_got_chat_in(id, who, w, m); */
b = buddy_chat_getbyid(id);
if ( ! b ) {
chan = (char *) malloc(50);
strcpy(chan,"ERROR Couldn't lookup chan!");
} else {
chan = (char *) malloc(strlen(b->name)+1);
strcpy(chan,b->name);
}
numargs = 6;
args = (char **) malloc(sizeof(char *)*numargs);
args[0] = strdup(idc);
args[1] = strdup(who);
args[2] = strdup(whisper);
args[3] = strdup(m);
/* Added arg to make things simple */
args[4] = chan;
args[5] = NULL;
use_handler(TOC_HANDLE,TOC_CHAT_IN,args);
} else if (!strcasecmp(c, "CHAT_INVITE")) {
char *name;
char *who;
char *message,*idc;
int id, *pid;
use_handler(TOC_RAW_HANDLE,TOC_CHAT_INVITE,raw);
name = strtok(NULL, ":");
idc = strtok(NULL, ":");
sscanf(idc, "%d", &id);
who = strtok(NULL, ":");
message = strtok(NULL, ":");
/* serv_got_chat_invite(name, id, who, message); */
pid = (int *) malloc(sizeof(int));
*pid = id;
AddToLL(invited_chats,name,pid);
numargs = 5;
args = (char **) malloc(sizeof(char *)*numargs);
args[0] = strdup(name);
args[1] = strdup(idc);
args[2] = strdup(who);
args[3] = strdup(message);
args[4] = NULL;
use_handler(TOC_HANDLE,TOC_CHAT_INVITE,args);
} else {
toc_debug_printf("don't know what to do with %s\n", c);
}
free(dup);
free(buf);
if ( args != NULL ) {
int x;
/* toc_debug_printf("\nGOING TO FREE!: numargs = %d",numargs); */
for (x=0;x< numargs; x++)
if ( args[x] != NULL ) {
/* toc_debug_printf("freeing %d",x); */
free(args[x]);
}
/* toc_debug_printf(""); */
free(args);
}
return 1;
}
char *toc_wait_config()
{
/* Waits for configuration packet, returning the contents of the packet */
static char buf[BUF_LEN];
int res;
res = wait_reply(buf, sizeof(buf));
if (res < 0)
return NULL;
if (state != STATE_CONFIG) {
toc_debug_printf("State should be %d, but is %d instead\n",STATE_CONFIG, state);
return NULL;
}
/* At this point, it's time to setup automatic handling of incoming packets */
state = STATE_ONLINE;
// inpa = gdk_input_add(toc_fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_callback, NULL);
toc_add_input_stream(toc_fd,&toc_callback);
return buf;
}
void parse_toc_buddy_list(char *config)
{
char *c;
char current[256];
char *name;
LL bud = CreateLL();
/* skip "CONFIG:" (if it exists)*/
c = strncmp(config + sizeof(struct sflap_hdr),"CONFIG:",strlen("CONFIG:"))?
strtok(config, "\n"):
strtok(config + sizeof(struct sflap_hdr)+strlen("CONFIG:"), "\n");
do {
if (c == NULL)
break;
if (*c == 'g') {
strncpy(current,c+2, sizeof(current));
add_group(current);
} else if (*c == 'b') {
add_buddy(current, c+2);
AddToLL(bud, c+2, NULL);
} else if (*c == 'p') {
name = malloc(strlen(c+2) + 2);
snprintf(name, strlen(c+2) + 1, "%s", c+2);
AddToLL(permit, name, NULL);
} else if (*c == 'd') {
name = malloc(strlen(c+2) + 2);
snprintf(name, strlen(c+2) + 1, "%s", c+2);
AddToLL(deny, name,NULL);
} else if (*c == 'm') {
sscanf(c + strlen(c) - 1, "%d", &permdeny);
if (permdeny == 0)
permdeny = PERMIT_PERMITALL;
}
} while ((c=strtok(NULL,"\n")));
serv_add_buddies(bud);
FreeLL(bud);
serv_set_permit_deny();
}
int toc_signoff() {
/* Leaking memory like a MOFO */
FreeLL(groups);
FreeLL(buddy_chats);
FreeLL(invited_chats);
FreeLL(permit);
FreeLL(deny);
deny = groups = permit = buddy_chats = invited_chats = NULL;
toc_debug_printf("LEAKING MEMORY LIKE A BITCH in toc_signoff!");
serv_close();
toc_msg_printf(TOC_CONNECT_MSGS,"%s signed off",aim_username);
return 1;
}
void toc_build_config(char *s, int len)
{
struct group *g;
struct buddy *b;
LLE t,t1;
LL mem;
int pos=0;
toc_debug_printf("FIX this permdeny hack shit!");
if (!permdeny)
permdeny = PERMIT_PERMITALL;
pos += snprintf(&s[pos], len - pos, "m %d\n", permdeny);
/* Create Buddy List */
for ( TLL(groups,t) ) {
g = (struct group *)t->data;
pos += snprintf(&s[pos], len - pos, "g %s\n", g->name);
mem = g->members;
for ( TLL(mem,t1) ) {
b = (struct buddy *)t1->data;
pos += snprintf(&s[pos], len - pos, "b %s\n", b->name);
}
}
/* Create Permit and Deny Lists */;
for ( TLL(permit,t) ) {
toc_debug_printf("permit: added %s\n",(char *)t->key);
pos += snprintf(&s[pos], len - pos, "p %s\n", (char *)t->key);
}
for ( TLL(deny,t) ) {
toc_debug_printf("deny: added %s\n",(char *)t->key);
pos += snprintf(&s[pos], len - pos, "d %s\n", (char *)t->key);
}
}
void translate_toc_error_code(char *c) {
int no = atoi(c);
char *w = strtok(NULL, ":");
char buf[256];
switch ( no ) {
case 901:
snprintf(buf, sizeof(buf), "%s not currently logged in.", w);
break;
case 902:
snprintf(buf, sizeof(buf), "Warning of %s not allowed.", w);
break;
case 903:
snprintf(buf, sizeof(buf), "A message has been dropped, you are exceeding the server speed limit.");
break;
case 950:
snprintf(buf, sizeof(buf), "Chat in %s is not available.", w);
break;
case 960:
snprintf(buf, sizeof(buf), "You are sending messages too fast to %s.", w);
break;
case 961:
snprintf(buf, sizeof(buf), "You missed an IM from %s because it was too big.", w);
break;
case 962:
snprintf(buf, sizeof(buf), "You missed an IM from %s because it was sent too fast.", w);
break;
case 970:
snprintf(buf, sizeof(buf), "Failure.");
break;
case 971:
snprintf(buf, sizeof(buf), "Too many matches.");
break;
case 972:
snprintf(buf, sizeof(buf), "Need more qualifiers.");
break;
case 973:
snprintf(buf, sizeof(buf), "Dir service temporarily unavailable.");
break;
case 974:
snprintf(buf, sizeof(buf), "Email lookup restricted.");
break;
case 975:
snprintf(buf, sizeof(buf), "Keyword ignored.");
break;
case 976:
snprintf(buf, sizeof(buf), "No keywords.");
break;
case 977:
snprintf(buf, sizeof(buf), "User has no directory information.");
/* snprintf(buf, sizeof(buf), "Language not supported."); */
break;
case 978:
snprintf(buf, sizeof(buf), "Country not supported.");
break;
case 979:
snprintf(buf, sizeof(buf), "Failure unknown: %s.", w);
break;
case 980:
snprintf(buf, sizeof(buf), "Incorrect nickname or password.");
break;
case 981:
snprintf(buf, sizeof(buf), "The service is temporarily unavailable.");
break;
case 982:
snprintf(buf, sizeof(buf), "Your warning level is currently too high to log in.");
break;
case 983:
snprintf(buf, sizeof(buf), "You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.");
break;
case 989:
snprintf(buf, sizeof(buf), "An unknown signon error has occurred: %s.", w);
break;
default:
snprintf(buf, sizeof(buf), "An unknown error, %d, has occured. Info: %s", no, w);
}
toc_msg_printf(TOC_TRANSLATED_ERROR,buf);
return;
}
-279
View File
@@ -1,279 +0,0 @@
#ifndef _TOC_H
#define _TOC_H
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include "ll.h"
/* TOC DEFS */
#define FLAPON "FLAPON\r\n\r\n"
#define MSG_LEN 2048
#define BUF_LEN MSG_LEN
#define MAX_OUTPUT_MSG_LEN 4096
#define BUF_LONG BUF_LEN * 2
#define LANGUAGE "english"
#define REVISION "gaim-libtoc:$Revision: 40 $"
#define ROAST "Tic/Toc"
#define TOC_HOST "toc.oscar.aol.com"
#define TOC_PORT 9898
#define AUTH_HOST "login.oscar.aol.com"
#define AUTH_PORT 5190
#define LAGOMETER_STR "123CHECKLAG456"
/* connection states */
#define STATE_OFFLINE 0
#define STATE_FLAPON 1
#define STATE_SIGNON_REQUEST 2
#define STATE_SIGNON_ACK 3
#define STATE_CONFIG 4
#define STATE_ONLINE 5
/* communication types */
#define TYPE_SIGNON 1
#define TYPE_DATA 2
#define TYPE_ERROR 3
#define TYPE_SIGNOFF 4
#define TYPE_KEEPALIVE 5
/* permit modes */
#define PERMIT_PERMITALL 1
#define PERMIT_DENYALL 2
#define PERMIT_PERMITSOME 3
#define PERMIT_DENYSOME 4
/* User Types */
#define UC_AOL 1
#define UC_ADMIN 2
#define UC_UNCONFIRMED 4
#define UC_NORMAL 8
#define UC_UNAVAILABLE 16
/* INTERFACE */
#define TOC_HANDLE 1
#define TOC_RAW_HANDLE 2
/* The following can be handlers in either normal or raw mode */
#define TOC_SIGN_ON 0
#define TOC_CONFIG 1
#define TOC_NICK 2
#define TOC_IM_IN 3
#define TOC_UPDATE_BUDDY 4
#define TOC_ERROR 5
#define TOC_EVILED 6
#define TOC_CHAT_JOIN 7
#define TOC_CHAT_IN 8
#define TOC_CHAT_UPDATE_BUDDY 9
#define TOC_CHAT_INVITE 10
#define TOC_CHAT_LEFT 11
#define TOC_GOTO_URL 12
#define TOC_DIR_STATUS 13
/* TEMP */
#define TOC_REINSTALL_TIMER 19
/* Special HANDLES -- can only be used in Normal mode */
#define TOC_SOCKFD 20
#define TOC_RM_SOCKFD 21
#define TOC_RECIEVED_IM TOC_IM_IN
#define TOC_BUDDY_LOGGED_ON 22
#define TOC_BUDDY_LOGGED_OFF 23
#define TOC_CONNECT_MSGS 24
#define TOC_TRANSLATED_ERROR 25
#define TOC_BUDDY_LEFT_CHAT 26
#define TOC_BUDDY_JOIN_CHAT 27
#define TOC_LAG_UPDATE 28
#define TOC_WENT_IDLE 29
#define TOC_DEBUG_LOG "/tmp/aim-bx.log"
/* structs */
struct sflap_hdr {
unsigned char ast;
unsigned char type;
unsigned short seqno;
unsigned short len;
};
struct signon {
unsigned int ver;
unsigned short tag;
unsigned short namelen;
char username[80];
};
struct buddy {
char name[80];
int present;
int log_timer;
int evil;
time_t signon;
time_t idle;
int uc;
};
struct group {
char name[80];
LL members;
};
struct buddy_chat {
LL in_room;
LL ignored;
int makesound;
int id;
int init_chat;
char name[80];
};
/* toc.c */
int toc_login(char *username, char *password);
int toc_signon(char *username, char *password);
int wait_reply(char *buffer, int buflen);
unsigned char *roast_password(char *pass);
char *print_header(void *hdr_v);
int toc_wait_signon();
char *toc_wait_config();
int sflap_send(char *buf, int olen, int type);
int toc_signoff();
void toc_close();
void toc_build_config(char *s, int len);
void parse_toc_buddy_list(char *);
void translate_toc_error_code(char *c);
extern int state;
/* extern int inpa; */
/* util.c */
void set_state(int i);
int escape_message(char *msg);
char *normalize(char *s);
void strdown(char *s);
int escape_text(char *msg);
void toc_debug_printf(char *fmt, ...);
void toc_msg_printf(int type, char *fmt, ...);
char *strip_html(char *text);
/* network.c */
unsigned int *get_address(char *hostname);
int connect_address(unsigned int addy, unsigned short port);
/* server.c */
void serv_finish_login();
void serv_add_buddy(char *name);
void serv_remove_buddy(char *name);
void serv_set_info(char *info);
void serv_get_info(char *name);
int serv_got_im(char *name, char *message, int away);
void serv_add_buddies(LL buddies);
void serv_send_im(char *name, char *message);
void serv_got_update(char *name, int loggedin, int evil, time_t signon, time_t idle, int type);
void serv_close();
void serv_save_config();
void serv_warn(char *name, int anon);
void serv_add_permit(char *);
void serv_add_deny(char *);
void serv_set_permit_deny();
void serv_got_joined_chat(int id, char *name);
void serv_got_chat_left(int id);
void serv_accept_chat(int);
void serv_join_chat(int, char *);
void serv_chat_invite(int, char *, char *);
void serv_chat_leave(int);
void serv_chat_whisper(int, char *, char *);
void serv_chat_send(int, char *);
void serv_chat_warn(int id, char *user, int anon);
void serv_get_dir(char *name);
void serv_set_dir(char *first, char *middle, char *last, char *maiden, char *city, char *state, char *country, char *email, int web);
void serv_dir_search(char *first, char *middle, char *last, char *maiden, char *city, char *state, char *country, char *email);
void serv_touch_idle();
void serv_set_idle(int time);
int check_idle();
void serv_set_away(char *message);
extern int idle_timer;
extern time_t login_time;
extern int is_idle;
extern int lag_ms;
extern int permdeny;
extern int my_evil;
extern int is_away;
extern int time_to_idle;
/* misc.c */
void save_prefs();
void misc_free_group(void *);
void misc_free_buddy_chat(void *);
void misc_free_invited_chats(void *);
extern char aim_host[512];
extern int aim_port;
extern char login_host[512];
extern int login_port;
extern char toc_addy[16];
extern char aim_username[80];
extern char aim_password[16];
extern char *quad_addr;
extern char debug_buff[1024];
extern char user_info[2048];
extern int registered;
extern char *USER_CLASSES[5];
extern char *PERMIT_MODES[4];
/* buddy.c */
struct buddy *add_buddy(char *group, char *buddy);
struct buddy *find_buddy(char *who);
struct group *add_group(char *group);
struct group *find_group(char *group);
int user_add_buddy(char *group,char *buddy);
int user_remove_buddy(char *buddy);
int remove_group(char *group, char *newgroup, int mode);
int add_permit(char *sn);
int remove_permit(char *sn);
int add_deny(char *sn);
int remove_deny(char *sn);
int buddy_chat_invite(char *chat, char *buddy, char *msg);
void buddy_chat_join(char *chan);
int buddy_chat_leave(char *chan);
struct buddy_chat *find_buddy_chat(char *chat);
struct buddy_chat *buddy_chat_getbyid(int id);
int buddy_chat_warn(char *chat, char *user, int anon);
extern LL groups;
extern LL permit; /* The list of people permitted */
extern LL deny; /* The list of people denied */
extern LL buddy_chats;
extern LL invited_chats;
/* inteface.c */
void init_toc();
void init_lists();
int install_handler(int type, int (*func)(int, char **));
int install_raw_handler(int type, int (*func)(int, char *));
int use_handler(int mode,int type, void *args);
extern int (*TOC_RAW_HANDLERS[30])(int, char *);
extern int (*TOC_HANDLERS[30])(int, char **);
/* EXTERNAL FUNCTIONS */
extern int toc_add_input_stream(int,int (*)(int));
extern int toc_remove_input_stream(int);
#endif // _TOC_H
-197
View File
@@ -1,197 +0,0 @@
/*
* gaim
*
* Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
/*
* Modified by Nadeem Riaz (nads@bleh.org)
*
* Slight changes to better incorporate into libtoc
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <sys/wait.h>
#include "toc.h"
void set_state(int i)
{
state = i;
}
int escape_text(char *msg)
{
char *c, *cpy;
int cnt=0;
/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
if (strlen(msg) > BUF_LEN) {
fprintf(stderr, "Warning: truncating message to 2048 bytes\n");
msg[2047]='\0';
}
cpy = strdup(msg);
c = cpy;
while(*c) {
switch(*c) {
case '{':
case '}':
case '\\':
case '"':
msg[cnt++]='\\';
/* Fall through */
default:
msg[cnt++]=*c;
}
c++;
}
msg[cnt]='\0';
free(cpy);
return cnt;
}
int escape_message(char *msg)
{
char *c, *cpy;
int cnt=0;
/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
if (strlen(msg) > BUF_LEN) {
toc_debug_printf("Warning: truncating message to 2048 bytes\n");
msg[2047]='\0';
}
cpy = strdup(msg);
c = cpy;
while(*c) {
switch(*c) {
case '$':
case '[':
case ']':
case '(':
case ')':
case '#':
msg[cnt++]='\\';
/* Fall through */
default:
msg[cnt++]=*c;
}
c++;
}
msg[cnt]='\0';
free(cpy);
return cnt;
}
char *normalize(char *s)
{
static char buf[BUF_LEN];
char *t, *u;
int x=0;
u = t = malloc(strlen(s) + 1);
strcpy(t, s);
strdown(t);
while(*t) {
if (*t != ' ') {
buf[x] = *t;
x++;
}
t++;
}
buf[x]='\0';
free(u);
return buf;
}
void strdown(char *s) {
while ( *s ) {
if ( *s >= 65 && *s <= 90)
*s += 32;
s++;
}
}
void toc_debug_printf(char *fmt, ...)
{
#ifdef DEBUG_LIB_TOC
FILE *fp;
char data[MAX_OUTPUT_MSG_LEN];
va_list ptr;
if ( ! (fp=fopen(TOC_DEBUG_LOG,"a")) ) {
perror("ERROR couldn't open debug log file!@$\n");
}
va_start(ptr, fmt);
vsnprintf(data, MAX_OUTPUT_MSG_LEN - 1 , fmt, ptr);
va_end(ptr);
fprintf(fp,"%s\n",data);
fflush(fp);
fclose(fp);
return;
#endif
}
void toc_msg_printf(int type, char *fmt, ...) {
char data[MAX_OUTPUT_MSG_LEN];
char *args[1];
va_list ptr;
va_start(ptr, fmt);
vsnprintf(data, MAX_OUTPUT_MSG_LEN - 1 , fmt, ptr);
va_end(ptr);
args[0] = data;
use_handler(TOC_HANDLE,type,args);
return;
}
char * strip_html(char * text)
{
int i, j;
int visible = 1;
char *text2 = malloc(strlen(text) + 1);
strcpy(text2, text);
for (i = 0, j = 0;text2[i]; i++)
{
if(text2[i]=='<')
{
visible = 0;
continue;
}
else if(text2[i]=='>')
{
visible = 1;
continue;
}
if(visible)
{
text2[j++] = text2[i];
}
}
text2[j] = '\0';
return text2;
}
-171
View File
@@ -1,171 +0,0 @@
/*
* AOL Instant Messanger Module for BitchX
*
* By Nadeem Riaz (nads@bleh.org)
*
* util.c
*
* utility/misc functions
*/
#include <irc.h>
#include <struct.h>
#include <hook.h>
#include <ircaux.h>
#include <output.h>
#include <lastlog.h>
#include <status.h>
#include <vars.h>
#include <window.h>
#include <module.h>
#include <modval.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include "toc.h"
#include "aim.h"
void statusprintf(char *fmt, ...)
{
char data[MAX_STATUS_MSG_LEN];
char *sfmt, *prompt;
va_list ptr;
/* Tack on prompt */
prompt = get_dllstring_var("aim_prompt");
sfmt = (char *) malloc(strlen(prompt) + strlen(fmt)+5);
strcpy(sfmt,prompt);
strcat(sfmt," ");
strcat(sfmt,fmt);
va_start(ptr, fmt);
vsnprintf(data, MAX_STATUS_MSG_LEN - 1 , sfmt, ptr);
va_end(ptr);
free(sfmt);
statusput(LOG_CRAP,data);
return;
}
void statusput(int log_type, char *buf) {
int lastlog_level;
lastlog_level = set_lastlog_msg_level(log_type);
if (get_dllint_var("aim_window") > 0)
if (!(target_window = get_window_by_name("AIM")))
target_window = current_window;
if (window_display && buf)
{
add_to_log(irclog_fp, 0, buf, 0);
add_to_screen(buf);
}
target_window = NULL;
set_lastlog_msg_level(lastlog_level);
return;
}
void msgprintf(char *fmt, ...)
{
char data[MAX_STATUS_MSG_LEN];
va_list ptr;
va_start(ptr, fmt);
vsnprintf(data, MAX_STATUS_MSG_LEN - 1 , fmt, ptr);
va_end(ptr);
statusput(LOG_CRAP,data);
return;
}
void debug_printf(char *fmt, ...)
{
#ifdef DEBUG_AIM
FILE *fp;
char data[MAX_OUTPUT_MSG_LEN];
va_list ptr;
if ( ! (fp=fopen(AIM_DEBUG_LOG,"a")) ) {
perror("ERROR couldn't open debug log file!@$\n");
}
va_start(ptr, fmt);
vsnprintf(data, MAX_OUTPUT_MSG_LEN - 1 , fmt, ptr);
va_end(ptr);
fprintf(fp,"%s\n",data);
fflush(fp);
fclose(fp);
return;
#endif
}
char *rm_space(char *s) {
char *rs;
int x,y;
rs = (char *) malloc(strlen(s) + 1);
x = y = 0;
for (x =0; x<strlen(s);x++) {
if ( s[x] != ' ' ) {
rs[y] = s[x];
y++;
}
}
rs[y] = '\0';
return rs;
}
/*
* Still dont like split args routines in bitchx (new_next_arg)
* It doesnt allow for args with "'s in them, next_arg doesnt allow
* for args with spaces !@$. Need a *real* split routne that can handle
* both (with escaping)
*/
/*
char **split_args(char *args,int max;) {
int x;
char *list[32];
int arg = 0;
int escape = 0;
int open_quote = 0;
for (x=0;x<strlen(args);x++) {
if ( args[x] == '\' ) {
if ( ! escape ) {
escape = 1;
continue;
}
} else ( ! escape && args[x] == '"' ) {
if ( open_quote ) {
push(@args,$warg);
$warg ="";
arg++;
$argbegin = $x+1;
open_quote = 0;
} else {
open_quote = 1;
}
continue;
} elsif ( ! $escape && ! $open_quote && substr($text,$x,1) eq " " ) {
if ( ! $space ) {
push(@args,$warg);
$warg ="";
$arg++;
$space = 1;
}
$argbegin = $x+1;
next;
}
if ( $space ) {
$argbegin = $x;
$space = 0;
} elsif ( $escape ) {
$escape = 0;
}
$warg .= substr($text,$x,1);
}
}
}
*/
+4 -4
View File
@@ -35,7 +35,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -172,7 +172,7 @@ distclean: clean
$(RM) *~ config.status config.cache config.log config.h Makefile
../dllinit.o:
$(CC) -DOS_$(OS) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -o ../dllinit.o -c ../dllinit.c
$(CC) -DOS_$(OS) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -o ../dllinit.o -c ../dllinit.c
amp$(SHLIB_SUFFIX): $(OBJ) ../dllinit.o
$(SHLIB_LD) -o amp$(SHLIB_SUFFIX) $(OBJ) ../dllinit.o
@@ -182,10 +182,10 @@ SOURCES = $(OBJECTS:%.o=$(srcdir)/%.c)
OS := $(shell uname -s)
.c.o:
$(CC) -DOS_$(OS) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $<
$(CC) -DOS_$(OS) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $<
depend:
gcc -MM $(CPPFLAGS) $(DEFS) $(CFLAGS) *.c > .depend
gcc -MM $(CPPFLAGS) $(CPPFLAGS) $(CFLAGS) *.c > .depend
install:
$(INSTALL) $(PLUGIN_NAME)$(SHLIB_SUFFIX) $(DESTDIR)$(PLUGINDIR)
+1 -1
View File
@@ -261,7 +261,7 @@ int j,k;
for (k=0;k<6;k++)
{
scalefac_l[0][ch][sfb]=getbits(slen[1]);
i+=slen[j];
i+=slen[1];
if (ch) is_max[sfb]=(1<<slen[1])-1;
sfb++;
}
+2
View File
@@ -12,6 +12,8 @@
#define HUFFMAN
#include "huffman.h"
#include <unistd.h>
static inline unsigned int viewbits(int n)
{
unsigned int pos,ret_value;
+4 -4
View File
@@ -77,7 +77,7 @@ int hsize,fs,mean_frame_size;
nbal=&t_nbal2;
sblimit=8;
break;
default : /*printf(" bit alloc info no gud ");*/
default : break;
}
break;
case 1 : switch (bitrate) /* 1 = 48 kHz */
@@ -98,7 +98,7 @@ int hsize,fs,mean_frame_size;
nbal=&t_nbal2;
sblimit=8;
break;
default : /*printf(" bit alloc info no gud ");*/
default : break;
}
break;
case 2 : switch (bitrate) /* 2 = 32 kHz */
@@ -122,10 +122,10 @@ int hsize,fs,mean_frame_size;
nbal=&t_nbal3;
sblimit=12;
break;
default : /*printf("bit alloc info not ok\n");*/
default : break;
}
break;
default : /*printf("sampling freq. not ok/n");*/
default : break;
} else {
bit_alloc_index=&t_allocMPG2;
nbal=&t_nbalMPG2;
+2
View File
@@ -11,6 +11,8 @@
#define POSITION
#include "position.h"
#include <string.h>
/* Returns the number of frames actually skipped, -1 on error.
*
* Values in header are not changed if retval!=nframes.
+1
View File
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include "audio.h"
+3 -3
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -160,10 +160,10 @@ Makefile: Makefile.in
&& ./config.status
arcfour.o: $(srcdir)/arcfour.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/arcfour.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/arcfour.c
md5.o: $(srcdir)/md5.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/md5.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/md5.c
arcfour$(SHLIB_SUFFIX): arcfour.o md5.o ../dllinit.o
$(SHLIB_LD) arcfour.o md5.o ../dllinit.o $(SHLIB_CFLAGS) -o arcfour$(SHLIB_SUFFIX)
+38 -58
View File
@@ -31,6 +31,8 @@
#define INIT_MODULE
#include "modval.h"
#define MODULE_NAME "arcfour"
typedef struct {
int sock;
char ukey[16];
@@ -61,7 +63,7 @@ static unsigned int typenum = 0;
static char *init_box(char *ukey, arckey *key)
{
MD5_CTX md5context;
char buf[256];
unsigned char buf[256];
int fd;
fd = open("/dev/urandom", O_RDONLY);
@@ -70,11 +72,7 @@ static char *init_box(char *ukey, arckey *key)
close(fd);
}
else
{
buf[(int)buf[69]] ^= getpid();
buf[(int)buf[226]] ^= getuid();
buf[(int)buf[119]] ^= getpid();
}
return NULL;
MD5Init(&md5context);
MD5Update(&md5context, buf, sizeof(buf));
@@ -87,17 +85,18 @@ static char *init_box(char *ukey, arckey *key)
return ukey;
}
static inline void arcfourInit(arckey *arc, char *userkey, unsigned short len)
static inline void arcfourInit(arckey *arc, void *userkey, unsigned short len)
{
register arcword *S = arc->state, x = 0, y = 0, pos = 0, tmp;
unsigned char *userkey_byte = userkey;
/* Seed the S-box linearly, then mix in the key while stiring briskly */
arc->i = arc->j = 0; /* Initialize i and j to 0 */
while((S[x] = --x)); /* Initialize S-box, backwards */
while(--x, (S[x] = x)); /* Initialize S-box, backwards */
/* Note: Some of these optimizations REQUIRE arcword to be 8-bit unsigned */
do { /* Spread user key into real key */
y += S[x] + userkey[pos]; /* Keys, shaken, not stirred */
y += S[x] + userkey_byte[pos]; /* Keys, shaken, not stirred */
tmp = S[x]; S[x] = S[y]; S[y] = tmp; /* Swap S[i] and S[j] */
if (++pos >= len) pos = 0; /* Repeat user key to fill array */
} while(++x); /* ++x is faster than x++ */
@@ -121,23 +120,13 @@ static inline char *arcfourCrypt(arckey *arc, char *data, int len)
int Arcfour_Init(IrcCommandDll **intp, Function_ptr *global_table)
{
initialize_module("arcfour");
memset(keyboxes, 0, sizeof(keyboxes));
/*
dcc_output_func = send_dcc_encrypt;
dcc_input_func = get_dcc_encrypt;
dcc_open_func = start_dcc_crypt;
dcc_close_func = end_dcc_crypt;
*/
typenum = add_dcc_bind("SCHAT", "schat", init_schat, start_dcc_crypt, get_dcc_encrypt, send_dcc_encrypt, end_dcc_crypt);
add_module_proc(DCC_PROC, "schat", "schat", "Secure DCC Chat", 0, 0, dcc_sdcc, NULL);
return 0;
}
static const struct dcc_ops schat_ops = { NULL, start_dcc_crypt, dcc_schat_input, send_dcc_encrypt, end_dcc_crypt };
int Arcfour_Cleanup(IrcCommandDll **intp)
{
/* remove_dcc_bind("SCHAT", typenum); */
return 1;
initialize_module(MODULE_NAME);
memset(keyboxes, 0, sizeof(keyboxes));
typenum = add_dcc_bind("ARC4CHAT", MODULE_NAME, &schat_ops);
add_module_proc(DCC_PROC, MODULE_NAME, "ARC4CHAT", "ArcFour DCC Chat", 0, 0, dcc_sdcc, NULL);
return 0;
}
static arclist *find_box(int sock)
@@ -172,15 +161,17 @@ static int send_dcc_encrypt (int type, int sock, char *buf, int len)
return -1;
}
static int get_dcc_encrypt (int type, int sock, char *buf, int parm, int len)
static int dcc_schat_input(int type, int sock, char *buf, int parm, int buf_size)
{
if (type == DCC_CHAT) {
if ((len = dgets(buf, sock, parm, BIG_BUFFER_SIZE, NULL)) > 0) {
buf[len-1] = '\0';
dcc_crypt(sock, buf, len);
if (buf[len])
buf[len] = '\0';
}
int len;
len = dgets(buf, sock, parm, buf_size - 1, NULL);
if (len > 0)
{
buf[len-1] = '\0';
dcc_crypt(sock, buf, len);
buf[len] = '\0';
}
return len;
}
@@ -190,8 +181,7 @@ static int get_dcc_encrypt (int type, int sock, char *buf, int parm, int len)
* an encrypted connection.
*/
static int start_dcc_crypt (int s, int type, unsigned long d_addr, int d_port)
static int start_dcc_crypt (int s, int type, unsigned long d_addr, unsigned short d_port)
{
arclist *tmpbox;
put_it("start_dcc_crypt");
@@ -202,14 +192,18 @@ static int start_dcc_crypt (int s, int type, unsigned long d_addr, int d_port)
memset(randkey, 0, sizeof(randkey));
memset(buf, 0, sizeof(buf));
tmpbox->outbox = (arckey *)new_malloc(sizeof(arckey));
init_box(randkey, tmpbox->outbox);
if (init_box(randkey, tmpbox->outbox) == NULL)
{
new_free(&tmpbox->outbox);
return -1;
}
snprintf(buf, BIG_BUFFER_SIZE, "SecureDCC %s\r\n%n", randkey, &len);
write(s, buf, len);
memset(buf, 0, sizeof(buf));
if ((len = dgets(buf, s, 1, BIG_BUFFER_SIZE, NULL)) > 0) {
if (!my_strnicmp("SecureDCC", buf, 9)) {
tmpbox->inbox = (arckey *)new_malloc(sizeof(arckey));
arcfourInit(tmpbox->inbox, next_arg(buf, &buf), 16);
arcfourInit(tmpbox->inbox, next_arg(buf, NULL), 16);
}
}
return 0;
@@ -217,7 +211,7 @@ static int start_dcc_crypt (int s, int type, unsigned long d_addr, int d_port)
return -1;
}
static int end_dcc_crypt (int s, unsigned long d_addr, int d_port)
static int end_dcc_crypt(int s, unsigned long d_addr, unsigned short d_port)
{
int i;
for(i = 0; i < 16; i++) {
@@ -231,11 +225,10 @@ static int end_dcc_crypt (int s, unsigned long d_addr, int d_port)
return -1;
}
static void start_dcc_chat(int s)
{
struct sockaddr_in remaddr;
int sra;
socklen_t sra;
int type;
int new_s = -1;
char *nick = NULL;
@@ -250,7 +243,10 @@ SocketList *sa;
new_s = accept(s, (struct sockaddr *) &remaddr, &sra);
type = flags & DCC_TYPES;
n = get_socketinfo(s);
if ((add_socketread(new_s, ntohs(remaddr.sin_port), flags, nick, get_dcc_encrypt, NULL)) < 0)
/* This uses the ordinary dcc_chat_socketread() function - it will call our
* input filter function dcc_schat_input(). */
if ((add_socketread(new_s, ntohs(remaddr.sin_port), flags, nick, dcc_chat_socketread, NULL)) < 0)
{
erase_dcc_info(s, 0, "%s", convert_output_format("$G %RDCC error: accept() failed. punt!!", NULL, NULL));
close_socketread(s);
@@ -278,8 +274,6 @@ SocketList *sa;
void dcc_sdcc (char *name, char *args)
{
char *p;
int tmp, i;
DCC_int *new_sdcc;
if (!my_stricmp(name, "schat") && (strlen(args) > 0)) {
if (*args == ' ')
new_next_arg(args, &args);
@@ -288,20 +282,6 @@ void dcc_sdcc (char *name, char *args)
if (p && *p)
*p = 0;
}
new_sdcc = dcc_create(args, "SCHAT", NULL, 0, 0, typenum, DCC_TWOCLIENTS, start_dcc_chat);
/* find_dcc_pending(new_sdcc->user, new_sdcc->filename, NULL, typenum, 1, -1); */
/* new_i = find_dcc_pending(nick, filename, NULL, type, 1, -1); */
tmp = sizeof(keyboxes)/sizeof(arclist *);
for (i = 0; i < tmp; i++)
if (!keyboxes[i])
/* keyboxes[i]->sock = new_i->sock */;
dcc_create(args, "ARC4CHAT", NULL, 0, 0, typenum, DCC_TWOCLIENTS, start_dcc_chat);
}
}
/* thanks to the new add_dcc_bind, we dont have to worry about any hooking... */
static int init_schat(char *type, char *nick, char *userhost, char *description, char *size, char *extra, unsigned long ip, unsigned int port)
{
/* new_sdcc = dcc_create(args, "SCHAT", NULL, 0, 0, typenum, DCC_TWOCLIENTS, start_dcc_chat); */
return 0;
}
+4 -5
View File
@@ -5,11 +5,10 @@ typedef struct {
} arckey;
/* Prototypes */
static inline void arcfourInit(arckey *, char *, unsigned short);
static inline void arcfourInit(arckey *, void *, unsigned short);
static inline char *arcfourCrypt(arckey *, char *, int);
static int send_dcc_encrypt (int, int, char *, int);
static int get_dcc_encrypt (int, int, char *, int, int);
static int start_dcc_crypt (int, int, unsigned long, int);
static int end_dcc_crypt (int, unsigned long, int);
static int init_schat(char *, char *, char *, char *, char *, char *, unsigned long, unsigned int);
static int dcc_schat_input (int, int, char *, int, int);
static int start_dcc_crypt (int, int, unsigned long, unsigned short);
static int end_dcc_crypt (int, unsigned long, unsigned short);
void dcc_sdcc (char *, char *);
+2 -1
View File
@@ -1,5 +1,6 @@
/* MD5 Message Digest algorithm */
#include <string.h>
#include "md5.h"
/* Prototypes */
@@ -216,7 +217,7 @@ static void Transform(UINT_32 *buf, UINT_32 *in)
buf[2] += c;
buf[3] += d;
memset((void *)in, 0, sizeof(in));
memset(in, 0, 16 * sizeof in[0]);
}
#if 0
+2 -2
View File
@@ -35,7 +35,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -163,7 +163,7 @@ Makefile: Makefile.in
&& ./config.status
autocycle.o: $(srcdir)/autocycle.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/autocycle.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/autocycle.c
autocycle$(SHLIB_SUFFIX): autocycle.o ../dllinit.o
$(SHLIB_LD) autocycle.o ../dllinit.o $(SHLIB_CFLAGS) -o autocycle$(SHLIB_SUFFIX)
+1 -1
View File
@@ -21,7 +21,7 @@
int auto_cycle(IrcCommandDll *interp, char *command, char *args, char *subargs)
{
char * channel = current_window->current_channel;
int netsplit = (int)next_arg(args, &args);
int netsplit = (next_arg(args, &args) != NULL);
int this_server = current_window->server;
ChannelList * chan = lookup_channel(channel, this_server, 0);
NickList * tmp = NULL;
+2 -2
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -160,7 +160,7 @@ Makefile: Makefile.in
&& ./config.status
blowfish.o: $(srcdir)/blowfish.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/blowfish.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/blowfish.c
blowfish$(SHLIB_SUFFIX): blowfish.o ../dllinit.o
$(SHLIB_LD) blowfish.o ../dllinit.o $(SHLIB_CFLAGS) -o blowfish$(SHLIB_SUFFIX) $(TCL_LIBS)
+2 -2
View File
@@ -101,7 +101,7 @@ static void blowfish_decipher (UWORD_32bits * xl, UWORD_32bits * xr)
*xr = Xl.word;
}
static void blowfish_init (UBYTE_08bits * key, short keybytes)
static void blowfish_init (const char *key, short keybytes)
{
int i, j, bx;
time_t lowest;
@@ -115,7 +115,7 @@ static void blowfish_init (UBYTE_08bits * key, short keybytes)
if (blowbox[i].P != NULL)
{
if ((blowbox[i].keybytes == keybytes) &&
(strncmp((char *) (blowbox[i].key), (char *) key, keybytes) == 0))
(strncmp((char *) (blowbox[i].key), key, keybytes) == 0))
{
blowbox[i].lastuse = now;
bf_P = blowbox[i].P;
+1 -10
View File
@@ -11,19 +11,12 @@
#include "output.h"
#include "module.h"
#include "hash2.h"
#include "tcl_bx.h"
#include <sys/time.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef WANT_TCL
# include <tcl.h>
# include "tcl_bx.h"
#ifndef STDVAR
# define STDVAR (ClientData cd, Tcl_Interp *irp, int argc, char *argv[])
#endif
#ifndef BADARGS
#define BADARGS(nl,nh,example) \
if ((argc<(nl)) || (argc>(nh))) { \
@@ -33,8 +26,6 @@
}
#endif /* BADARGS */
#endif /* WANT_TCL */
#define INIT_MODULE
#include "modval.h"
+2 -2
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -160,7 +160,7 @@ Makefile: Makefile.in
&& ./config.status
cavlink.o: $(srcdir)/cavlink.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/cavlink.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/cavlink.c
cavlink$(SHLIB_SUFFIX): cavlink.o ../dllinit.o
$(SHLIB_LD) cavlink.o ../dllinit.o ${SHLIB_CFLAGS} -o cavlink$(SHLIB_SUFFIX)
+53 -42
View File
@@ -130,7 +130,7 @@ int sucks = 0;
set_dllint_var("cavlink_port", sucks);
}
else
cav_say("No %s specified", !host?"host":!passwd?"passwd":"arrggh");
cav_say("No %s specified", !host?"host":"passwd");
}
BUILT_IN_DLL(cmode)
@@ -158,9 +158,9 @@ char buffer[BIG_BUFFER_SIZE];
BUILT_IN_DLL(cattack)
{
char *tmp, *times = "6", *target = NULL, *q;
char *comm = NULL;
char *type[] = { "dcc_bomb", "version_flood", "ping_flood", "message_flood", "quote_flood", "cycle_flood", "nick_flood", "echo_flood", NULL};
char *times = "6", *target = NULL, *q;
const char *comm = NULL;
static const char * const type[] = { "dcc_bomb", "version_flood", "ping_flood", "message_flood", "quote_flood", "cycle_flood", "nick_flood", "echo_flood", NULL};
if (!check_cavlink(cavhub, NULL, 1))
return;
if (!my_stricmp(command, "CATTACK"))
@@ -201,7 +201,7 @@ char *type[] = { "dcc_bomb", "version_flood", "ping_flood", "message_flood", "qu
{
if (!my_strnicmp(args, "-t", 2))
{
tmp = next_arg(args, &args);
next_arg(args, &args);
times = next_arg(args, &args);
if (times && !isdigit(*times))
times = "6";
@@ -218,7 +218,7 @@ char *type[] = { "dcc_bomb", "version_flood", "ping_flood", "message_flood", "qu
{
if (!my_strnicmp(args, "-t", 2))
{
tmp = next_arg(args, &args);
next_arg(args, &args);
times = next_arg(args, &args);
if (times && !isdigit(*times))
times = "6";
@@ -318,9 +318,9 @@ BUILT_IN_DLL(cavgen)
{
char *nick = next_arg(args, &args);
if (nick)
sprintf(buffer, "msg %s PING %ld\n", nick, time(NULL));
sprintf(buffer, "msg %s PING %ld\n", nick, (long)time(NULL));
else
sprintf(buffer, "say PING %ld\n", time(NULL));
sprintf(buffer, "say PING %ld\n", (long)time(NULL));
}
else if (!my_stricmp(command, "CVERSION"))
sprintf(buffer, "version\n");
@@ -399,7 +399,7 @@ char *channel;
if (server == -1)
return 1;
chan = get_server_channels(server);
if (!chan || !(chan = (ChannelList *)find_in_list((List **)chan, channel, 0)))
if (!chan || !find_in_list((List **)chan, channel, 0))
{
my_send_to_server(server, "JOIN %s%s%s\n", channel, key?" ":empty_string, key?key:empty_string);
joined = 1;
@@ -439,7 +439,7 @@ int i;
return 1;
}
static unsigned long randm (unsigned long l)
static unsigned long cav_randm (unsigned long l)
{
unsigned long t1, t2, t;
struct timeval tp1;
@@ -456,19 +456,27 @@ static unsigned long randm (unsigned long l)
int do_dccbomb(int server, char *target, int repcount)
{
char buffer[BIG_BUFFER_SIZE];
int i;
char *text = NULL;
char buffer[BIG_BUFFER_SIZE];
int i, j;
char text[100];
if (server == -1)
server = primary_server;
if (server == -1)
return 1;
text = alloca(100);
for (i = 0; i < repcount; i++)
{
snprintf(buffer, IRCD_BUFFER_SIZE, "%ld%ld%ld %ld%ld%ld %ld%ld%ld %ld%ld%ld", randm(time(NULL))+i, randm(time(NULL))+i, time(NULL)+i, randm(time(NULL))+i, randm(time(NULL))+i, time(NULL)+i, randm(time(NULL))+i, randm(time(NULL))+i, time(NULL)+i, randm(time(NULL))+i, randm(time(NULL))+i, time(NULL)+i);
for (i = 0; i < randm(80); i++)
text[i] = randm(255)+1;
snprintf(buffer, IRCD_BUFFER_SIZE,
"%ld%ld%ld %ld%ld%ld %ld%ld%ld %ld%ld%ld", cav_randm(time(NULL))+i,
cav_randm(time(NULL))+i, (long)(time(NULL)+i),
cav_randm(time(NULL))+i, cav_randm(time(NULL))+i,
(long)(time(NULL)+i), cav_randm(time(NULL))+i,
cav_randm(time(NULL))+i, (long)(time(NULL)+i),
cav_randm(time(NULL))+i, cav_randm(time(NULL))+i,
(long)(time(NULL)+i));
for (j = 0; j < cav_randm(80); j++)
text[j] = cav_randm(255)+1;
text[j] = 0;
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :DCC SEND %s 2293243493 8192 6978632", target, text);
my_send_to_server(server, buffer);
}
@@ -558,7 +566,7 @@ char buffer[BIG_BUFFER_SIZE+1];
else if (!my_stricmp(type, "version_flood") && get_dllint_var("cavlink_floodversion"))
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :VERSION", target);
else if (!my_stricmp(type, "ping_flood") && get_dllint_var("cavlink_floodping"))
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :PING %ld", target, time(NULL));
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :PING %ld", target, (long)time(NULL));
else if (!my_stricmp(type, "echo_flood") && get_dllint_var("cavlink_floodecho"))
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :ECHO %s", target, extra);
else if (!my_stricmp(type, "message_flood") && get_dllint_var("cavlink_floodmsg"))
@@ -822,9 +830,9 @@ void cav_away(SocketList *Client, char *nick)
NickTab *tmp;
if (get_server_away(from_server) && nick)
{
for (tmp = tabkey_array;tmp; tmp = tmp->next);
for (tmp = tabkey_array; tmp; tmp = tmp->next)
{
if (!tmp || (tmp->nick && !my_stricmp(tmp->nick, nick)))
if (tmp->nick && !my_stricmp(tmp->nick, nick))
return;
}
dcc_printf(Client->is_read, "msg %s AWAY %s\n", nick, get_server_away(from_server));
@@ -833,11 +841,10 @@ NickTab *tmp;
int handle_msg (SocketList *Client, char **ArgList)
{
char *to, *nick, *host, *str;
to = *(ArgList+1);
nick = *(ArgList+2);
host = *(ArgList+3);
str = *(ArgList+4);
char *nick, *host, *str;
nick = ArgList[2];
host = ArgList[3];
str = ArgList[4];
PasteArgs(ArgList, 4);
str = handle_ctcp(Client, nick, host, NULL, str);
if (!str || !*str)
@@ -854,7 +861,6 @@ static void cavlink_handler (int s)
int output = 1;
char *p = NULL;
char *TrueArgs[MAXCAVPARA+1] = { NULL };
int count = 0;
char **ArgList;
char *comm;
char tmpstr[BIG_BUFFER_SIZE+1];
@@ -949,7 +955,7 @@ switch(dgets(tmpstr, s, 0, BIG_BUFFER_SIZE, NULL))
return;
}
ArgList = TrueArgs;
count = BreakArgs(tmp, NULL, ArgList, 1);
BreakArgs(tmp, NULL, ArgList, 1);
if (!(comm = (*++ArgList)) || !*ArgList)
return; /* Empty line from server - ByeBye */
@@ -1105,7 +1111,7 @@ SocketList *cavlink_connect(char *host, u_short port)
set_lastlog_msg_level(lastlog_level);
return NULL;
}
bcopy(hp->h_addr, (char *)&address, sizeof(address));
memcpy(&address, hp->h_addr, sizeof(address));
}
cav_socket = connect_by_number(host, &port, SERVICE_CLIENT, PROTOCOL_TCP, 1);
if (cav_socket < 0)
@@ -1208,7 +1214,6 @@ BUILT_IN_DLL(cavhelp)
BUILT_IN_DLL(cavsave)
{
IrcVariableDll *newv = NULL;
FILE *outf = NULL;
char *expanded = NULL;
char buffer[BIG_BUFFER_SIZE+1];
@@ -1223,19 +1228,25 @@ char buffer[BIG_BUFFER_SIZE+1];
new_free(&expanded);
return;
}
for (newv = dll_variable; newv; newv = newv->next)
{
if (!my_strnicmp(newv->name, "cavlink", 7))
{
if (newv->type == STR_TYPE_VAR)
{
if (newv->string)
fprintf(outf, "SET %s %s\n", newv->name, newv->string);
}
else
fprintf(outf, "SET %s %d\n", newv->name, newv->integer);
}
}
save_dllvar(outf, "cavlink_pass");
save_dllvar(outf, "cavlink_prompt");
save_dllvar(outf, "cavlink_window");
save_dllvar(outf, "cavlink");
save_dllvar(outf, "cavlink_floodspawn");
save_dllvar(outf, "cavlink_floodquote");
save_dllvar(outf, "cavlink_floodmsg");
save_dllvar(outf, "cavlink_floodnick");
save_dllvar(outf, "cavlink_floodversion");
save_dllvar(outf, "cavlink_floodping");
save_dllvar(outf, "cavlink_flooddccbomb");
save_dllvar(outf, "cavlink_floodcycle");
save_dllvar(outf, "cavlink_floodecho");
save_dllvar(outf, "cavlink_host");
save_dllvar(outf, "cavlink_port");
save_dllvar(outf, "cavlink_attack");
save_dllvar(outf, "cavlink_attack_times");
cav_say("Finished saving cavlink variables to %s", buffer);
fclose(outf);
new_free(&expanded);
+2 -2
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -160,7 +160,7 @@ Makefile: Makefile.in
&& ./config.status
cdrom.o: $(srcdir)/cdrom.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/cdrom.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/cdrom.c
cdrom$(SHLIB_SUFFIX): cdrom.o ../dllinit.o
$(SHLIB_LD) cdrom.o ../dllinit.o ${SHLIB_CFLAGS} -o cdrom$(SHLIB_SUFFIX)
+2 -2
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -160,7 +160,7 @@ Makefile: Makefile.in
&& ./config.status
encrypt.o: $(srcdir)/encrypt.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/encrypt.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/encrypt.c
encrypt$(SHLIB_SUFFIX): encrypt.o ../dllinit.o
$(SHLIB_LD) encrypt.o ../dllinit.o ${SHLIB_CFLAGS} -o encrypt$(SHLIB_SUFFIX)
+10 -9
View File
@@ -17,7 +17,7 @@
#define cparse convert_output_format
char encode_version[] = "Encode 0.001";
unsigned char *encode_string = NULL;
unsigned char encode_string[256];
BUILT_IN_FUNCTION(func_encode)
{
@@ -25,7 +25,7 @@ char *new;
if (!input)
return m_strdup(empty_string);
new = m_strdup(input);
my_encrypt(new, strlen(new), encode_string);
my_encrypt(new, strlen(new), (char *)encode_string);
return new;
}
@@ -35,7 +35,7 @@ char *new;
if (!input)
return m_strdup(empty_string);
new = m_strdup(input);
my_decrypt(new, strlen(new), encode_string);
my_decrypt(new, strlen(new), (char *)encode_string);
return new;
}
@@ -47,24 +47,25 @@ char *Encode_Version(IrcCommandDll **intp)
int Encrypt_Init(IrcCommandDll **intp, Function_ptr *global_table)
{
int i, j;
char buffer[BIG_BUFFER_SIZE+1];
int i;
char buffer[BIG_BUFFER_SIZE+1];
initialize_module("encrypt");
add_module_proc(ALIAS_PROC, "encrypt", "MENCODE", NULL, 0, 0, func_encode, NULL);
add_module_proc(ALIAS_PROC, "encrypt", "MDECODE", NULL, 0, 0, func_decode, NULL);
encode_string = (char *)new_malloc(512);
for (i = 1, j = 255; i <= 255; i++, j--)
for (i = 1; i <= 255; i++)
{
switch (i)
{
case 27:
case 127:
case 255:
encode_string[i-1] = i;
encode_string[i - 1] = i;
break;
default:
encode_string[i-1] = j;
encode_string[i - 1] = 256 - i;
break;
}
}
+2 -2
View File
@@ -35,7 +35,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -165,7 +165,7 @@ Makefile: Makefile.in
&& ./config.status
europa.o: $(srcdir)/europa.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/europa.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/europa.c
europa$(SHLIB_SUFFIX): europa.o ../dllinit.o
$(SHLIB_LD) europa.o ../dllinit.o $(SHLIB_CFLAGS) -o europa$(SHLIB_SUFFIX) $(MYSQL_LIBS)
+1 -1
View File
@@ -357,7 +357,7 @@ int Europa_Init(IrcCommandDll **intp, Function_ptr *global_table) {
put_it("** Europa v%s connecting to database backend...", MOD_VERSION);
/* connect to the database server */
if(!(mysql_real_connect(&mysql, DBHOST, DBUSER, DBPASSWD, NULL, 0, NULL, 0))) {
if(!(mysql_connect(&mysql, DBHOST, DBUSER, DBPASSWD))) {
put_it("** Server refused login/password.");
return 0;
}
+2 -2
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -160,7 +160,7 @@ Makefile: Makefile.in
&& ./config.status
fserv.o: $(srcdir)/fserv.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/fserv.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/fserv.c
fserv$(SHLIB_SUFFIX): fserv.o ../dllinit.o
$(SHLIB_LD) fserv.o ../dllinit.o $(SHLIB_CFLAGS) -o fserv$(SHLIB_SUFFIX)
+60 -44
View File
@@ -191,7 +191,7 @@ char *make_mp3_string(FILE *fp, Files *f, char *fs, char *dirbuff)
*s++ = *fs;
break;
case 'b':
sprintf(s, "%*u", prec, f->bitrate);
sprintf(s, "%*d", prec, f->bitrate);
break;
case 's':
if (!prec) prec = 3;
@@ -216,7 +216,7 @@ char *make_mp3_string(FILE *fp, Files *f, char *fs, char *dirbuff)
sprintf(s, "%*.*f", prec, fl, ((double)f->freq) / ((double)1000.0));
break;
case 'h':
sprintf(s, "%*u", prec, f->freq);
sprintf(s, "%*d", prec, f->freq);
break;
default:
*s++ = *fs;
@@ -244,7 +244,7 @@ char *make_mp3_string(FILE *fp, Files *f, char *fs, char *dirbuff)
fs++;
}
if (fp && *buffer)
fprintf(fp, buffer);
fputs(buffer, fp);
return buffer;
}
@@ -293,10 +293,9 @@ char *fs = NULL;
*dir = 0;
for (new = fserv_files; new; new = new->next)
{
if (!pattern || (pattern && wild_match(pattern, new->filename)))
if (!pattern || wild_match(pattern, new->filename))
{
char *p;
p = LOCAL_COPY(new->filename);
p = strrchr(new->filename, '/');
p++;
if (do_hook(MODULE_LIST, "FS: File \"%s\" %s %u %lu %lu %u", p, mode_str(new->stereo), new->bitrate, new->time, new->filesize, new->freq))
@@ -459,7 +458,7 @@ int gethdr(int file, AUDIO_HEADER *header)
return 0;
}
long get_bitrate(char *filename, time_t *mp3_time, unsigned int *freq_rate, int *id3, unsigned long *filesize, int *stereo)
long get_bitrate(char *filename, time_t *mp3_time, int *freq_rate, int *id3, unsigned long *filesize, int *stereo)
{
short t_bitrate[2][3][15] = {{
{0,32,48,56,64,80,96,112,128,144,160,176,192,224,256},
@@ -721,44 +720,60 @@ Files *search_list(char *nick, char *pat, int wild)
return NULL;
}
char *make_temp_list(char *nick)
{
char *nam;
char *real_nam;
FILE *fp;
if (!(nam = get_dllstring_var("fserv_filename")) || !*nam)
nam = tmpnam(NULL);
real_nam = expand_twiddle(nam);
if (!fserv_files || !real_nam || !*real_nam)
{
new_free(&real_nam);
Files *file;
FILE *fp;
const time_t when = now;
int count;
char *fmt, *name;
char buf[BIG_BUFFER_SIZE + 1];
if (fserv_files == NULL)
return NULL;
}
if ((fp = fopen(real_nam, "w")))
name = get_dllstring_var("fserv_filename");
if (name != NULL && *name != '\0')
{
char buffer2[BIG_BUFFER_SIZE+1];
char *fs;
int count = 0;
time_t t = now;
Files *new;
strftime(buffer2, 200, "%X %d/%m/%Y", localtime(&t));
for (new = fserv_files; new; new = new->next)
count++;
fprintf(fp, "Temporary mp3 list created for %s by %s on %s with %d mp3's\n\n", nick, get_server_nickname(from_server), buffer2, count);
*buffer2 = 0;
if (!(fs = get_dllstring_var("fserv_format")) || !*fs)
fs = " %6.3s %3b [%t]\t %f\n";
for (new = fserv_files; new; new = new->next)
make_mp3_string(fp, new, fs, buffer2);
fclose(fp);
new_free(&real_nam);
return nam;
char *real_name = expand_twiddle(name);
if (real_name == NULL || *real_name == '\0')
return NULL;
fp = fopen(real_name, "w");
new_free(&real_name);
if (fp == NULL)
return NULL;
}
new_free(&real_nam);
return NULL;
else
{
int fd;
static char template[sizeof("fserv_XXXXXX")];
name = strcpy(template, "fserv_XXXXXX");
fd = mkstemp(template);
if (fd == -1)
return NULL;
fp = fdopen(fd, "w");
if (fp == NULL)
{
close(fd);
return NULL;
}
}
for (count = 0, file = fserv_files; file != NULL; file = file->next)
count++;
strftime(buf, sizeof(buf), "%X %d/%m/%Y", localtime(&when));
fprintf(fp, "Temporary mp3 list created for %s by %s on %s with %d mp3's\n\n",
nick, get_server_nickname(from_server), buf, count);
fmt = get_dllstring_var("fserv_format");
if (fmt == NULL || *fmt == '\0')
fmt = " %6.3s %3b [%t]\t %f\n";
for (*buf = '\0', file = fserv_files; file != NULL; file = file->next)
make_mp3_string(fp, file, fmt, buf);
fclose(fp);
return name;
}
BUILT_IN_DLL(list_fserv)
@@ -911,7 +926,7 @@ int search_proc(char *which, char *str, char **unused)
return 1;
}
void impress_me(void *args)
int impress_me(void *args, char *sub)
{
int timer;
char *ch = NULL;
@@ -979,6 +994,7 @@ void impress_me(void *args)
}
add_timer(0, empty_string, timer * 1000, 1, impress_me, NULL, NULL, -1, "fserv");
new_free(&ch);
return 0;
}
BUILT_IN_FUNCTION(func_convert_mp3time)
@@ -1028,13 +1044,13 @@ char *fserv_savname = NULL;
fprintf(fp, "%s%s %s\n", bogus, "_filename", p);
if ((p = get_dllstring_var("fserv_format")))
fprintf(fp, "%s%s %s\n", bogus, "_format", p);
fprintf(fp, "%s%s %u\n", bogus, "_time", get_dllint_var("fserv_time"));
fprintf(fp, "%s%s %u\n", bogus, "_max_match", get_dllint_var("fserv_max_match"));
fprintf(fp, "%s%s %d\n", bogus, "_time", get_dllint_var("fserv_time"));
fprintf(fp, "%s%s %d\n", bogus, "_max_match", get_dllint_var("fserv_max_match"));
fprintf(fp, "%s%s %s\n", bogus, "_impress", on_off(get_dllint_var("fserv_impress")));
if (statistics.files_served)
{
fprintf(fp, "%s%s %lu\n", bogus, "_totalserved", statistics.files_served);
fprintf(fp, "%s%s %lu\n", bogus, "_totalstart", statistics.starttime);
fprintf(fp, "%s%s %ld\n", bogus, "_totalstart", (long)statistics.starttime);
fprintf(fp, "%s%s %lu\n", bogus, "_totalsizeserved", statistics.filesize_served);
}
fclose(fp);
@@ -1163,7 +1179,7 @@ char buffer[BIG_BUFFER_SIZE+1];
add_completion_type("fsload", 3, FILE_COMPLETION);
add_timer(0, empty_string, get_dllint_var("fserv_time"), 1, impress_me, NULL, NULL, -1, "fserv");
strcpy(FSstr, cparse(FS, NULL, NULL));
strmcpy(FSstr, cparse(FS, NULL, NULL), sizeof(FSstr) - 1);
put_it("%s %s", FSstr, convert_output_format("$0 v$1 by panasync.", "%s %s", fserv_version, AUTO_VERSION));
sprintf(buffer, "$0+%s by panasync - $2 $3", fserv_version);
fset_string_var(FORMAT_VERSION_FSET, buffer);
+3 -3
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -160,7 +160,7 @@ Makefile: Makefile.in
&& ./config.status
hint.o: $(srcdir)/hint.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/hint.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/hint.c
hint$(SHLIB_SUFFIX): hint.o ../dllinit.o
$(SHLIB_LD) hint.o ../dllinit.o $(SHLIB_CFLAGS) -o hint$(SHLIB_SUFFIX)
@@ -173,4 +173,4 @@ distclean: clean
install:
$(INSTALL) $(PLUGIN_NAME)$(SHLIB_SUFFIX) $(DESTDIR)$(PLUGINDIR)
$(INSTALL) $(srcdir)/BitchX.hints $(DESTDIR)$(PLUGINDIR)/@HINT_FILE@
$(INSTALL_DATA) $(srcdir)/BitchX.hints $(DESTDIR)$(PLUGINDIR)/@HINT_FILE@
+2 -2
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -160,7 +160,7 @@ Makefile: Makefile.in
&& ./config.status
identd.o: $(srcdir)/identd.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/identd.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/identd.c
identd$(SHLIB_SUFFIX): identd.o ../dllinit.o
$(SHLIB_LD) identd.o ../dllinit.o $(SHLIB_CFLAGS) -o identd$(SHLIB_SUFFIX)
+1 -1
View File
@@ -49,7 +49,7 @@ unsigned int lport = 0, rport = 0;
void identd_handler(int s)
{
struct sockaddr_in remaddr;
int sra = sizeof(struct sockaddr_in);
socklen_t sra = sizeof(struct sockaddr_in);
int sock = -1;
#if 0
if (!(get_dllint_var("identd")) || !(get_dllstring_var("identd_user")))
+8 -8
View File
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
LIBS = @LIBS@
# Tcl library.
@@ -162,26 +162,26 @@ Makefile: Makefile.in
&& ./config.status
compat.o: $(top_srcdir)/source/compat.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) \
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) \
-c $(top_srcdir)/source/compat.c
nap.o: $(srcdir)/nap.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/nap.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/nap.c
napsend.o: $(srcdir)/napsend.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napsend.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napsend.c
nap_file.o: $(srcdir)/nap_file.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/nap_file.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/nap_file.c
napfunc.o: $(srcdir)/napfunc.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napfunc.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napfunc.c
napother.o: $(srcdir)/napother.c
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napother.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napother.c
md5.o: $(srcdir)/md5.c $(srcdir)/md5.h
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/md5.c
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/md5.c
nap$(SHLIB_SUFFIX): $(OBJS)
$(SHLIB_LD) $(OBJS) $(SHLIB_CFLAGS) -o nap$(SHLIB_SUFFIX)
+1 -1
View File
@@ -179,7 +179,7 @@ memset(p, 0, count - 8);
MD5Transform(ctx->buf, (uint32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(ctx));
memset(ctx, 0, sizeof *ctx);
/* In case it's sensitive */
}
+46 -39
View File
@@ -224,7 +224,7 @@ int connectbynumber(char *hostn, unsigned short *portnum, int service, int proto
if (service == SERVICE_SERVER)
{
int length;
socklen_t length;
#ifdef IP_PORTRANGE
int ports;
#endif
@@ -273,11 +273,9 @@ int connectbynumber(char *hostn, unsigned short *portnum, int service, int proto
/* Inet domain client */
else if (service == SERVICE_CLIENT)
{
struct sockaddr_foobar server;
struct sockaddr_foobar server = { 0 };
struct hostent *hp;
memset(&server, 0, sizeof(struct sockaddr_in));
if (isdigit(hostn[strlen(hostn)-1]))
inet_aton(hostn, (struct in_addr *)&server.sf_addr);
else
@@ -313,15 +311,15 @@ int connectbynumber(char *hostn, unsigned short *portnum, int service, int proto
return fd;
}
char *numeric_banner(int curr)
{
static char thing[4];
static char thing[4];
if (!get_dllint_var("napster_show_numeric"))
return (nap_ansi?nap_ansi:empty_string);
sprintf(thing, "%3.3u", curr);
return (thing);
return nap_ansi ? nap_ansi : empty_string;
snprintf(thing, sizeof thing, "%3.3d", curr);
return thing;
}
static void set_numeric_string(Window *win, char *value, int unused)
@@ -823,7 +821,7 @@ NAP_COMM(cmd_error)
nap_error = 11;
}
else
nap_say("%s", cparse("Recieved error for [$0] $1-.", "%d %s", cmd, args ? args : empty_string));
nap_say("%s", cparse("Received error for [$0] $1-.", "%d %s", cmd, args ? args : empty_string));
}
if (nap_error > 10)
{
@@ -836,7 +834,7 @@ NAP_COMM(cmd_error)
NAP_COMM(cmd_unknown)
{
if (do_hook(MODULE_LIST, "NAP UNKNOWN %s", args))
nap_say("%s", cparse("Recieved unknown [$0] $1-.", "%d %s", cmd, args));
nap_say("%s", cparse("Received unknown [$0] $1-.", "%d %s", cmd, args));
return 0;
}
@@ -1015,11 +1013,13 @@ char *chan;
if (!(chan = next_arg(args, &args)))
return 0;
ch = (ChannelStruct *)find_in_list((List **)&nchannels, chan, 0);
if (!ch)
return 0;
ch->injoin = 0;
if (do_hook(MODULE_LIST, "NAP ENDNAMES %s", chan))
{
if (ch)
name_print(ch->nicks, 0);
name_print(ch->nicks, 0);
}
malloc_strcpy(&nap_current_channel, chan);
return 0;
@@ -1129,7 +1129,7 @@ SocketList *naplink_connect(char *host, u_short port)
set_lastlog_msg_level(lastlog_level);
return NULL;
}
bcopy(hp->h_addr, (char *)&address, sizeof(address));
memcpy(&address, hp->h_addr, sizeof(address));
}
nap_socket = connectbynumber(host, &port, SERVICE_CLIENT, PROTOCOL_TCP, 0);
if (nap_socket < 0)
@@ -1233,7 +1233,7 @@ void naplink_getserver(char *host, u_short port, int create)
set_lastlog_msg_level(lastlog_level);
return;
}
bcopy(hp->h_addr, (char *)&address, sizeof(address));
memcpy(&address, hp->h_addr, sizeof(address));
}
nap_socket = connectbynumber(host, &port, SERVICE_CLIENT, PROTOCOL_TCP, 1);
if (nap_socket < 0)
@@ -1331,7 +1331,6 @@ BUILT_IN_DLL(naphelp)
BUILT_IN_DLL(napsave)
{
IrcVariableDll *newv = NULL;
FILE *outf = NULL;
char *expanded = NULL;
char buffer[NAP_BUFFER_SIZE+1];
@@ -1348,21 +1347,32 @@ char *p = NULL;
new_free(&expanded);
return;
}
for (newv = dll_variable; newv; newv = newv->next)
{
if (!my_strnicmp(newv->name, "napster", 7))
{
if (newv->type == STR_TYPE_VAR)
{
if (newv->string)
fprintf(outf, "SET %s %s\n", newv->name, newv->string);
}
else if (newv->type == BOOL_TYPE_VAR)
fprintf(outf, "SET %s %s\n", newv->name, on_off(newv->integer));
else
fprintf(outf, "SET %s %d\n", newv->name, newv->integer);
}
}
save_dllvar(outf, "napster_prompt");
save_dllvar(outf, "napster_window");
save_dllvar(outf, "napster_host");
save_dllvar(outf, "napster_user");
save_dllvar(outf, "napster_pass");
save_dllvar(outf, "napster_email");
save_dllvar(outf, "napster_port");
save_dllvar(outf, "napster_dataport");
save_dllvar(outf, "napster_speed");
save_dllvar(outf, "napster_max_results");
save_dllvar(outf, "napster_numeric");
save_dllvar(outf, "napster_download_dir");
save_dllvar(outf, "napster_names_nickcolor");
save_dllvar(outf, "napster_hotlist_online");
save_dllvar(outf, "napster_hotlist_offline");
save_dllvar(outf, "napster_show_numeric");
save_dllvar(outf, "napster_window_hidden");
save_dllvar(outf, "napster_resume_download");
save_dllvar(outf, "napster_send_limit");
save_dllvar(outf, "napster_names_columns");
save_dllvar(outf, "napster_share");
save_dllvar(outf, "napster_max_send_nick");
save_dllvar(outf, "napster_format");
save_dllvar(outf, "napster_dir");
for (new = nap_hotlist; new; new = new->next)
m_s3cat(&p, " ", new->nick);
if (p)
@@ -1593,17 +1603,14 @@ void print_file(FileStruct *f, int count)
NAP_COMM(cmd_fileinfo)
{
char *nick;
char *ip;
int port;
char *file;
char *checksum;
int speed;
nick = next_arg(args, &args);
ip = next_arg(args, &args);
next_arg(args, &args); /* nick, ignored */
next_arg(args, &args); /* ip, ignored */
port = my_atol(next_arg(args, &args));
file = new_next_arg(args, &args);
checksum = next_arg(args, &args);
next_arg(args, &args); /* checksum, ignored */
speed = my_atol(next_arg(args, &args));
nap_put("Number ³ Song ³ Speed");
nap_put("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");
@@ -1739,7 +1746,7 @@ char *type = NULL;
}
else if (strstr(cmd, "line"))
{
if (value < 0 || value > 10)
if (value > 10)
{
nap_say("%s", cparse("Allowed linespeed 0-10", NULL));
return;
+4 -5
View File
@@ -482,12 +482,11 @@ unsigned long nbytes = 0;
if (gf && gf->count)
{
int flags = O_WRONLY;
memset(&indata, 0, 200);
if ((rc = read(snum, &indata, gf->count)) != gf->count)
return;
if (!isdigit(*indata) || !*(indata+1) || !isdigit(*(indata+1)))
{
rc += read(snum, &indata[gf->count], sizeof(indata)-1);
rc += read(snum, &indata[gf->count], sizeof indata - gf->count);
indata[rc] = 0;
nap_say("Request from %s is %s", gf->nick, indata);
gf = find_in_getfile(&getfile_struct, 1, gf->nick, gf->checksum, gf->filename, -1, NAP_DOWNLOAD);
@@ -525,7 +524,8 @@ unsigned long nbytes = 0;
send_ncommand(CMDS_UPDATE_GET, NULL);
return;
}
if ((rc = ioctl(snum, FIONREAD, &nbytes) != -1))
rc = ioctl(snum, FIONREAD, &nbytes);
if (rc != -1)
{
if (nbytes)
{
@@ -739,7 +739,6 @@ gato242 3068149784 6699 "d:\mp3\Hackers_-_07_-_Orbital_-_Halcyon_&_On_&_On.mp3"
*/
unsigned short port;
int getfd = -1;
int speed;
char *nick, *file, *checksum, *ip, *dir = NULL;
char *realfile = NULL;
char indata[2*NAP_BUFFER_SIZE+1];
@@ -752,7 +751,7 @@ struct stat st;
port = my_atol(next_arg(args, &args));
file = new_next_arg(args, &args);
checksum = next_arg(args, &args);
speed = my_atol(args);
/* Last argument (speed) ignored */
if (!(gf = find_in_getfile(&getfile_struct, 1, nick, checksum, file, -1, NAP_DOWNLOAD)))
{
+1 -1
View File
@@ -108,7 +108,7 @@ BUILT_IN_FUNCTION(func_connected)
{
if (nap_socket > -1)
{
int len;
socklen_t len;
struct sockaddr_in name;
len = sizeof (name);
if (getpeername(nap_socket, (struct sockaddr *)&name, &len))
+49 -55
View File
@@ -65,7 +65,7 @@ char *mime_type[] = { "x-wav", "x-aiff", "x-midi", "x-mod", "x-mp3", /* 0-4 */
char *audio[] = {".wav", ".aiff", ".mid", ".mod", ".mp3", ""};
char *image[] = {".jpg", ".gif", ""};
char *video[] = {".mpg", ".dat", ""};
char *application[] = {".tar.gz" ".tar.Z", ".Z", ".gz", ".arc", ".bz2", ".zip", ""};
char *application[] = {".tar.gz", ".tar.Z", ".Z", ".gz", ".arc", ".bz2", ".zip", ""};
char *find_mime_type(char *fn)
{
@@ -259,7 +259,7 @@ char *make_mp3_string(FILE *fp, Files *f, char *fs, char *dirbuff)
*s++ = *fs;
break;
case 'b':
sprintf(s, "%*u", prec, f->bitrate);
sprintf(s, "%*d", prec, f->bitrate);
break;
case 's':
if (!prec) prec = 3;
@@ -287,7 +287,7 @@ char *make_mp3_string(FILE *fp, Files *f, char *fs, char *dirbuff)
sprintf(s, "%*.*f", prec, fl, ((double)f->freq) / ((double)1000.0));
break;
case 'h':
sprintf(s, "%*u", prec, f->freq);
sprintf(s, "%*d", prec, f->freq);
break;
default:
*s++ = *fs;
@@ -315,7 +315,7 @@ char *make_mp3_string(FILE *fp, Files *f, char *fs, char *dirbuff)
fs++;
}
if (fp && *buffer)
fprintf(fp, buffer);
fputs(buffer, fp);
return buffer;
}
@@ -364,7 +364,7 @@ char *fs = NULL;
*dir = 0;
for (new = fserv_files; new; new = new->next)
{
if (!pattern || (pattern && wild_match(pattern, new->filename)))
if (!pattern || wild_match(pattern, new->filename))
{
char *p;
p = base_name(new->filename);
@@ -605,17 +605,14 @@ double compute_tpf(AUDIO_HEADER *fr)
}
long get_bitrate(int fdes, time_t *mp3_time, unsigned int *freq_rate, unsigned long *filesize, int *stereo, long *id3, int *mime_type)
long get_bitrate(int fdes, time_t *mp3_time, int *freq_rate, unsigned long *filesize, int *stereo, long *id3, int *mime_type)
{
AUDIO_HEADER header = {0};
unsigned long btr = 0;
struct stat st;
unsigned long head;
unsigned char buf[1025];
unsigned char tmp[5];
unsigned long head;
unsigned char buf[1025];
unsigned char tmp[5];
if (freq_rate)
*freq_rate = 0;
@@ -627,15 +624,15 @@ unsigned char tmp[5];
memset(tmp, 0, sizeof(tmp));
read(fdes, tmp, 4);
if (!strcmp(tmp, "PK\003\004")) /* zip magic */
if (!memcmp(tmp, "PK\003\004", 4)) /* zip magic */
return 0;
if (!strcmp(tmp, "PE") || !strcmp(tmp, "MZ")) /* windows Exe magic */
if (!memcmp(tmp, "PE", 2) || !memcmp(tmp, "MZ", 2)) /* windows Exe magic */
return 0;
if (!strcmp(tmp, "\037\235")) /* gzip/compress */
if (!memcmp(tmp, "\037\235", 2)) /* gzip/compress */
return 0;
if (!strcmp(tmp, "\037\213") || !strcmp(tmp, "\037\036") || !strcmp(tmp, "BZh")) /* gzip/compress/bzip2 */
if (!memcmp(tmp, "\037\213", 2) || !memcmp(tmp, "\037\036", 2) || !memcmp(tmp, "BZh", 3)) /* gzip/compress/bzip2 */
return 0;
if (!strcmp(tmp, "\177ELF")) /* elf binary */
if (!memcmp(tmp, "\177ELF", 4)) /* elf binary */
return 0;
head = convert_to_header(tmp);
@@ -684,7 +681,7 @@ unsigned char tmp[5];
lseek(fdes, 0, SEEK_SET);
*id3 = 0;
rc = read(fdes, buff, 128);
if (!strncmp(buff, "ID3", 3))
if (rc == 128 && !strncmp(buff, "ID3", 3))
{
struct id3v2 {
char tag[3];
@@ -728,8 +725,6 @@ md5_state_t state;
char buffer[BIG_BUFFER_SIZE+1];
struct stat st;
unsigned long size = DEFAULT_MD5_SIZE;
int di = 0;
int rc;
#if !defined(WINNT) && !defined(__EMX__)
char *m;
@@ -753,7 +748,9 @@ int rc;
#if defined(WINNT) || defined(__EMX__)
while (size)
{
int rc;
unsigned char md5_buff[8 * NAP_BUFFER_SIZE+1];
rc = (size >= (8 * NAP_BUFFER_SIZE)) ? 8 * NAP_BUFFER_SIZE : size;
rc = read(r, md5_buff, rc);
md5_append(&state, (unsigned char *)md5_buff, rc);
@@ -771,11 +768,13 @@ int rc;
md5_finish(digest, &state);
munmap(m, size);
#endif
memset(buffer, 0, 200);
for (di = 0, rc = 0; di < 16; ++di, rc += 2)
snprintf(&buffer[rc], BIG_BUFFER_SIZE, "%02x", digest[di]);
strcat(buffer, "-");
strcat(buffer, ltoa(st.st_size));
snprintf(buffer, sizeof buffer,
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x-%ld",
digest[0], digest[1], digest[2], digest[3],
digest[4], digest[5], digest[6], digest[7],
digest[8], digest[9], digest[10], digest[11],
digest[12], digest[13], digest[14], digest[15],
(long)st.st_size);
}
return m_strdup(buffer);
}
@@ -862,8 +861,9 @@ unsigned int scan_mp3_dir(char *path, int recurse, int reload, int share, int se
count++;
if (share && (nap_socket != -1))
{
sprintf(buffer, "\"%s\" %s %lu %u %u %lu", new->filename,
new->checksum, new->filesize, new->bitrate, new->freq, new->time);
sprintf(buffer, "\"%s\" %s %lu %d %d %ld", new->filename,
new->checksum, new->filesize, new->bitrate, new->freq,
(long)new->time);
send_ncommand(CMDS_ADDFILE, convertnap_dos(buffer));
statistics.shared_files++;
statistics.shared_filesize += new->filesize;
@@ -971,9 +971,9 @@ Files *new;
{
for (new = fserv_files; new; new = new->next)
{
fprintf(fp, "\"%s\" %s %lu %u %u %lu\n",
fprintf(fp, "\"%s\" %s %lu %d %d %ld\n",
new->filename, new->checksum, new->filesize,
new->bitrate, new->freq, new->time);
new->bitrate, new->freq, (long)new->time);
count++;
}
fclose(fp);
@@ -1121,8 +1121,9 @@ Files *new;
if (new->freq && new->bitrate)
{
sprintf(buffer, "\"%s\" %s %lu %u %u %lu", name,
new->checksum, new->filesize, new->bitrate, new->freq, new->time);
sprintf(buffer, "\"%s\" %s %lu %d %d %ld", name,
new->checksum, new->filesize, new->bitrate, new->freq,
(long)new->time);
cmd = CMDS_ADDFILE;
}
else
@@ -1520,20 +1521,16 @@ SocketList *s;
void nap_firewall_start(int snum)
{
GetFile *gf;
unsigned char buffer[NAP_BUFFER_SIZE+1];
SocketList *s;
s = get_socket(snum);
GetFile *gf;
char buffer[NAP_BUFFER_SIZE+1];
SocketList *s = get_socket(snum);
if (!s || !(gf = (GetFile *)get_socketinfo(snum)))
return;
if ((read(snum, buffer, 4)) < 1)
return;
#if 0
sprintf(buffer, "%s \"%s\" %lu", gf->nick, gf->filename, gf->filesize);
write(snum, convertnap_dos(buffer), strlen(buffer));
#endif
if (*buffer && !strcmp(buffer, "SEND"))
if (!memcmp(buffer, "SEND", 4))
s->func_read = napfirewall_pos;
else
close_socketread(snum);
@@ -1541,15 +1538,14 @@ SocketList *s;
void napfile_read(int snum)
{
GetFile *gf;
unsigned char buffer[NAP_BUFFER_SIZE+1];
int rc;
SocketList *s;
s = get_socket(snum);
GetFile *gf;
int rc;
SocketList *s = get_socket(snum);
if (!(gf = (GetFile *)get_socketinfo(snum)))
{
unsigned char buff[2*NAP_BUFFER_SIZE+1];
unsigned char fbuff[2*NAP_BUFFER_SIZE+1];
char buff[2*NAP_BUFFER_SIZE+1];
char fbuff[2*NAP_BUFFER_SIZE+1];
char *nick, *filename, *args;
alarm(10);
@@ -1579,7 +1575,6 @@ SocketList *s;
|| !(gf = find_in_getfile(&napster_sendqueue, 0, nick, NULL, fbuff, -1, NAP_UPLOAD))
|| (gf->write == -1))
{
memset(buff, 0, 80);
if (!gf)
sprintf(buff, "0INVALID REQUEST");
else
@@ -1588,7 +1583,7 @@ SocketList *s;
if ((gf = find_in_getfile(&napster_sendqueue, 1, nick, NULL, fbuff, -1, NAP_UPLOAD)))
gf->socket = snum;
}
write(snum, buff, strlen(buffer));
write(snum, buff, strlen(buff));
nap_finished_file(snum, gf);
return;
}
@@ -1602,7 +1597,6 @@ SocketList *s;
gf->socket = snum;
lseek(gf->write, SEEK_SET, gf->resume);
set_socketinfo(snum, gf);
memset(buff, 0, 80);
sprintf(buff, "%lu", gf->filesize);
write(snum, buff, strlen(buff));
s->func_write = s->func_read;
@@ -1622,10 +1616,10 @@ SocketList *s;
void naplink_handleconnect(int snum)
{
unsigned char buff[2*NAP_BUFFER_SIZE+1];
SocketList *s;
int rc;
memset(buff, 0, sizeof(buff) - 1);
char buff[2*NAP_BUFFER_SIZE+1] = { 0 };
SocketList *s;
int rc;
switch ((rc = recv(snum, buff, 4, MSG_PEEK)))
{
@@ -1670,7 +1664,7 @@ int rc;
void naplink_handlelink(int snum)
{
struct sockaddr_in remaddr;
int sra = sizeof(struct sockaddr_in);
socklen_t sra = sizeof(struct sockaddr_in);
int sock = -1;
if ((sock = accept(snum, (struct sockaddr *) &remaddr, &sra)) > -1)
{
+2 -2
View File
@@ -258,7 +258,7 @@ enum nap_Commands {
CMDS_CHANGEDATA = 703,
CMDS_PING = 751, /* user */
CMDS_PONG = 752, /* <user> recieved from a ping*/
CMDS_PONG = 752, /* <user> received from a ping*/
/* <user> can also be used to send a pong */
/* 753 */
@@ -271,7 +271,7 @@ enum nap_Commands {
/* 821 822 823 826 827 */
CMDS_SENDME = 824,
CMDR_NICK = 825,
CMDS_NAME = 830, /* <channel> returns 825 with nick info, 830 is recieved on end of list */
CMDS_NAME = 830, /* <channel> returns 825 with nick info, 830 is received on end of list */
/* 831 */
+1 -1
View File
@@ -21,7 +21,7 @@
ghost@aladdin.com
*/
/*$Id: md5.c 3 2008-02-25 09:49:14Z keaston $ */
/*$Id$ */
/*
Independent implementation of MD5 (RFC 1321).
+1 -1
View File
@@ -21,7 +21,7 @@
ghost@aladdin.com
*/
/*$Id: md5.h 3 2008-02-25 09:49:14Z keaston $ */
/*$Id$ */
/*
Independent implementation of MD5 (RFC 1321).

Some files were not shown because too many files have changed in this diff Show More