Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eedd42880c | |||
| aa17f86952 | |||
| e80c9957c2 | |||
| bb51ffc7b2 | |||
| 50847e8fc0 | |||
| 6c7e32a97d | |||
| 580a613555 | |||
| 87b806a563 | |||
| d8c87c4ded | |||
| cb1f51c9d2 |
+5
-4
@@ -594,12 +594,13 @@ 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 kill file is used
|
||||
If no reason is given, a quote from the random kick file is used
|
||||
*hopefully in a latter version of BitchX*
|
||||
L
|
||||
See %YLEAVE%n
|
||||
LASTLOG
|
||||
%gUsage%n: %W/%nlastlog -file filename%G|%n-clear%G|%n-max #%G|%n
|
||||
-literal pat%G|%n-beep%G|%nlevel
|
||||
-liternal pat%G|%n-beep%G|%nlevel
|
||||
- Shows more than a few pages back
|
||||
LEAVE
|
||||
%gUsage%n: %W/%nleave %Y<%Bchannel%Y>%n
|
||||
@@ -794,10 +795,10 @@ RELCT
|
||||
- Changes the topic to the last CTCP command issued
|
||||
RELD
|
||||
%gUsage%n: %W/%nreld
|
||||
- Displays the last DCC msg received.
|
||||
- Displays the last DCC msg recieved.
|
||||
RELDT
|
||||
%gUsage%n: %W/%nreldt
|
||||
- Sets the topic to the last DCC message received.
|
||||
- Sets the topic to the last DCC message recieved.
|
||||
RELI
|
||||
%gUsage%n: %W/%nreli
|
||||
- Shows the last invite message received
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# You can populate this file for randomly-chosen /KILL reasons.
|
||||
# $0 is replaced by the target nick and $1 by your nick.
|
||||
+4
-2
@@ -10,7 +10,7 @@
|
||||
|
||||
${a} for president.
|
||||
|
||||
${a}: a modern client for an old world
|
||||
${a}: a modern client for a old world
|
||||
${a}: a new fragrance for men, by Calvin Klein
|
||||
${a}: anything else would be uncivilized
|
||||
${a}: better than a penis enlargement!
|
||||
@@ -25,12 +25,14 @@ ${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
|
||||
@@ -82,7 +84,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 ${((strftime(%Y)+3)/4)*4} Olympic Games
|
||||
${a}: the official IRC client of the 2004 Olympic Games
|
||||
${a}: the ONLY bug-free client
|
||||
${a}: the ONLY IRC client on Viagra!
|
||||
${a}: the ONLY three day cure!
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
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>
|
||||
@@ -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-2014 Kevin Easton et al.
|
||||
* Copyright 2008-2012 Kevin Easton et al.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,422 +1,18 @@
|
||||
[Changes 1.2.2]
|
||||
[Changes 1.2-final]
|
||||
* Fix ANSI color support in terminal emulators. (sbalneav, VICODAN)
|
||||
|
||||
* Remove duplicate global definitions to fix compiling with gcc 10.
|
||||
Reported by ixz. (caf)
|
||||
* Add SASL support (flashback, VICODAN)
|
||||
|
||||
* Remove queueing of wildcard CSETs and fix use-after-free with queued
|
||||
CSETs. (caf)
|
||||
* Update README and install files (VICODAN)
|
||||
|
||||
* Bump MAXPARA (maximum protocol message arguments) to 20 as per EPIC5. (caf)
|
||||
* Fix compilation on FreeBSD 10 (cpet)
|
||||
|
||||
* Correctly handle a last argument prefixed with : for any protocol message,
|
||||
for compatibility with inspircd. Reported by trn. (caf)
|
||||
* Fix compilation errors on cygwin (VICODAN, soreau)
|
||||
|
||||
* Fix SHOW_AWAY_ONCE so it shows away message if the nick has changed. (caf)
|
||||
[Changes 1.2c02]
|
||||
* Bump the version to 1.2c02 and remove the svn from the version
|
||||
|
||||
* Handle 301 numeric with missing message argument. Reported by trn. (caf)
|
||||
|
||||
* Display "Servers exhausted. Restarting." message at the right time. (caf)
|
||||
|
||||
* 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)
|
||||
[Changes 1.2c01]
|
||||
|
||||
* Messages sent to channels should use lastlog level PUBLIC, not MSG. (caf)
|
||||
|
||||
|
||||
@@ -1,44 +1,54 @@
|
||||
Installation Instructions for BitchX 1.2
|
||||
Installation Instructions for BitchX 1.2-Final
|
||||
|
||||
BitchX is known to compile on the following systems (maybe others as well):
|
||||
* FreeBSD 2.x and above
|
||||
* NetBSD 3 and above
|
||||
* OpenBSD 2 and above
|
||||
* BSDI 2.0, 2.1, 3.1, 4.0
|
||||
* FreeBSD 2.x, 3.x, 4.0 and above
|
||||
* NetBSD 3.x, 4.x
|
||||
* 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 (with Cygwin)
|
||||
* Windows 9x/2000/NT/XP/Vista/7 (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. 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/.
|
||||
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
|
||||
|
||||
Several script writers tend to hang in the #BitchX on EFNet to
|
||||
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
|
||||
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
|
||||
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, caf
|
||||
known bug in the client, please contact the appropriate people, panasync
|
||||
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 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.
|
||||
|
||||
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.
|
||||
|
||||
Compiling BitchX:
|
||||
|
||||
@@ -58,11 +68,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-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.
|
||||
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.
|
||||
|
||||
* 3) "include/config.h" may need tweaking if you intend to change the
|
||||
default server list. To change, locate "DEFAULT_SERVER" and remove the
|
||||
@@ -71,40 +81,52 @@ 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 (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.
|
||||
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.
|
||||
|
||||
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.
|
||||
* 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.
|
||||
|
||||
Users without superuser access will typically see a "permission denied"
|
||||
error here if they try to install to the default prefix.
|
||||
* 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.
|
||||
|
||||
Compile Problems:
|
||||
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.
|
||||
|
||||
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
|
||||
* 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.
|
||||
|
||||
--
|
||||
Last Updated:
|
||||
caf
|
||||
caf@bitchx.org
|
||||
January 7th, 2017
|
||||
Dan Mashal
|
||||
dan408@bitchx.ca
|
||||
|
||||
Previous authors:
|
||||
Rob Andrews <sin@bitchx.org>
|
||||
Rob Andrews aka sin 03/26/2004
|
||||
David Walluck
|
||||
BarK0de
|
||||
BlackJac
|
||||
|
||||
+34
-43
@@ -61,7 +61,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -92,7 +92,6 @@ 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@
|
||||
|
||||
@@ -181,14 +180,10 @@ MFLAGS = \
|
||||
|
||||
## Makefile starts here.
|
||||
|
||||
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.
|
||||
all: Makefile .config.h $(_VERSION_) @EXTRAS@ dll done
|
||||
|
||||
.config.h:
|
||||
touch $@
|
||||
@if test ! -f $(topdir)/.config.h ; then touch $(topdir)/.config.h; fi
|
||||
|
||||
install: all installbin installdll installscript installman installhelp \
|
||||
installtranslation reallydone
|
||||
@@ -197,40 +192,29 @@ installeverything: install
|
||||
|
||||
everything: all
|
||||
|
||||
source_all: .config.h
|
||||
@cd source && $(MAKE) all
|
||||
|
||||
$(_VERSION_): .config.h
|
||||
@cd source && $(MAKE) $(_VERSION_)
|
||||
cd source \
|
||||
&& $(MAKE) all
|
||||
|
||||
dll: .config.h
|
||||
@cd dll && $(MAKE) all
|
||||
dll/dummy:
|
||||
|
||||
installdll: $(srcdir)/Makefile dll/Makefile installdirs dll
|
||||
dll: .config.h Makefile dll/Makefile dll/dummy
|
||||
cd dll \
|
||||
&& $(MAKE) all
|
||||
|
||||
installdll: Makefile dll/Makefile installdirs dll
|
||||
cd dll \
|
||||
&& $(MAKE) 'DESTDIR=$(DESTDIR)' install
|
||||
|
||||
installdll_local: $(srcdir)/Makefile dll/Makefile
|
||||
installdll_local: Makefile dll/Makefile
|
||||
cd dll \
|
||||
&& $(MAKE) 'PLUGINDIR=$(local_dir)/.BitchX/plugins'
|
||||
|
||||
installhelp: installdirs
|
||||
cd $(top_srcdir)/bitchx-docs && \
|
||||
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
|
||||
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
|
||||
|
||||
installbin: installirc @INSTALL_EXTRAS@
|
||||
|
||||
@@ -242,7 +226,6 @@ 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
|
||||
@@ -253,19 +236,20 @@ 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:
|
||||
@cd source && $(MAKE) wserv$(EXEEXT)
|
||||
wserv: .config.h $(srcdir)/source/wserv.c $(srcdir)/source/term.c Makefile
|
||||
cd source \
|
||||
&& $(MAKE) wserv
|
||||
|
||||
scr-bx:
|
||||
@cd source && $(MAKE) scr-bx$(EXEEXT)
|
||||
scr-bx: .config.h $(srcdir)/source/scr-bx.c $(srcdir)/source/term.c Makefile
|
||||
cd source \
|
||||
&& $(MAKE) scr-bx
|
||||
|
||||
installwserv: installdirs wserv
|
||||
$(INSTALL) source/wserv$(EXEEXT) $(DESTDIR)$(INSTALL_WSERV)
|
||||
$(INSTALL) source/wserv $(DESTDIR)$(INSTALL_WSERV)
|
||||
|
||||
installscr-bx: installdirs scr-bx
|
||||
$(INSTALL) source/scr-bx$(EXEEXT) $(DESTDIR)$(INSTALL_SCRBX)
|
||||
$(INSTALL) source/scr-bx $(DESTDIR)$(INSTALL_SCRBX)
|
||||
|
||||
installscript: installdirs
|
||||
-@( \
|
||||
@@ -313,7 +297,7 @@ local_installdirs:
|
||||
|
||||
config: bxconf
|
||||
|
||||
bxconf: $(srcdir)/Makefile $(srcdir)/bx-conf/Makefile.in
|
||||
bxconf: Makefile $(srcdir)/bx-conf/Makefile.in
|
||||
cd bx-conf \
|
||||
&& $(MAKE) all
|
||||
$(topdir)/bxconfigure || :
|
||||
@@ -327,7 +311,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 configure.lineno
|
||||
-$(RM) config.status
|
||||
-$(RM) config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-$(RM) include/defs.h include/sig.inc
|
||||
-$(RM) *~ *.rej core *.orig .#*
|
||||
@@ -337,7 +321,8 @@ distclean: clean
|
||||
-$(RM) script/.#* macros/.#* translation/.#*
|
||||
-$(RM) doc/*~ doc/BitchX.bat *.spec
|
||||
-$(RM) Makefile
|
||||
-$(RM) .config.h
|
||||
-$(CP) $(top_srcdir)/doc/Makefile $(top_srcdir)/Makefile
|
||||
-$(CP) $(top_srcdir)/doc/Makefile Makefile
|
||||
|
||||
export: distclean
|
||||
$(top_srcdir)/autogen.sh || :
|
||||
@@ -398,12 +383,18 @@ $(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 all source_all dll $(_VERISON_) scr-bx wserv reallydone installdirs local_installdirs
|
||||
.PHONY: clean done 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.
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
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
@@ -0,0 +1,54 @@
|
||||
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
@@ -0,0 +1,119 @@
|
||||
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
|
||||
|
||||
======================================================================
|
||||
Vendored
-7
@@ -1344,13 +1344,6 @@ 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"
|
||||
|
||||
+2
-11
@@ -152,18 +152,9 @@ 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.
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -20,14 +20,24 @@ 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 from the official site:
|
||||
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.
|
||||
|
||||
http://www.bitchx.org/
|
||||
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.
|
||||
|
||||
A mailing list for all things related to BitchX exists. Send email to
|
||||
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.
|
||||
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 is completely safe: There are no hidden trap doors.
|
||||
We value your trust, and will not do anything to abuse it.
|
||||
|
||||
@@ -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 "/ehelp 2 whois".
|
||||
"/help whois", one must now use "/help 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 send it to
|
||||
bitchx-devel@lists.sourceforge.net. Your input here, might help someone else.
|
||||
here, please write a description of it and email it to
|
||||
edwards@bitchx.dimension6.com. Your input here, might help someone else.
|
||||
|
||||
++ If you have not yet read "/ehelp 7 new_user", please do so now. ++
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
|
||||
[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 ] [ ]
|
||||
+3
-5
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -158,15 +158,13 @@ PROGRAM = $(topdir)/bxconfigure
|
||||
|
||||
OBJS = ds_cell.o file_cpy.o
|
||||
|
||||
BXCONF_LIBS = -lcurses
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
|
||||
$(CC) $(DEFS) $(CFLAGS) -c $<
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
$(PROGRAM): $(OBJS)
|
||||
$(CC) -o $(PROGRAM) $(OBJS) $(BXCONF_LIBS)
|
||||
$(CC) -o $(PROGRAM) $(OBJS) $(LIBS)
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(PROGRAM) *~
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
+36
-47
@@ -195,6 +195,8 @@ 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 }
|
||||
};
|
||||
@@ -237,7 +239,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 received", "DEFAULT_SEND_CTCP_MSG", ON, BOOL_TYPE, NULL },
|
||||
{"Send ctcp msg", "Send notice when ctcp command recieved", "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 }
|
||||
};
|
||||
@@ -547,9 +549,10 @@ int clear_dlist (CELL *c)
|
||||
while (c->start != NULL ) {
|
||||
ptr = c->start;
|
||||
c->start = c->start->nextlistptr;
|
||||
free(ptr->datainfo.option);
|
||||
free(ptr->datainfo.help);
|
||||
free(ptr->datainfo.save);
|
||||
if (ptr->datainfo.option)
|
||||
free(ptr->datainfo.option);
|
||||
if (ptr->datainfo.help)
|
||||
free(ptr->datainfo.help);
|
||||
free(ptr);
|
||||
}
|
||||
c->end = NULL;
|
||||
@@ -567,22 +570,25 @@ 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, ' ', sizeof tmp - 1);
|
||||
if (c->ecol - 2 < sizeof tmp)
|
||||
tmp[c->ecol - 2] = 0;
|
||||
else
|
||||
tmp[sizeof tmp - 1] = 0;
|
||||
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);
|
||||
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)
|
||||
{
|
||||
snprintf(tmp, sizeof tmp, " %-75s ", c->current->datainfo.help);
|
||||
sprintf(tmp, " %-75s ", c->current->datainfo.help);
|
||||
mvwaddstr(c->window, c->max_rows - 3, c->scol, tmp);
|
||||
}
|
||||
else
|
||||
@@ -652,7 +658,7 @@ int File_Entry(CELL *c) {
|
||||
char *fDisplay (dlistptr *ptr)
|
||||
{
|
||||
static char p[100];
|
||||
snprintf(p, sizeof p, " %-36s ", (*ptr)->datainfo.option);
|
||||
sprintf(p, " %-36s ", (*ptr)->datainfo.option);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -665,8 +671,8 @@ int fredraw (CELL * c)
|
||||
dlistptr p = c->list_start;
|
||||
int i = 0;
|
||||
char buff[200];
|
||||
if (c->ecol >= c->scol)
|
||||
snprintf(buff, sizeof buff, "%*s", c->ecol - c->scol + 1, " ");
|
||||
if (c->ecol - c->scol)
|
||||
sprintf(buff, "%*s",c->ecol - c->scol + 1, " ");
|
||||
while (i <= c->erow - c->srow && p != NULL)
|
||||
{
|
||||
if (p == c->current) wattron(c->window,A_REVERSE);
|
||||
@@ -688,11 +694,9 @@ char *cDisplay (dlistptr *ptr)
|
||||
{
|
||||
static char p[100];
|
||||
if ((*ptr)->datainfo.type == BOOL_TYPE)
|
||||
snprintf(p, sizeof p, " %-28s %8s",
|
||||
(*ptr)->datainfo.option, (*ptr)->datainfo.integer? "On":"Off");
|
||||
sprintf(p, " %-28s %8s", (*ptr)->datainfo.option, (*ptr)->datainfo.integer? "On":"Off");
|
||||
else if ((*ptr)->datainfo.type == INT_TYPE)
|
||||
snprintf(p, sizeof p, " %-28s %8d",
|
||||
(*ptr)->datainfo.option, (*ptr)->datainfo.integer);
|
||||
sprintf(p, " %-28s %8d", (*ptr)->datainfo.option, (*ptr)->datainfo.integer);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -705,8 +709,8 @@ register int row = c->srow;
|
||||
dlistptr p = c->list_start;
|
||||
int i = 0;
|
||||
char buff[200];
|
||||
if (c->ecol >= c->scol)
|
||||
snprintf(buff, sizeof buff, "%*s",c->ecol - c->scol + 1, " ");
|
||||
if (c->ecol - c->scol)
|
||||
sprintf(buff, "%*s",c->ecol - c->scol + 1, " ");
|
||||
|
||||
while (i <= c->erow - c->srow && p != NULL)
|
||||
{
|
||||
@@ -1084,8 +1088,8 @@ char *eDisplay (dlistptr *ptr)
|
||||
{
|
||||
static char p[100];
|
||||
char str[40];
|
||||
snprintf(str, sizeof str, "%d", (*ptr)->datainfo.integer);
|
||||
snprintf(p, sizeof p, "%14s", str);
|
||||
sprintf(str, "%d", (*ptr)->datainfo.integer);
|
||||
sprintf(p, "%14s", str);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -1099,8 +1103,8 @@ dlistptr p = c->list_start;
|
||||
int i = 0;
|
||||
char buff[200];
|
||||
|
||||
if (c->ecol >= c->scol)
|
||||
snprintf(buff, sizeof buff, "%*s",c->ecol - c->scol + 1, " ");
|
||||
if (c->ecol - c->scol)
|
||||
sprintf(buff, "%*s",c->ecol - c->scol + 1, " ");
|
||||
|
||||
while (i <= c->erow - c->srow && p != NULL)
|
||||
{
|
||||
@@ -1119,14 +1123,9 @@ char buff[200];
|
||||
}
|
||||
|
||||
int Edit_Entry(CELL *c) {
|
||||
char tmp[200];
|
||||
int n_spaces = c->ecol - 2 - c->scol - 4;
|
||||
|
||||
char tmp[180];
|
||||
memset(tmp, ' ', sizeof(tmp)-1);
|
||||
if (n_spaces < sizeof tmp)
|
||||
tmp[n_spaces] = 0;
|
||||
else
|
||||
tmp[sizeof tmp - 1] = 0;
|
||||
tmp[c->ecol - 2 - c->scol - 4] = 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);
|
||||
@@ -1136,14 +1135,9 @@ int Edit_Entry(CELL *c) {
|
||||
|
||||
int edit_enter (CELL *c)
|
||||
{
|
||||
char tmp[200];
|
||||
int n_spaces = c->ecol - 2 - c->scol - 4;
|
||||
|
||||
char tmp[180];
|
||||
memset(tmp, ' ', sizeof(tmp)-1);
|
||||
if (n_spaces < sizeof tmp)
|
||||
tmp[n_spaces] = 0;
|
||||
else
|
||||
tmp[sizeof tmp - 1] = 0;
|
||||
tmp[c->ecol - 2 - c->scol - 4] = 0;
|
||||
if (c->current->datainfo.type == INT_TYPE)
|
||||
{
|
||||
c->redraw = TRUE;
|
||||
@@ -1199,14 +1193,9 @@ int end = 0;
|
||||
|
||||
int edit_exit(CELL *c)
|
||||
{
|
||||
char tmp[200];
|
||||
int n_spaces = c->ecol - 2 - c->scol - 4;
|
||||
|
||||
char tmp[180];
|
||||
memset(tmp, ' ', sizeof(tmp)-1);
|
||||
if (n_spaces < sizeof tmp)
|
||||
tmp[n_spaces] = 0;
|
||||
else
|
||||
tmp[sizeof tmp - 1] = 0;
|
||||
tmp[c->ecol - 2 - c->scol - 4] = 0;
|
||||
mvwaddstr (c->window, c->srow - 1 , c->scol, tmp);
|
||||
mvwaddstr (c->window, c->srow , c->scol, tmp);
|
||||
return TRUE;
|
||||
|
||||
+76
-49
@@ -3,17 +3,21 @@ 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"
|
||||
RELEASE_TAG="bitchx-1.2.1"
|
||||
RELEASE="1.2.1"
|
||||
VERSION_NUMBER="$RELEASE`"$srcdir/gitversion.sh" "$RELEASE_TAG" "$srcdir"`"
|
||||
VERSION="$_VERSION_-$VERSION_NUMBER"
|
||||
VERSION_NUMBER="`echo "$VERSION" | sed 's/BitchX-//'`"
|
||||
AC_DEFINE_UNQUOTED(VERSION_NUMBER, "$VERSION_NUMBER", Define BitchX version number here.)
|
||||
AC_SUBST(VERSION_NUMBER)
|
||||
echo Welcome to the "$VERSION" configuration
|
||||
@@ -56,7 +60,7 @@ AC_CHECK_LIB(m, pow, LIBS="-lm $LIBS",)
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_DIRENT
|
||||
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([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([net/if.h], [], [],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
@@ -83,6 +87,7 @@ 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
|
||||
@@ -100,19 +105,13 @@ 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 int is 32 bits.)
|
||||
AC_DEFINE(UNSIGNED_INT32, 1, Define this if an unsigned long 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 long is 32 bits.)
|
||||
AC_DEFINE(UNSIGNED_LONG32, 1, Define this if an unsigned int is 32 bits.)
|
||||
else
|
||||
AC_DEFINE(UNKNOWN_32INT, 1, Define this if you are unsure what is 32 bits.)
|
||||
fi
|
||||
@@ -170,7 +169,6 @@ 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>
|
||||
|
||||
@@ -197,7 +195,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 setenv)
|
||||
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)
|
||||
dnl Need these for Solaris
|
||||
AC_CHECK_FUNC(gethostbyname,,
|
||||
AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS",))
|
||||
@@ -567,7 +565,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
|
||||
|
||||
@@ -591,32 +589,62 @@ 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 EMXOS2 because
|
||||
dnl Check for setupterm/tgetent. *DO NOT* check on CYGWIN or EMXOS2 because
|
||||
dnl term support is built-in.
|
||||
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
|
||||
]])
|
||||
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.)
|
||||
fi
|
||||
|
||||
dnl Check for Tcl.
|
||||
@@ -978,7 +1006,7 @@ GZIP_ENV="--best"
|
||||
BZIP2="-9 --repetitive-best"
|
||||
|
||||
dnl Should I keep this or not?
|
||||
if test -n "$CYGWIN" -o -n "$EMXOS2" -o -n "$MINGWIN32"; then
|
||||
if test -n "$EMXOS2" -o -n "$MINGWIN32"; then
|
||||
bindir="\$(IRCLIB)"
|
||||
INSTALL_IRC="\$(IRCLIB)/\$(_VERSION_)\$(EXEEXT)"
|
||||
IRCLIB="\${prefix}/BitchX"
|
||||
@@ -994,7 +1022,6 @@ if test -n "$CYGWIN" -o -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"
|
||||
@@ -1015,7 +1042,6 @@ 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"
|
||||
@@ -1060,11 +1086,9 @@ 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 reasons file.)
|
||||
AC_DEFINE_UNQUOTED(DEFAULT_BITCHX_KICK_FILE, "$DEFAULT_BITCHX_KICK_FILE", Default BitchX kick file.)
|
||||
AC_SUBST(DEFAULT_BITCHX_KICK_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_DEFINE_UNQUOTED(DEFAULT_BITCHX_QUIT_FILE, "$DEFAULT_BITCHX_QUIT_FILE", Default BitchX quit 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)
|
||||
@@ -1076,9 +1100,12 @@ 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
|
||||
@@ -1104,7 +1131,7 @@ AC_CONFIG_COMMANDS([default],[[ echo timestamp > stamp-h
|
||||
AC_OUTPUT
|
||||
|
||||
echo
|
||||
echo BitchX \(c\) 1996-2015 Colten Edwards et al
|
||||
echo BitchX \(c\) 1996-2012 Colten Edwards et al
|
||||
echo ----------------------------------------------------------
|
||||
echo
|
||||
echo The configuration script has finished. You should look through
|
||||
|
||||
@@ -0,0 +1,504 @@
|
||||
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},
|
||||
Vendored
-11
@@ -1,11 +0,0 @@
|
||||
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
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
8
|
||||
Vendored
-15
@@ -1,15 +0,0 @@
|
||||
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.
|
||||
Vendored
-65
@@ -1,65 +0,0 @@
|
||||
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
@@ -1,13 +0,0 @@
|
||||
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
-19
@@ -1,19 +0,0 @@
|
||||
#!/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
|
||||
+6
-5
@@ -36,7 +36,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -155,13 +155,13 @@ MFLAGS = \
|
||||
|
||||
## Makefile starts here.
|
||||
|
||||
ALL_PLUGINS = abot acro amp arcfour autocycle blowfish cavlink cdrom encrypt europa fserv hint identd nap nicklist pkga possum qbx qmail wavplay xmms
|
||||
ALL_PLUGINS = abot acro aim amp arcfour autocycle blowfish cavlink cdrom encrypt europa fserv hint identd nap nicklist pkga possum qbx qmail wavplay xmms
|
||||
|
||||
#PLUGINS = abot acro arcfour autocycle blowfish cavlink encrypt europa fserv hint identd nap pkga possum qbx qmail wavplay
|
||||
#PLUGINS = abot acro aim arcfour autocycle blowfish cavlink encrypt europa fserv hint identd nap pkga possum qbx qmail wavplay
|
||||
PLUGINS = @PLUGINS@
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $<
|
||||
$(CC) $(DEFS) $(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) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/dllinit.c; \
|
||||
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/dllinit.c; \
|
||||
fi; \
|
||||
)
|
||||
|
||||
@@ -203,6 +203,7 @@ 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; \
|
||||
)
|
||||
|
||||
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -160,7 +160,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
autobot.o: $(srcdir)/autobot.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/autobot.c
|
||||
$(CC) $(DEFS) $(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)
|
||||
|
||||
@@ -198,12 +198,8 @@ 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;
|
||||
|
||||
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -160,7 +160,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
acro.o: $(srcdir)/acro.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/acro.c
|
||||
$(CC) $(DEFS) $(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)
|
||||
|
||||
+146
-110
@@ -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, "acro", "scores", NULL, 0, 0, put_scores, NULL);
|
||||
add_module_proc(COMMAND_PROC, "scores", "scores", NULL, 0, 0, put_scores, NULL);
|
||||
|
||||
read_scores();
|
||||
gscores = 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, warn_acro, m_sprintf("%s", args[0]), NULL, -1, "acro");
|
||||
add_timer(0, "Acro", 60 * 1000, 1, (int(*)(void *))warn_acro, m_sprintf("%s", args[0]), NULL, NULL, "acro");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -76,30 +76,25 @@ BUILT_IN_DLL(put_scores)
|
||||
*/
|
||||
}
|
||||
|
||||
int warn_acro(void *arg, char *subarg)
|
||||
void warn_acro(char *chan)
|
||||
{
|
||||
char *chan = arg;
|
||||
|
||||
send_to_server("PRIVMSG %s :30 seconds! Puzzle is: %s", chan, game->nym);
|
||||
add_timer(0, "Acro", 30 * 1000, 1, start_vote, m_sprintf("%s", chan), NULL, -1, "acro");
|
||||
return 0;
|
||||
add_timer(0, "Acro", 30 * 1000, 1, (int(*)(void *))start_vote, m_sprintf("%s", chan), NULL, NULL, "acro");
|
||||
}
|
||||
|
||||
int start_vote(void *arg, char *subarg)
|
||||
void start_vote(char *chan)
|
||||
{
|
||||
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, warn_vote, m_sprintf("%s", chan), NULL, -1, "acro");
|
||||
add_timer(0, "Acro", 30 * 1000, 1, (int(*)(void *))warn_vote, m_sprintf("%s", chan), NULL, NULL, "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, start_vote, m_sprintf("%s", chan), NULL, -1, "acro");
|
||||
add_timer(0, "Acro", 30 * 1000, 1, (int(*)(void *))start_vote, m_sprintf("%s", chan), NULL, NULL, "acro");
|
||||
game->extended++;
|
||||
}
|
||||
else
|
||||
@@ -109,22 +104,16 @@ int start_vote(void *arg, char *subarg)
|
||||
game->players = 0;
|
||||
game->progress = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int warn_vote(void *arg, char *subarg)
|
||||
void warn_vote(char *chan)
|
||||
{
|
||||
char *chan = arg;
|
||||
|
||||
send_to_server("PRIVMSG %s :30 seconds left to vote!", chan);
|
||||
add_timer(0, "Acro", 30 * 1000, 1, end_voting, m_sprintf("%s", chan), NULL, -1, "acro");
|
||||
return 0;
|
||||
add_timer(0, "Acro", 30 * 1000, 1, (int(*)(void *))end_voting, m_sprintf("%s", chan), NULL, NULL, "acro");
|
||||
}
|
||||
|
||||
int end_voting(void *arg, char *subarg)
|
||||
void end_voting(char *chan)
|
||||
{
|
||||
char *chan = arg;
|
||||
|
||||
put_it("END_VOTING");
|
||||
send_to_server("PRIVMSG %s :Voting complete, sorting scores...", chan);
|
||||
gscores = end_vote(voter, player, gscores);
|
||||
@@ -148,7 +137,7 @@ int end_voting(void *arg, char *subarg)
|
||||
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, warn_acro, m_sprintf("%s", chan), NULL, -1, "acro");
|
||||
add_timer(0, "Acro", 60 * 1000, 1, (int(*)(void *))warn_acro, m_sprintf("%s", chan), NULL, NULL, "acro");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -158,7 +147,6 @@ int end_voting(void *arg, char *subarg)
|
||||
new_free(&game->nym);
|
||||
init_acro(game);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
grec *init_acro(grec *gtmp)
|
||||
@@ -237,10 +225,13 @@ prec *take_acro(grec *acro, prec *players, char *nick, char *host, char *stuff)
|
||||
prec *tmp, *last = NULL;
|
||||
if (!players)
|
||||
{
|
||||
players = new_malloc(sizeof(prec));
|
||||
players->nick = m_strdup(nick);
|
||||
players->host = m_strdup(host);
|
||||
players->acro = m_strdup(stuff);
|
||||
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);
|
||||
send_to_server("PRIVMSG %s :Answer set to \"%s\"\r\nPRIVMSG %s :You are player #%d", nick, stuff, nick, ++acro->players);
|
||||
return players;
|
||||
}
|
||||
@@ -262,7 +253,8 @@ prec *take_acro(grec *acro, prec *players, char *nick, char *host, char *stuff)
|
||||
return players;
|
||||
}
|
||||
else {
|
||||
tmp->last = m_strdup(stuff);
|
||||
tmp->last = (char *)new_malloc(strlen(stuff)+1);
|
||||
strcpy(tmp->last, stuff);
|
||||
send_to_server("PRIVMSG %s :You already submitted an answer, submit once more to change.", nick);
|
||||
return players;
|
||||
}
|
||||
@@ -271,10 +263,13 @@ prec *take_acro(grec *acro, prec *players, char *nick, char *host, char *stuff)
|
||||
}
|
||||
if (acro->players < MAXPLAYERS && last)
|
||||
{
|
||||
tmp = last->next = new_malloc(sizeof(prec));
|
||||
tmp->nick = m_strdup(nick);
|
||||
tmp->host = m_strdup(host);
|
||||
tmp->acro = m_strdup(stuff);
|
||||
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);
|
||||
send_to_server("PRIVMSG %s :Answer set to \"%s\"\r\nPRIVMSG %s :You are player #%d", nick, stuff, nick, ++acro->players);
|
||||
}
|
||||
else
|
||||
@@ -300,10 +295,12 @@ vrec *take_vote(grec *acro, vrec *voters, prec *players, char *nick, char *host,
|
||||
}
|
||||
if (!voters)
|
||||
{
|
||||
voters = new_malloc(sizeof(vrec));
|
||||
voters->nick = m_strdup(nick);
|
||||
voters->host = m_strdup(host);
|
||||
voters = (vrec *)new_malloc(sizeof(vrec));
|
||||
voters->nick = (char *)new_malloc(strlen(nick)+1);
|
||||
voters->host = (char *)new_malloc(strlen(host)+1);
|
||||
voters->vote = atoi(num)-1;
|
||||
strcpy(voters->nick, nick);
|
||||
strcpy(voters->host, host);
|
||||
send_to_server("PRIVMSG %s :Vote recorded...", nick);
|
||||
return voters;
|
||||
}
|
||||
@@ -318,52 +315,68 @@ vrec *take_vote(grec *acro, vrec *voters, prec *players, char *nick, char *host,
|
||||
}
|
||||
if (last && !last->next)
|
||||
{
|
||||
last = last->next = new_malloc(sizeof(vrec));
|
||||
last->nick = m_strdup(nick);
|
||||
last->host = m_strdup(host);
|
||||
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->vote = atoi(num)-1;
|
||||
strcpy(last->nick, nick);
|
||||
strcpy(last->host, host);
|
||||
send_to_server("PRIVMSG %s :Vote recorded...", nick);
|
||||
}
|
||||
return voters;
|
||||
}
|
||||
|
||||
void read_scores(void)
|
||||
srec *read_scores()
|
||||
{
|
||||
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)
|
||||
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))
|
||||
{
|
||||
record = new_malloc(sizeof(srec));
|
||||
record->nick = m_strdup(nick);
|
||||
record->score = score;
|
||||
add_to_list((List **)&gscores, (List *)record);
|
||||
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;
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
fclose(sf);
|
||||
return tmp2;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -388,7 +401,7 @@ srec *end_vote(vrec *voters, prec *players, srec *stmp)
|
||||
prec *tmp2 = NULL;
|
||||
srec *tmp3 = NULL, *last;
|
||||
if (!stmp && voters && players)
|
||||
stmp = new_malloc(sizeof(srec));
|
||||
stmp = (srec *)new_malloc(sizeof(srec));
|
||||
for (tmp = voters; tmp; tmp = tmp->next)
|
||||
{
|
||||
gotscore = 0;
|
||||
@@ -397,7 +410,8 @@ srec *end_vote(vrec *voters, prec *players, srec *stmp)
|
||||
tmp2 = tmp2->next;
|
||||
if (stmp && !stmp->nick)
|
||||
{
|
||||
stmp->nick = m_strdup(tmp2->nick);
|
||||
stmp->nick = (char *)new_malloc(strlen(tmp2->nick)+1);
|
||||
strcpy(stmp->nick, tmp2->nick);
|
||||
stmp->score = 1;
|
||||
continue;
|
||||
}
|
||||
@@ -413,25 +427,49 @@ srec *end_vote(vrec *voters, prec *players, srec *stmp)
|
||||
}
|
||||
if (!gotscore)
|
||||
{
|
||||
tmp3 = last->next = new_malloc(sizeof(srec));
|
||||
tmp3->nick = m_strdup(tmp2->nick);
|
||||
tmp3 = last->next = (srec *)new_malloc(sizeof(srec));
|
||||
tmp3->nick = (char *)new_malloc(strlen(tmp2->nick)+1);
|
||||
strcpy(tmp3->nick, 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! :)
|
||||
*/
|
||||
|
||||
static int comp_score(const void *a, const void *b)
|
||||
int comp_score(srec **one, srec **two)
|
||||
{
|
||||
srec * const *one = a;
|
||||
srec * const *two = b;
|
||||
|
||||
if ((*one)->score > (*two)->score)
|
||||
return -1;
|
||||
if ((*one)->score < (*two)->score)
|
||||
@@ -440,89 +478,87 @@ static int comp_score(const void *a, const void *b)
|
||||
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)
|
||||
send_to_server("PRIVMSG %s :%2d: %s", chan, i++, tmp->acro);
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
send_to_server("PRIVMSG %s :Scores for round %d\r\nPRIVMSG %s :Nick Score\r\nPRIVMSG %s :-----------------", chan, acro->round, chan, chan);
|
||||
sprintf(line, "PRIVMSG %s :Scores for round %d\r\nPRIVMSG %s :Nick Score\r\nPRIVMSG %s :-----------------\r\n", chan, acro->round, chan, chan);
|
||||
else
|
||||
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);
|
||||
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);
|
||||
for (i = 0; i < acro->top && (score || gscore); i++)
|
||||
{
|
||||
if ((acro->round < acro->rounds) && score)
|
||||
{
|
||||
send_to_server("PRIVMSG %s :%-9s %lu", chan, score->nick, score->score);
|
||||
snprintf(buff, 198, "PRIVMSG %s :%-9s %lu", chan, score->nick, score->score);
|
||||
strcat(buff, "\r\n");
|
||||
score = score->next;
|
||||
}
|
||||
else if (acro->round == acro->rounds && (score || gscore))
|
||||
{
|
||||
if (!score && gscore)
|
||||
{
|
||||
send_to_server("PRIVMSG %s : %-9s %lu", chan, gscore->nick, gscore->score);
|
||||
snprintf(buff, 198, "PRIVMSG %s : %-9s %lu", chan, gscore->nick, gscore->score);
|
||||
strcat(buff, "\r\n");
|
||||
gscore = gscore->next;
|
||||
}
|
||||
else if (score && !gscore)
|
||||
{
|
||||
send_to_server("PRIVMSG %s :%-9s %lu", chan, score->nick, score->score);
|
||||
snprintf(buff, 198, "PRIVMSG %s :%-9s %lu", chan, score->nick, score->score);
|
||||
strcat(buff, "\r\n");
|
||||
score = score->next;
|
||||
}
|
||||
else if (gscore && score)
|
||||
{
|
||||
send_to_server("PRIVMSG %s :%-9s %-5lu %-9s %lu", chan, score->nick, score->score, gscore->nick, gscore->score);
|
||||
snprintf(buff, 198, "PRIVMSG %s :%-9s %-5lu %-9s %lu", chan, score->nick, score->score, gscore->nick, gscore->score);
|
||||
strcat(buff, "\r\n");
|
||||
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)
|
||||
|
||||
+7
-6
@@ -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,17 +98,18 @@ BUILT_IN_DLL(put_scores);
|
||||
grec *init_acro(grec *);
|
||||
void make_acro(grec *);
|
||||
int valid_acro(grec *, char *);
|
||||
void read_scores(void);
|
||||
srec *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 *);
|
||||
int warn_acro(void *, char *);
|
||||
int start_vote(void *, char *);
|
||||
int warn_vote(void *, char *);
|
||||
int end_voting(void *, char *);
|
||||
void warn_acro(char *);
|
||||
void start_vote(char *);
|
||||
void warn_vote(char *);
|
||||
void end_voting(char *);
|
||||
void show_acros(prec *, char *);
|
||||
void free_round(prec **, vrec **);
|
||||
void free_score(srec **);
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
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)
|
||||
@@ -0,0 +1,7 @@
|
||||
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
@@ -0,0 +1,409 @@
|
||||
/*
|
||||
* 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, "[1;45m 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, "[1;45m %%>%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;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#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 */
|
||||
@@ -0,0 +1,294 @@
|
||||
--- .//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
@@ -0,0 +1,716 @@
|
||||
/*
|
||||
* 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
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
- 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.
|
||||
@@ -0,0 +1,174 @@
|
||||
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
|
||||
@@ -0,0 +1,438 @@
|
||||
# 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.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
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.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
- fix BUGS
|
||||
- code cleanup
|
||||
- create better docummentation on usage
|
||||
@@ -0,0 +1,345 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#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
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* 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
@@ -0,0 +1,244 @@
|
||||
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
|
||||
@@ -0,0 +1,18 @@
|
||||
#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 */
|
||||
@@ -0,0 +1,520 @@
|
||||
#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);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
@@ -0,0 +1,60 @@
|
||||
#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;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
#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;
|
||||
}
|
||||
@@ -0,0 +1,869 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
#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
|
||||
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* 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
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* 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
@@ -35,7 +35,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
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) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -o ../dllinit.o -c ../dllinit.c
|
||||
$(CC) -DOS_$(OS) $(DEFS) $(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) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $<
|
||||
$(CC) -DOS_$(OS) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $<
|
||||
|
||||
depend:
|
||||
gcc -MM $(CPPFLAGS) $(CPPFLAGS) $(CFLAGS) *.c > .depend
|
||||
gcc -MM $(CPPFLAGS) $(DEFS) $(CFLAGS) *.c > .depend
|
||||
|
||||
install:
|
||||
$(INSTALL) $(PLUGIN_NAME)$(SHLIB_SUFFIX) $(DESTDIR)$(PLUGINDIR)
|
||||
|
||||
+1
-1
@@ -261,7 +261,7 @@ int j,k;
|
||||
for (k=0;k<6;k++)
|
||||
{
|
||||
scalefac_l[0][ch][sfb]=getbits(slen[1]);
|
||||
i+=slen[1];
|
||||
i+=slen[j];
|
||||
if (ch) is_max[sfb]=(1<<slen[1])-1;
|
||||
sfb++;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#define HUFFMAN
|
||||
#include "huffman.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
static inline unsigned int viewbits(int n)
|
||||
{
|
||||
unsigned int pos,ret_value;
|
||||
|
||||
+4
-4
@@ -77,7 +77,7 @@ int hsize,fs,mean_frame_size;
|
||||
nbal=&t_nbal2;
|
||||
sblimit=8;
|
||||
break;
|
||||
default : break;
|
||||
default : /*printf(" bit alloc info no gud ");*/
|
||||
}
|
||||
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 : break;
|
||||
default : /*printf(" bit alloc info no gud ");*/
|
||||
}
|
||||
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 : break;
|
||||
default : /*printf("bit alloc info not ok\n");*/
|
||||
}
|
||||
break;
|
||||
default : break;
|
||||
default : /*printf("sampling freq. not ok/n");*/
|
||||
} else {
|
||||
bit_alloc_index=&t_allocMPG2;
|
||||
nbal=&t_nbalMPG2;
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#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.
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "audio.h"
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -160,10 +160,10 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
arcfour.o: $(srcdir)/arcfour.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/arcfour.c
|
||||
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/arcfour.c
|
||||
|
||||
md5.o: $(srcdir)/md5.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/md5.c
|
||||
$(CC) $(DEFS) $(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)
|
||||
|
||||
+57
-37
@@ -31,8 +31,6 @@
|
||||
#define INIT_MODULE
|
||||
#include "modval.h"
|
||||
|
||||
#define MODULE_NAME "arcfour"
|
||||
|
||||
typedef struct {
|
||||
int sock;
|
||||
char ukey[16];
|
||||
@@ -63,7 +61,7 @@ static unsigned int typenum = 0;
|
||||
static char *init_box(char *ukey, arckey *key)
|
||||
{
|
||||
MD5_CTX md5context;
|
||||
unsigned char buf[256];
|
||||
char buf[256];
|
||||
int fd;
|
||||
|
||||
fd = open("/dev/urandom", O_RDONLY);
|
||||
@@ -72,7 +70,11 @@ static char *init_box(char *ukey, arckey *key)
|
||||
close(fd);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
{
|
||||
buf[(int)buf[69]] ^= getpid();
|
||||
buf[(int)buf[226]] ^= getuid();
|
||||
buf[(int)buf[119]] ^= getpid();
|
||||
}
|
||||
|
||||
MD5Init(&md5context);
|
||||
MD5Update(&md5context, buf, sizeof(buf));
|
||||
@@ -85,18 +87,17 @@ static char *init_box(char *ukey, arckey *key)
|
||||
return ukey;
|
||||
}
|
||||
|
||||
static inline void arcfourInit(arckey *arc, void *userkey, unsigned short len)
|
||||
static inline void arcfourInit(arckey *arc, char *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(--x, (S[x] = x)); /* Initialize S-box, backwards */
|
||||
while((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_byte[pos]; /* Keys, shaken, not stirred */
|
||||
y += S[x] + userkey[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++ */
|
||||
@@ -120,15 +121,25 @@ static inline char *arcfourCrypt(arckey *arc, char *data, int len)
|
||||
|
||||
int Arcfour_Init(IrcCommandDll **intp, Function_ptr *global_table)
|
||||
{
|
||||
static const struct dcc_ops schat_ops = { NULL, start_dcc_crypt, dcc_schat_input, send_dcc_encrypt, end_dcc_crypt };
|
||||
|
||||
initialize_module(MODULE_NAME);
|
||||
initialize_module("arcfour");
|
||||
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);
|
||||
/*
|
||||
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;
|
||||
}
|
||||
|
||||
int Arcfour_Cleanup(IrcCommandDll **intp)
|
||||
{
|
||||
/* remove_dcc_bind("SCHAT", typenum); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static arclist *find_box(int sock)
|
||||
{
|
||||
int i, tmp;
|
||||
@@ -161,17 +172,15 @@ static int send_dcc_encrypt (int type, int sock, char *buf, int len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int dcc_schat_input(int type, int sock, char *buf, int parm, int buf_size)
|
||||
static int get_dcc_encrypt (int type, int sock, char *buf, int parm, int len)
|
||||
{
|
||||
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';
|
||||
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';
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@@ -181,7 +190,8 @@ static int dcc_schat_input(int type, int sock, char *buf, int parm, int buf_size
|
||||
* an encrypted connection.
|
||||
*/
|
||||
|
||||
static int start_dcc_crypt (int s, int type, unsigned long d_addr, unsigned short d_port)
|
||||
|
||||
static int start_dcc_crypt (int s, int type, unsigned long d_addr, int d_port)
|
||||
{
|
||||
arclist *tmpbox;
|
||||
put_it("start_dcc_crypt");
|
||||
@@ -192,18 +202,14 @@ static int start_dcc_crypt (int s, int type, unsigned long d_addr, unsigned shor
|
||||
memset(randkey, 0, sizeof(randkey));
|
||||
memset(buf, 0, sizeof(buf));
|
||||
tmpbox->outbox = (arckey *)new_malloc(sizeof(arckey));
|
||||
if (init_box(randkey, tmpbox->outbox) == NULL)
|
||||
{
|
||||
new_free(&tmpbox->outbox);
|
||||
return -1;
|
||||
}
|
||||
init_box(randkey, tmpbox->outbox);
|
||||
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, NULL), 16);
|
||||
arcfourInit(tmpbox->inbox, next_arg(buf, &buf), 16);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -211,7 +217,7 @@ static int start_dcc_crypt (int s, int type, unsigned long d_addr, unsigned shor
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int end_dcc_crypt(int s, unsigned long d_addr, unsigned short d_port)
|
||||
static int end_dcc_crypt (int s, unsigned long d_addr, int d_port)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 16; i++) {
|
||||
@@ -225,10 +231,11 @@ static int end_dcc_crypt(int s, unsigned long d_addr, unsigned short d_port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static void start_dcc_chat(int s)
|
||||
{
|
||||
struct sockaddr_in remaddr;
|
||||
socklen_t sra;
|
||||
int sra;
|
||||
int type;
|
||||
int new_s = -1;
|
||||
char *nick = NULL;
|
||||
@@ -243,10 +250,7 @@ SocketList *sa;
|
||||
new_s = accept(s, (struct sockaddr *) &remaddr, &sra);
|
||||
type = flags & DCC_TYPES;
|
||||
n = get_socketinfo(s);
|
||||
|
||||
/* 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)
|
||||
if ((add_socketread(new_s, ntohs(remaddr.sin_port), flags, nick, get_dcc_encrypt, NULL)) < 0)
|
||||
{
|
||||
erase_dcc_info(s, 0, "%s", convert_output_format("$G %RDCC error: accept() failed. punt!!", NULL, NULL));
|
||||
close_socketread(s);
|
||||
@@ -274,6 +278,8 @@ 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);
|
||||
@@ -282,6 +288,20 @@ void dcc_sdcc (char *name, char *args)
|
||||
if (p && *p)
|
||||
*p = 0;
|
||||
}
|
||||
dcc_create(args, "ARC4CHAT", NULL, 0, 0, typenum, DCC_TWOCLIENTS, start_dcc_chat);
|
||||
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 */;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ typedef struct {
|
||||
} arckey;
|
||||
|
||||
/* Prototypes */
|
||||
static inline void arcfourInit(arckey *, void *, unsigned short);
|
||||
static inline void arcfourInit(arckey *, char *, unsigned short);
|
||||
static inline char *arcfourCrypt(arckey *, char *, int);
|
||||
static int send_dcc_encrypt (int, int, char *, 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);
|
||||
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);
|
||||
void dcc_sdcc (char *, char *);
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
/* MD5 Message Digest algorithm */
|
||||
|
||||
#include <string.h>
|
||||
#include "md5.h"
|
||||
|
||||
/* Prototypes */
|
||||
@@ -217,7 +216,7 @@ static void Transform(UINT_32 *buf, UINT_32 *in)
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
|
||||
memset(in, 0, 16 * sizeof in[0]);
|
||||
memset((void *)in, 0, sizeof(in));
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -35,7 +35,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -163,7 +163,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
autocycle.o: $(srcdir)/autocycle.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/autocycle.c
|
||||
$(CC) $(DEFS) $(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)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
int auto_cycle(IrcCommandDll *interp, char *command, char *args, char *subargs)
|
||||
{
|
||||
char * channel = current_window->current_channel;
|
||||
int netsplit = (next_arg(args, &args) != NULL);
|
||||
int netsplit = (int)next_arg(args, &args);
|
||||
int this_server = current_window->server;
|
||||
ChannelList * chan = lookup_channel(channel, this_server, 0);
|
||||
NickList * tmp = NULL;
|
||||
|
||||
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -160,7 +160,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
blowfish.o: $(srcdir)/blowfish.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/blowfish.c
|
||||
$(CC) $(DEFS) $(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)
|
||||
|
||||
@@ -101,7 +101,7 @@ static void blowfish_decipher (UWORD_32bits * xl, UWORD_32bits * xr)
|
||||
*xr = Xl.word;
|
||||
}
|
||||
|
||||
static void blowfish_init (const char *key, short keybytes)
|
||||
static void blowfish_init (UBYTE_08bits * key, short keybytes)
|
||||
{
|
||||
int i, j, bx;
|
||||
time_t lowest;
|
||||
@@ -115,7 +115,7 @@ static void blowfish_init (const char *key, short keybytes)
|
||||
if (blowbox[i].P != NULL)
|
||||
{
|
||||
if ((blowbox[i].keybytes == keybytes) &&
|
||||
(strncmp((char *) (blowbox[i].key), key, keybytes) == 0))
|
||||
(strncmp((char *) (blowbox[i].key), (char *) key, keybytes) == 0))
|
||||
{
|
||||
blowbox[i].lastuse = now;
|
||||
bf_P = blowbox[i].P;
|
||||
|
||||
+10
-1
@@ -11,12 +11,19 @@
|
||||
#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))) { \
|
||||
@@ -26,6 +33,8 @@
|
||||
}
|
||||
#endif /* BADARGS */
|
||||
|
||||
#endif /* WANT_TCL */
|
||||
|
||||
#define INIT_MODULE
|
||||
#include "modval.h"
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -160,7 +160,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
cavlink.o: $(srcdir)/cavlink.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/cavlink.c
|
||||
$(CC) $(DEFS) $(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)
|
||||
|
||||
+42
-53
@@ -130,7 +130,7 @@ int sucks = 0;
|
||||
set_dllint_var("cavlink_port", sucks);
|
||||
}
|
||||
else
|
||||
cav_say("No %s specified", !host?"host":"passwd");
|
||||
cav_say("No %s specified", !host?"host":!passwd?"passwd":"arrggh");
|
||||
}
|
||||
|
||||
BUILT_IN_DLL(cmode)
|
||||
@@ -158,9 +158,9 @@ char buffer[BIG_BUFFER_SIZE];
|
||||
|
||||
BUILT_IN_DLL(cattack)
|
||||
{
|
||||
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};
|
||||
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};
|
||||
if (!check_cavlink(cavhub, NULL, 1))
|
||||
return;
|
||||
if (!my_stricmp(command, "CATTACK"))
|
||||
@@ -201,7 +201,7 @@ static const char * const type[] = { "dcc_bomb", "version_flood", "ping_flood",
|
||||
{
|
||||
if (!my_strnicmp(args, "-t", 2))
|
||||
{
|
||||
next_arg(args, &args);
|
||||
tmp = next_arg(args, &args);
|
||||
times = next_arg(args, &args);
|
||||
if (times && !isdigit(*times))
|
||||
times = "6";
|
||||
@@ -218,7 +218,7 @@ static const char * const type[] = { "dcc_bomb", "version_flood", "ping_flood",
|
||||
{
|
||||
if (!my_strnicmp(args, "-t", 2))
|
||||
{
|
||||
next_arg(args, &args);
|
||||
tmp = 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, (long)time(NULL));
|
||||
sprintf(buffer, "msg %s PING %ld\n", nick, time(NULL));
|
||||
else
|
||||
sprintf(buffer, "say PING %ld\n", (long)time(NULL));
|
||||
sprintf(buffer, "say PING %ld\n", 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 || !find_in_list((List **)chan, channel, 0))
|
||||
if (!chan || !(chan = (ChannelList *)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 cav_randm (unsigned long l)
|
||||
static unsigned long randm (unsigned long l)
|
||||
{
|
||||
unsigned long t1, t2, t;
|
||||
struct timeval tp1;
|
||||
@@ -456,27 +456,19 @@ static unsigned long cav_randm (unsigned long l)
|
||||
|
||||
int do_dccbomb(int server, char *target, int repcount)
|
||||
{
|
||||
char buffer[BIG_BUFFER_SIZE];
|
||||
int i, j;
|
||||
char text[100];
|
||||
|
||||
char buffer[BIG_BUFFER_SIZE];
|
||||
int i;
|
||||
char *text = NULL;
|
||||
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", 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, "%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, "PRIVMSG %s :DCC SEND %s 2293243493 8192 6978632", target, text);
|
||||
my_send_to_server(server, buffer);
|
||||
}
|
||||
@@ -566,7 +558,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, (long)time(NULL));
|
||||
snprintf(buffer, IRCD_BUFFER_SIZE, "PRIVMSG %s :PING %ld", target, 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"))
|
||||
@@ -830,9 +822,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->nick && !my_stricmp(tmp->nick, nick))
|
||||
if (!tmp || (tmp->nick && !my_stricmp(tmp->nick, nick)))
|
||||
return;
|
||||
}
|
||||
dcc_printf(Client->is_read, "msg %s AWAY %s\n", nick, get_server_away(from_server));
|
||||
@@ -841,10 +833,11 @@ NickTab *tmp;
|
||||
|
||||
int handle_msg (SocketList *Client, char **ArgList)
|
||||
{
|
||||
char *nick, *host, *str;
|
||||
nick = ArgList[2];
|
||||
host = ArgList[3];
|
||||
str = ArgList[4];
|
||||
char *to, *nick, *host, *str;
|
||||
to = *(ArgList+1);
|
||||
nick = *(ArgList+2);
|
||||
host = *(ArgList+3);
|
||||
str = *(ArgList+4);
|
||||
PasteArgs(ArgList, 4);
|
||||
str = handle_ctcp(Client, nick, host, NULL, str);
|
||||
if (!str || !*str)
|
||||
@@ -861,6 +854,7 @@ 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];
|
||||
@@ -955,7 +949,7 @@ switch(dgets(tmpstr, s, 0, BIG_BUFFER_SIZE, NULL))
|
||||
return;
|
||||
}
|
||||
ArgList = TrueArgs;
|
||||
BreakArgs(tmp, NULL, ArgList, 1);
|
||||
count = BreakArgs(tmp, NULL, ArgList, 1);
|
||||
if (!(comm = (*++ArgList)) || !*ArgList)
|
||||
return; /* Empty line from server - ByeBye */
|
||||
|
||||
@@ -1111,7 +1105,7 @@ SocketList *cavlink_connect(char *host, u_short port)
|
||||
set_lastlog_msg_level(lastlog_level);
|
||||
return NULL;
|
||||
}
|
||||
memcpy(&address, hp->h_addr, sizeof(address));
|
||||
bcopy(hp->h_addr, (char *)&address, sizeof(address));
|
||||
}
|
||||
cav_socket = connect_by_number(host, &port, SERVICE_CLIENT, PROTOCOL_TCP, 1);
|
||||
if (cav_socket < 0)
|
||||
@@ -1214,6 +1208,7 @@ BUILT_IN_DLL(cavhelp)
|
||||
|
||||
BUILT_IN_DLL(cavsave)
|
||||
{
|
||||
IrcVariableDll *newv = NULL;
|
||||
FILE *outf = NULL;
|
||||
char *expanded = NULL;
|
||||
char buffer[BIG_BUFFER_SIZE+1];
|
||||
@@ -1228,25 +1223,19 @@ char buffer[BIG_BUFFER_SIZE+1];
|
||||
new_free(&expanded);
|
||||
return;
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
cav_say("Finished saving cavlink variables to %s", buffer);
|
||||
fclose(outf);
|
||||
new_free(&expanded);
|
||||
|
||||
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -160,7 +160,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
cdrom.o: $(srcdir)/cdrom.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/cdrom.c
|
||||
$(CC) $(DEFS) $(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)
|
||||
|
||||
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -160,7 +160,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
encrypt.o: $(srcdir)/encrypt.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/encrypt.c
|
||||
$(CC) $(DEFS) $(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)
|
||||
|
||||
+9
-10
@@ -17,7 +17,7 @@
|
||||
|
||||
#define cparse convert_output_format
|
||||
char encode_version[] = "Encode 0.001";
|
||||
unsigned char encode_string[256];
|
||||
unsigned char *encode_string = NULL;
|
||||
|
||||
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), (char *)encode_string);
|
||||
my_encrypt(new, strlen(new), 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), (char *)encode_string);
|
||||
my_decrypt(new, strlen(new), encode_string);
|
||||
return new;
|
||||
}
|
||||
|
||||
@@ -47,25 +47,24 @@ char *Encode_Version(IrcCommandDll **intp)
|
||||
|
||||
int Encrypt_Init(IrcCommandDll **intp, Function_ptr *global_table)
|
||||
{
|
||||
int i;
|
||||
char buffer[BIG_BUFFER_SIZE+1];
|
||||
|
||||
int i, j;
|
||||
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);
|
||||
|
||||
for (i = 1; i <= 255; i++)
|
||||
encode_string = (char *)new_malloc(512);
|
||||
for (i = 1, j = 255; i <= 255; i++, j--)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 27:
|
||||
case 127:
|
||||
case 255:
|
||||
encode_string[i - 1] = i;
|
||||
encode_string[i-1] = i;
|
||||
break;
|
||||
default:
|
||||
encode_string[i - 1] = 256 - i;
|
||||
encode_string[i-1] = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -165,7 +165,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
europa.o: $(srcdir)/europa.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/europa.c
|
||||
$(CC) $(DEFS) $(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
@@ -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_connect(&mysql, DBHOST, DBUSER, DBPASSWD))) {
|
||||
if(!(mysql_real_connect(&mysql, DBHOST, DBUSER, DBPASSWD, NULL, 0, NULL, 0))) {
|
||||
put_it("** Server refused login/password.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -160,7 +160,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
fserv.o: $(srcdir)/fserv.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/fserv.c
|
||||
$(CC) $(DEFS) $(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)
|
||||
|
||||
+43
-59
@@ -191,7 +191,7 @@ char *make_mp3_string(FILE *fp, Files *f, char *fs, char *dirbuff)
|
||||
*s++ = *fs;
|
||||
break;
|
||||
case 'b':
|
||||
sprintf(s, "%*d", prec, f->bitrate);
|
||||
sprintf(s, "%*u", 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, "%*d", prec, f->freq);
|
||||
sprintf(s, "%*u", 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)
|
||||
fputs(buffer, fp);
|
||||
fprintf(fp, buffer);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -293,9 +293,10 @@ char *fs = NULL;
|
||||
*dir = 0;
|
||||
for (new = fserv_files; new; new = new->next)
|
||||
{
|
||||
if (!pattern || wild_match(pattern, new->filename))
|
||||
if (!pattern || (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))
|
||||
@@ -458,7 +459,7 @@ int gethdr(int file, AUDIO_HEADER *header)
|
||||
return 0;
|
||||
}
|
||||
|
||||
long get_bitrate(char *filename, time_t *mp3_time, int *freq_rate, int *id3, unsigned long *filesize, int *stereo)
|
||||
long get_bitrate(char *filename, time_t *mp3_time, unsigned 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},
|
||||
@@ -720,60 +721,44 @@ Files *search_list(char *nick, char *pat, int wild)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
char *make_temp_list(char *nick)
|
||||
{
|
||||
Files *file;
|
||||
FILE *fp;
|
||||
const time_t when = now;
|
||||
int count;
|
||||
char *fmt, *name;
|
||||
char buf[BIG_BUFFER_SIZE + 1];
|
||||
|
||||
if (fserv_files == NULL)
|
||||
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);
|
||||
return NULL;
|
||||
|
||||
name = get_dllstring_var("fserv_filename");
|
||||
if (name != NULL && *name != '\0')
|
||||
{
|
||||
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;
|
||||
}
|
||||
else
|
||||
if ((fp = fopen(real_nam, "w")))
|
||||
{
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
new_free(&real_nam);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BUILT_IN_DLL(list_fserv)
|
||||
@@ -926,7 +911,7 @@ int search_proc(char *which, char *str, char **unused)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int impress_me(void *args, char *sub)
|
||||
void impress_me(void *args)
|
||||
{
|
||||
int timer;
|
||||
char *ch = NULL;
|
||||
@@ -994,7 +979,6 @@ int impress_me(void *args, char *sub)
|
||||
}
|
||||
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)
|
||||
@@ -1044,13 +1028,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 %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 %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 %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 %ld\n", bogus, "_totalstart", (long)statistics.starttime);
|
||||
fprintf(fp, "%s%s %lu\n", bogus, "_totalstart", statistics.starttime);
|
||||
fprintf(fp, "%s%s %lu\n", bogus, "_totalsizeserved", statistics.filesize_served);
|
||||
}
|
||||
fclose(fp);
|
||||
@@ -1179,7 +1163,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");
|
||||
strmcpy(FSstr, cparse(FS, NULL, NULL), sizeof(FSstr) - 1);
|
||||
strcpy(FSstr, cparse(FS, NULL, NULL));
|
||||
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);
|
||||
|
||||
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -160,7 +160,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
hint.o: $(srcdir)/hint.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/hint.c
|
||||
$(CC) $(DEFS) $(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_DATA) $(srcdir)/BitchX.hints $(DESTDIR)$(PLUGINDIR)/@HINT_FILE@
|
||||
$(INSTALL) $(srcdir)/BitchX.hints $(DESTDIR)$(PLUGINDIR)/@HINT_FILE@
|
||||
|
||||
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -160,7 +160,7 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
identd.o: $(srcdir)/identd.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/identd.c
|
||||
$(CC) $(DEFS) $(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
@@ -49,7 +49,7 @@ unsigned int lport = 0, rport = 0;
|
||||
void identd_handler(int s)
|
||||
{
|
||||
struct sockaddr_in remaddr;
|
||||
socklen_t sra = sizeof(struct sockaddr_in);
|
||||
int sra = sizeof(struct sockaddr_in);
|
||||
int sock = -1;
|
||||
#if 0
|
||||
if (!(get_dllint_var("identd")) || !(get_dllstring_var("identd_user")))
|
||||
|
||||
+8
-8
@@ -32,7 +32,7 @@ INSTALL_IRC = @INSTALL_IRC@
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @INCLUDES@ @DEFS@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
@@ -162,26 +162,26 @@ Makefile: Makefile.in
|
||||
&& ./config.status
|
||||
|
||||
compat.o: $(top_srcdir)/source/compat.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) \
|
||||
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) \
|
||||
-c $(top_srcdir)/source/compat.c
|
||||
|
||||
nap.o: $(srcdir)/nap.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/nap.c
|
||||
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/nap.c
|
||||
|
||||
napsend.o: $(srcdir)/napsend.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napsend.c
|
||||
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napsend.c
|
||||
|
||||
nap_file.o: $(srcdir)/nap_file.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/nap_file.c
|
||||
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/nap_file.c
|
||||
|
||||
napfunc.o: $(srcdir)/napfunc.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napfunc.c
|
||||
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napfunc.c
|
||||
|
||||
napother.o: $(srcdir)/napother.c
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napother.c
|
||||
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/napother.c
|
||||
|
||||
md5.o: $(srcdir)/md5.c $(srcdir)/md5.h
|
||||
$(CC) $(CPPFLAGS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/md5.c
|
||||
$(CC) $(DEFS) $(SHLIB_CFLAGS) $(CFLAGS) -c $(srcdir)/md5.c
|
||||
|
||||
nap$(SHLIB_SUFFIX): $(OBJS)
|
||||
$(SHLIB_LD) $(OBJS) $(SHLIB_CFLAGS) -o nap$(SHLIB_SUFFIX)
|
||||
|
||||
+1
-1
@@ -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 */
|
||||
}
|
||||
|
||||
|
||||
+39
-46
@@ -224,7 +224,7 @@ int connectbynumber(char *hostn, unsigned short *portnum, int service, int proto
|
||||
|
||||
if (service == SERVICE_SERVER)
|
||||
{
|
||||
socklen_t length;
|
||||
int length;
|
||||
#ifdef IP_PORTRANGE
|
||||
int ports;
|
||||
#endif
|
||||
@@ -273,9 +273,11 @@ int connectbynumber(char *hostn, unsigned short *portnum, int service, int proto
|
||||
/* Inet domain client */
|
||||
else if (service == SERVICE_CLIENT)
|
||||
{
|
||||
struct sockaddr_foobar server = { 0 };
|
||||
struct sockaddr_foobar server;
|
||||
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
|
||||
@@ -311,15 +313,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;
|
||||
|
||||
snprintf(thing, sizeof thing, "%3.3d", curr);
|
||||
return thing;
|
||||
return (nap_ansi?nap_ansi:empty_string);
|
||||
sprintf(thing, "%3.3u", curr);
|
||||
return (thing);
|
||||
}
|
||||
|
||||
static void set_numeric_string(Window *win, char *value, int unused)
|
||||
@@ -821,7 +823,7 @@ NAP_COMM(cmd_error)
|
||||
nap_error = 11;
|
||||
}
|
||||
else
|
||||
nap_say("%s", cparse("Received error for [$0] $1-.", "%d %s", cmd, args ? args : empty_string));
|
||||
nap_say("%s", cparse("Recieved error for [$0] $1-.", "%d %s", cmd, args ? args : empty_string));
|
||||
}
|
||||
if (nap_error > 10)
|
||||
{
|
||||
@@ -834,7 +836,7 @@ NAP_COMM(cmd_error)
|
||||
NAP_COMM(cmd_unknown)
|
||||
{
|
||||
if (do_hook(MODULE_LIST, "NAP UNKNOWN %s", args))
|
||||
nap_say("%s", cparse("Received unknown [$0] $1-.", "%d %s", cmd, args));
|
||||
nap_say("%s", cparse("Recieved unknown [$0] $1-.", "%d %s", cmd, args));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1013,13 +1015,11 @@ 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))
|
||||
{
|
||||
name_print(ch->nicks, 0);
|
||||
if (ch)
|
||||
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;
|
||||
}
|
||||
memcpy(&address, hp->h_addr, sizeof(address));
|
||||
bcopy(hp->h_addr, (char *)&address, 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;
|
||||
}
|
||||
memcpy(&address, hp->h_addr, sizeof(address));
|
||||
bcopy(hp->h_addr, (char *)&address, sizeof(address));
|
||||
}
|
||||
nap_socket = connectbynumber(host, &port, SERVICE_CLIENT, PROTOCOL_TCP, 1);
|
||||
if (nap_socket < 0)
|
||||
@@ -1331,6 +1331,7 @@ BUILT_IN_DLL(naphelp)
|
||||
|
||||
BUILT_IN_DLL(napsave)
|
||||
{
|
||||
IrcVariableDll *newv = NULL;
|
||||
FILE *outf = NULL;
|
||||
char *expanded = NULL;
|
||||
char buffer[NAP_BUFFER_SIZE+1];
|
||||
@@ -1347,32 +1348,21 @@ char *p = NULL;
|
||||
new_free(&expanded);
|
||||
return;
|
||||
}
|
||||
|
||||
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 (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);
|
||||
}
|
||||
}
|
||||
for (new = nap_hotlist; new; new = new->next)
|
||||
m_s3cat(&p, " ", new->nick);
|
||||
if (p)
|
||||
@@ -1603,14 +1593,17 @@ void print_file(FileStruct *f, int count)
|
||||
|
||||
NAP_COMM(cmd_fileinfo)
|
||||
{
|
||||
char *nick;
|
||||
char *ip;
|
||||
int port;
|
||||
char *file;
|
||||
char *checksum;
|
||||
int speed;
|
||||
next_arg(args, &args); /* nick, ignored */
|
||||
next_arg(args, &args); /* ip, ignored */
|
||||
nick = next_arg(args, &args);
|
||||
ip = next_arg(args, &args);
|
||||
port = my_atol(next_arg(args, &args));
|
||||
file = new_next_arg(args, &args);
|
||||
next_arg(args, &args); /* checksum, ignored */
|
||||
checksum = next_arg(args, &args);
|
||||
speed = my_atol(next_arg(args, &args));
|
||||
nap_put("Number ³ Song ³ Speed");
|
||||
nap_put("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");
|
||||
@@ -1746,7 +1739,7 @@ char *type = NULL;
|
||||
}
|
||||
else if (strstr(cmd, "line"))
|
||||
{
|
||||
if (value > 10)
|
||||
if (value < 0 || value > 10)
|
||||
{
|
||||
nap_say("%s", cparse("Allowed linespeed 0-10", NULL));
|
||||
return;
|
||||
|
||||
+5
-4
@@ -482,11 +482,12 @@ 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 - gf->count);
|
||||
rc += read(snum, &indata[gf->count], sizeof(indata)-1);
|
||||
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);
|
||||
@@ -524,8 +525,7 @@ unsigned long nbytes = 0;
|
||||
send_ncommand(CMDS_UPDATE_GET, NULL);
|
||||
return;
|
||||
}
|
||||
rc = ioctl(snum, FIONREAD, &nbytes);
|
||||
if (rc != -1)
|
||||
if ((rc = ioctl(snum, FIONREAD, &nbytes) != -1))
|
||||
{
|
||||
if (nbytes)
|
||||
{
|
||||
@@ -739,6 +739,7 @@ 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];
|
||||
@@ -751,7 +752,7 @@ struct stat st;
|
||||
port = my_atol(next_arg(args, &args));
|
||||
file = new_next_arg(args, &args);
|
||||
checksum = next_arg(args, &args);
|
||||
/* Last argument (speed) ignored */
|
||||
speed = my_atol(args);
|
||||
|
||||
if (!(gf = find_in_getfile(&getfile_struct, 1, nick, checksum, file, -1, NAP_DOWNLOAD)))
|
||||
{
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ BUILT_IN_FUNCTION(func_connected)
|
||||
{
|
||||
if (nap_socket > -1)
|
||||
{
|
||||
socklen_t len;
|
||||
int len;
|
||||
struct sockaddr_in name;
|
||||
len = sizeof (name);
|
||||
if (getpeername(nap_socket, (struct sockaddr *)&name, &len))
|
||||
|
||||
+55
-49
@@ -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, "%*d", prec, f->bitrate);
|
||||
sprintf(s, "%*u", 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, "%*d", prec, f->freq);
|
||||
sprintf(s, "%*u", 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)
|
||||
fputs(buffer, fp);
|
||||
fprintf(fp, buffer);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ char *fs = NULL;
|
||||
*dir = 0;
|
||||
for (new = fserv_files; new; new = new->next)
|
||||
{
|
||||
if (!pattern || wild_match(pattern, new->filename))
|
||||
if (!pattern || (pattern && wild_match(pattern, new->filename)))
|
||||
{
|
||||
char *p;
|
||||
p = base_name(new->filename);
|
||||
@@ -605,14 +605,17 @@ double compute_tpf(AUDIO_HEADER *fr)
|
||||
}
|
||||
|
||||
|
||||
long get_bitrate(int fdes, time_t *mp3_time, int *freq_rate, unsigned long *filesize, int *stereo, long *id3, int *mime_type)
|
||||
long get_bitrate(int fdes, time_t *mp3_time, unsigned 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;
|
||||
@@ -624,15 +627,15 @@ long get_bitrate(int fdes, time_t *mp3_time, int *freq_rate, unsigned long *file
|
||||
memset(tmp, 0, sizeof(tmp));
|
||||
read(fdes, tmp, 4);
|
||||
|
||||
if (!memcmp(tmp, "PK\003\004", 4)) /* zip magic */
|
||||
if (!strcmp(tmp, "PK\003\004")) /* zip magic */
|
||||
return 0;
|
||||
if (!memcmp(tmp, "PE", 2) || !memcmp(tmp, "MZ", 2)) /* windows Exe magic */
|
||||
if (!strcmp(tmp, "PE") || !strcmp(tmp, "MZ")) /* windows Exe magic */
|
||||
return 0;
|
||||
if (!memcmp(tmp, "\037\235", 2)) /* gzip/compress */
|
||||
if (!strcmp(tmp, "\037\235")) /* gzip/compress */
|
||||
return 0;
|
||||
if (!memcmp(tmp, "\037\213", 2) || !memcmp(tmp, "\037\036", 2) || !memcmp(tmp, "BZh", 3)) /* gzip/compress/bzip2 */
|
||||
if (!strcmp(tmp, "\037\213") || !strcmp(tmp, "\037\036") || !strcmp(tmp, "BZh")) /* gzip/compress/bzip2 */
|
||||
return 0;
|
||||
if (!memcmp(tmp, "\177ELF", 4)) /* elf binary */
|
||||
if (!strcmp(tmp, "\177ELF")) /* elf binary */
|
||||
return 0;
|
||||
|
||||
head = convert_to_header(tmp);
|
||||
@@ -681,7 +684,7 @@ long get_bitrate(int fdes, time_t *mp3_time, int *freq_rate, unsigned long *file
|
||||
lseek(fdes, 0, SEEK_SET);
|
||||
*id3 = 0;
|
||||
rc = read(fdes, buff, 128);
|
||||
if (rc == 128 && !strncmp(buff, "ID3", 3))
|
||||
if (!strncmp(buff, "ID3", 3))
|
||||
{
|
||||
struct id3v2 {
|
||||
char tag[3];
|
||||
@@ -725,6 +728,8 @@ 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;
|
||||
@@ -748,9 +753,7 @@ unsigned long size = DEFAULT_MD5_SIZE;
|
||||
#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);
|
||||
@@ -768,13 +771,11 @@ unsigned long size = DEFAULT_MD5_SIZE;
|
||||
md5_finish(digest, &state);
|
||||
munmap(m, size);
|
||||
#endif
|
||||
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);
|
||||
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));
|
||||
}
|
||||
return m_strdup(buffer);
|
||||
}
|
||||
@@ -861,9 +862,8 @@ 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 %d %d %ld", new->filename,
|
||||
new->checksum, new->filesize, new->bitrate, new->freq,
|
||||
(long)new->time);
|
||||
sprintf(buffer, "\"%s\" %s %lu %u %u %lu", new->filename,
|
||||
new->checksum, new->filesize, new->bitrate, new->freq, 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 %d %d %ld\n",
|
||||
fprintf(fp, "\"%s\" %s %lu %u %u %lu\n",
|
||||
new->filename, new->checksum, new->filesize,
|
||||
new->bitrate, new->freq, (long)new->time);
|
||||
new->bitrate, new->freq, new->time);
|
||||
count++;
|
||||
}
|
||||
fclose(fp);
|
||||
@@ -1121,9 +1121,8 @@ Files *new;
|
||||
|
||||
if (new->freq && new->bitrate)
|
||||
{
|
||||
sprintf(buffer, "\"%s\" %s %lu %d %d %ld", name,
|
||||
new->checksum, new->filesize, new->bitrate, new->freq,
|
||||
(long)new->time);
|
||||
sprintf(buffer, "\"%s\" %s %lu %u %u %lu", name,
|
||||
new->checksum, new->filesize, new->bitrate, new->freq, new->time);
|
||||
cmd = CMDS_ADDFILE;
|
||||
}
|
||||
else
|
||||
@@ -1521,16 +1520,20 @@ SocketList *s;
|
||||
|
||||
void nap_firewall_start(int snum)
|
||||
{
|
||||
GetFile *gf;
|
||||
char buffer[NAP_BUFFER_SIZE+1];
|
||||
SocketList *s = get_socket(snum);
|
||||
|
||||
GetFile *gf;
|
||||
unsigned char buffer[NAP_BUFFER_SIZE+1];
|
||||
SocketList *s;
|
||||
s = get_socket(snum);
|
||||
if (!s || !(gf = (GetFile *)get_socketinfo(snum)))
|
||||
return;
|
||||
if ((read(snum, buffer, 4)) < 1)
|
||||
return;
|
||||
|
||||
if (!memcmp(buffer, "SEND", 4))
|
||||
#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"))
|
||||
s->func_read = napfirewall_pos;
|
||||
else
|
||||
close_socketread(snum);
|
||||
@@ -1538,14 +1541,15 @@ void nap_firewall_start(int snum)
|
||||
|
||||
void napfile_read(int snum)
|
||||
{
|
||||
GetFile *gf;
|
||||
int rc;
|
||||
SocketList *s = get_socket(snum);
|
||||
|
||||
GetFile *gf;
|
||||
unsigned char buffer[NAP_BUFFER_SIZE+1];
|
||||
int rc;
|
||||
SocketList *s;
|
||||
s = get_socket(snum);
|
||||
if (!(gf = (GetFile *)get_socketinfo(snum)))
|
||||
{
|
||||
char buff[2*NAP_BUFFER_SIZE+1];
|
||||
char fbuff[2*NAP_BUFFER_SIZE+1];
|
||||
unsigned char buff[2*NAP_BUFFER_SIZE+1];
|
||||
unsigned char fbuff[2*NAP_BUFFER_SIZE+1];
|
||||
char *nick, *filename, *args;
|
||||
|
||||
alarm(10);
|
||||
@@ -1575,6 +1579,7 @@ void napfile_read(int snum)
|
||||
|| !(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
|
||||
@@ -1583,7 +1588,7 @@ void napfile_read(int snum)
|
||||
if ((gf = find_in_getfile(&napster_sendqueue, 1, nick, NULL, fbuff, -1, NAP_UPLOAD)))
|
||||
gf->socket = snum;
|
||||
}
|
||||
write(snum, buff, strlen(buff));
|
||||
write(snum, buff, strlen(buffer));
|
||||
nap_finished_file(snum, gf);
|
||||
return;
|
||||
}
|
||||
@@ -1597,6 +1602,7 @@ void napfile_read(int snum)
|
||||
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;
|
||||
@@ -1616,10 +1622,10 @@ void napfile_read(int snum)
|
||||
|
||||
void naplink_handleconnect(int snum)
|
||||
{
|
||||
char buff[2*NAP_BUFFER_SIZE+1] = { 0 };
|
||||
SocketList *s;
|
||||
int rc;
|
||||
|
||||
unsigned char buff[2*NAP_BUFFER_SIZE+1];
|
||||
SocketList *s;
|
||||
int rc;
|
||||
memset(buff, 0, sizeof(buff) - 1);
|
||||
switch ((rc = recv(snum, buff, 4, MSG_PEEK)))
|
||||
{
|
||||
|
||||
@@ -1664,7 +1670,7 @@ void naplink_handleconnect(int snum)
|
||||
void naplink_handlelink(int snum)
|
||||
{
|
||||
struct sockaddr_in remaddr;
|
||||
socklen_t sra = sizeof(struct sockaddr_in);
|
||||
int sra = sizeof(struct sockaddr_in);
|
||||
int sock = -1;
|
||||
if ((sock = accept(snum, (struct sockaddr *) &remaddr, &sra)) > -1)
|
||||
{
|
||||
|
||||
+2
-2
@@ -258,7 +258,7 @@ enum nap_Commands {
|
||||
CMDS_CHANGEDATA = 703,
|
||||
|
||||
CMDS_PING = 751, /* user */
|
||||
CMDS_PONG = 752, /* <user> received from a ping*/
|
||||
CMDS_PONG = 752, /* <user> recieved 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 received on end of list */
|
||||
CMDS_NAME = 830, /* <channel> returns 825 with nick info, 830 is recieved on end of list */
|
||||
/* 831 */
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
ghost@aladdin.com
|
||||
|
||||
*/
|
||||
/*$Id$ */
|
||||
/*$Id: md5.c 3 2008-02-25 09:49:14Z keaston $ */
|
||||
/*
|
||||
Independent implementation of MD5 (RFC 1321).
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
ghost@aladdin.com
|
||||
|
||||
*/
|
||||
/*$Id$ */
|
||||
/*$Id: md5.h 3 2008-02-25 09:49:14Z keaston $ */
|
||||
/*
|
||||
Independent implementation of MD5 (RFC 1321).
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user