Added filename to prehash, ishashed to releasefiles and updated (test) IRCScraper to scrape filenames.

This commit is contained in:
Darko
2014-05-07 10:15:35 +02:00
parent d719e493b9
commit 15381d57a6
20 changed files with 47 additions and 5703 deletions
+1 -16
View File
@@ -8,7 +8,7 @@ There is a lib folder in main tmux folder. In that folder you will find two fold
2. Most of the scripts are now threaded, they need python installed. Install instructions are in threaded_scripts_readme.txt
3. You need to create sample folder in you covers folder (aka. /www/covers/sample) so you can have samples taken from releases, mostly XXX, and can be viewed in releases.
3. You need to create sample folder in you covers folder (aka. /www/covers/sample) so you can have samples taken from releases, mostly XXX, and can be viewed in releases. For video previews you need video folder /www/covers/video/.
4. OPTIONAL: If you want to populate your prehash table with more than 6 million rows of pre data (This dump includes 6,166,783 unique predb releases.), run dump_prehash.php to import the predb dump. Predb dump can be downloaded from https://mega.co.nz/#!LUsRACZA!Iz4u-0EIKTuIjySp00ESi2a1XcxFPxhppd15Hakb_YE.
@@ -48,21 +48,6 @@ Below is the original readme of newznab-tmux, with changes related to my git
git clone https://github.com/DariusIII/newznab-tmux.git tmux
cd tmux
* Now, you need to update your Newznab+ installation, copy some files and edit others. This is destructive and will overwrite any changes you have made to you Newznab+ files. If you do not want to update or overwrite you Newznab+ installation, skip this step, but not the next step.
```bash
cd scripts && sudo ./update_svn.sh
```
* Updating these scripts is very simple.
```bash
git pull
sudo scripts/update_svn.sh
```
* If you have grsec compiled into your kernel, you may need root privileges for nmon, bwm-ng and any other app that accesses the /proc folder.
* It is recommended, with stock scripts, that when backfilling or importing you set header retention to 0. This is not recommended when you are using these scripts. Let me explain why. If you start with empty parts/binaries tables and you import 100 nzbs, and at the same time you start update_releases, when update_releases finishes its loop, it deletes everything in the parts/binaries tables because you have header retention set to 0. But, heres where the problem is, youcontinued to import 200 nzbs while update_releases was running, they did not get imported as a release, they were deleted at the end of update_releases loop. So, I recommend you set header retention to at least .1, that is 2.4 hours, when only backfilling or importing.
+1 -1
View File
@@ -9,7 +9,7 @@ require_once(dirname(__FILE__) . "/../lib/showsleep.php");
require_once(dirname(__FILE__) . "/../lib/functions.php");
$version = "0.3r1146";
$version = "0.3r1147";
$db = new DB();
$functions = new Functions();
-12
View File
@@ -1,12 +0,0 @@
#!/usr/bin/env bash
commit=`git log | grep "^commit" | wc -l`
commit=`expr $commit + 1`
sed -i -e "s/\$version=.*$/\$version=\"0.3r$commit\";/" bin/monitor.php
cp -f /etc/mysql/my.cnf conf/jonnyboys_my.cnf
cp -f defaults.sh conf/jonnyboys_defaults.sh
sed -i -e 's/export SVN_PASSWORD=.*$/export SVN_PASSWORD="password"/' conf/jonnyboys_defaults.sh
git commit -a
+20 -7
View File
@@ -31,22 +31,24 @@ ALTER TABLE `releases`
DROP TABLE IF EXISTS prehash;
CREATE TABLE prehash (
ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
filename varchar(255) NOT NULL DEFAULT '',
title VARCHAR(255) NOT NULL DEFAULT '',
nfo VARCHAR(255) NULL,
size VARCHAR(50) NULL,
category VARCHAR(255) NULL,
predate DATETIME DEFAULT NULL,
source VARCHAR(50) NOT NULL DEFAULT '',
md5 VARCHAR(32) NOT NULL DEFAULT '',
sha1 VARCHAR(40) NOT NULL DEFAULT '',
requestID INT(10) UNSIGNED NOT NULL DEFAULT '0',
md5 VARCHAR(32) NOT NULL DEFAULT '',
sha1 VARCHAR(40) NOT NULL DEFAULT '',
requestID INT(10) UNSIGNED NOT NULL DEFAULT '0',
groupID INT(10) UNSIGNED NOT NULL DEFAULT '0',
nuked TINYINT(1) NOT NULL DEFAULT '0',
nukereason VARCHAR(255) NULL,
files VARCHAR(50) NULL,
nuked TINYINT(1) NOT NULL DEFAULT '0',
nukereason VARCHAR(255) NULL,
files VARCHAR(50) NULL,
PRIMARY KEY (ID)
) ENGINE=INNODB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci AUTO_INCREMENT=1;
CREATE INDEX ix_prehash_filename ON prehash (filename);
CREATE INDEX ix_prehash_title ON prehash(title);
CREATE INDEX ix_prehash_nfo ON prehash(nfo);
CREATE INDEX ix_prehash_predate ON prehash(predate);
@@ -194,7 +196,7 @@ INSERT INTO tmux (setting, value) values ('defrag_cache','900'),
('ffmpeg_duration', '5'),
('ffmpeg_image_time', '5'),
('processvideos', '0'),
('sqlpatch', '34');
('sqlpatch', '35');
DROP TABLE IF EXISTS country;
CREATE TABLE country (
@@ -492,6 +494,17 @@ ALTER TABLE releasecomment ADD COLUMN shareID VARCHAR(40) NOT NULL DEFAULT '';
ALTER TABLE releasecomment ADD COLUMN siteID VARCHAR(40) NOT NULL DEFAULT '';
ALTER TABLE releasecomment ADD COLUMN nzb_guid VARCHAR(32) NOT NULL DEFAULT '';
ALTER TABLE `releasefiles` ADD COLUMN `ishashed` tinyint(1) NOT NULL DEFAULT '0' AFTER `size`;
ALTER TABLE `releasefiles` ADD INDEX `ix_releasefiles_ishashed` (`ishashed`);
DROP TRIGGER IF EXISTS check_rfinsert;
DROP TRIGGER IF EXISTS check_rfupdate;
DELIMITER $$
CREATE TRIGGER check_rfinsert BEFORE INSERT ON releasefiles FOR EACH ROW BEGIN IF NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1; END IF; END;$$
CREATE TRIGGER check_rfupdate BEFORE UPDATE ON releasefiles FOR EACH ROW BEGIN IF NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1; END IF; END;$$
DELIMITER ;
INSERT INTO menu (href, title, tooltip, role, ordinal )
VALUES ('prehash', 'Prehash',
'Prehash', 1, 68);
+15
View File
@@ -0,0 +1,15 @@
ALTER TABLE `prehash` ADD COLUMN `filename` varchar(255) NOT NULL DEFAULT '';
ALTER TABLE `prehash` ADD INDEX `ix_prehash_filename` (`filename`);
ALTER TABLE `releasefiles` ADD COLUMN `ishashed` tinyint(1) NOT NULL DEFAULT '0' AFTER `size`;
ALTER TABLE `releasefiles` ADD INDEX `ix_releasefiles_ishashed` (`ishashed`);
DROP TRIGGER IF EXISTS check_rfinsert;
DROP TRIGGER IF EXISTS check_rfupdate;
CREATE TRIGGER check_rfinsert BEFORE INSERT ON releasefiles FOR EACH ROW BEGIN IF NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1; END IF; END;
CREATE TRIGGER check_rfupdate BEFORE UPDATE ON releasefiles FOR EACH ROW BEGIN IF NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1; END IF; END;
UPDATE `releasefiles` SET ishashed = 1 WHERE name REGEXP '[a-fA-F0-9]{32}';
UPDATE `tmux` SET value = '35' WHERE `setting` = 'sqlpatch';
+8 -2
View File
@@ -211,7 +211,9 @@ class IRCScraper extends IRCClient
if ($matches['files'] !== 'N/A') {
$this->CurPre['files'] = substr($matches['files'], 0, 50);
}
if (($matches['filename'] !== 'N/A') || ($matches['filename'] !== '')) {
$this->CurPre['filename'] = $matches['filename'];
}
if (isset($matches['nuked'])) {
switch ($matches['nuked']) {
case 'NUKED':
@@ -269,6 +271,7 @@ class IRCScraper extends IRCClient
$query .= (!empty($this->CurPre['source']) ? 'source, ' : '');
$query .= (!empty($this->CurPre['reason']) ? 'nukereason, ' : '');
$query .= (!empty($this->CurPre['files']) ? 'files, ' : '');
$query .= (!empty($this->CurPre['filename']) ? 'filename, ' : '');
$query .= (!empty($this->CurPre['reqid']) ? 'requestID, ' : '');
$query .= (!empty($this->CurPre['groupid']) ? 'groupID, ' : '');
$query .= (!empty($this->CurPre['nuked']) ? 'nuked, ' : '');
@@ -280,6 +283,7 @@ class IRCScraper extends IRCClient
$query .= (!empty($this->CurPre['source']) ? $this->db->escapeString($this->CurPre['source']) . ', ' : '');
$query .= (!empty($this->CurPre['reason']) ? $this->db->escapeString($this->CurPre['reason']) . ', ' : '');
$query .= (!empty($this->CurPre['files']) ? $this->db->escapeString($this->CurPre['files']) . ', ' : '');
$query .= (!empty($this->CurPre['filename']) ? $this->db->escapeString($this->CurPre['filename']) . ', ' : '');
$query .= (!empty($this->CurPre['reqid']) ? $this->CurPre['reqid'] . ', ' : '');
$query .= (!empty($this->CurPre['groupid']) ? $this->CurPre['groupid'] . ', ' : '');
$query .= (!empty($this->CurPre['nuked']) ? $this->CurPre['nuked'] . ', ' : '');
@@ -317,6 +321,7 @@ class IRCScraper extends IRCClient
$query .= (!empty($this->CurPre['size']) ? 'size = ' . $this->db->escapeString($this->CurPre['size']) . ', ' : '');
$query .= (!empty($this->CurPre['source']) ? 'source = ' . $this->db->escapeString($this->CurPre['source']) . ', ' : '');
$query .= (!empty($this->CurPre['files']) ? 'files = ' . $this->db->escapeString($this->CurPre['files']) . ', ' : '');
$query .= (!empty($this->CurPre['filename']) ? 'filename = ' . $this->db->escapeString($this->CurPre['filename']) . ', ' : '');
$query .= (!empty($this->CurPre['reason']) ? 'nukereason = ' . $this->db->escapeString($this->CurPre['reason']) . ', ' : '');
$query .= (!empty($this->CurPre['reqid']) ? 'requestID = ' . $this->CurPre['reqid'] . ', ' : '');
$query .= (!empty($this->CurPre['groupid']) ? 'groupID = ' . $this->CurPre['groupid'] . ', ' : '');
@@ -440,7 +445,8 @@ class IRCScraper extends IRCClient
'reqid' => '',
'nuked' => '',
'reason' => '',
'files' => ''
'files' => '',
'filename' => ''
);
}
}
-4
View File
@@ -1,4 +0,0 @@
# composer related
composer.lock
composer.phar
vendor
-334
View File
@@ -1,334 +0,0 @@
/**
* $Id$
* $Revision$
* $Author$
* $Date$
*/
v1.1.0:
------
fixes:
changes:
new:
- applied reconnect delay patch (sf.net patch #883820) from Ronald Hummelink <ronaldhummelink@users.sourceforge.net>
added setReconnectdelay() method, allows delay between reconnects. This reduces CPU load and prevents DoS.
- applied autoretry patch (sf.net patch #883821) from Ronald Hummelink <ronaldhummelink@users.sourceforge.net>
added setAutoRetryMax() method, makes connect retries cleaner.
- added send() method, can be used to send raw message to the IRC server.
v0.5.6:
------
fixes:
- renamed Net_SmartIRC_base::Net_SmartIRC to
Net_SmartIRC_base::Net_SmartIRC_base
a PHP4 bug made it work, in PHP5 its fixed and doesn't
(closes PEAR bug #1466, sf.net patch #967067)
- fixed a bug in _rawreceive()
the parser checked if he found a colon (messagepart) but +1 was added, the
check never worked right (I found this bug while porting SmartIRC to C#)
- fixed bug in _gettype()
the regexs was too sloppy, sometimes it got confused, this can break easily
the ChannelSync code.
- fixed bug in _event_rpl_whoreply()
on some IRC networks, the channel info in who replies can't be used, they
return sometimes random channels, this can break ChannelSync code.
- fixed include paths in example scripts (closes PEAR bug #2042)
changes:
- applied load socket extension patch (sf.net patch #911993) from
Anatoly Techtonik <techtonik@users.sourceforge.net>
if the socket extension is not loaded, it will now try to load it for *nix
and windows.
new:
- added objListenFor() method
it works like listenFor() but returns an array of the received ircdata
objects (not just ircdata->message like listenFor() does)
v0.5.5:
-------
fixes:
- fixed a bug in _rawreceive()
messages were parsed wrong which caused problems with kick reasons.
(thx to sniper for reporting this).
- fixed bug in message()
CTCP ACTION messages had missing \001 at the end.
- fixed a bug in quit(), which caused quit messages not to be sent to the server.
- fixed reconnect() bug, it sent the channel join requests right after connect(),
and tried to join a channel without a name.
- fixes in ChannelSync code
When a user joins a channel after SmartIRC, no WHO info is updated in the user object.
Fixed wrong update of channel mode when rpl_channelmodeis received.
Fixed bug in _mode() method, which caused wrong handling of mode changes.
Topic updates are now tracked (thanks to sniper).
Fixed bug which caused fatal errors with ChannelSync enabled
(closes sf.net bug #705269).
Fixed bug in _event_mode(), unhandled modes were stored wrong.
Fixed bug in _event_rpl_namreply(), which caused that the first char of the first nick
of a namreply got cut (closes sf.net bug #747832).
- fixed bug in _checktimer()
Which caused problems when a timehandler is unregistered.
- fixed _gettye()
It wasn't recognizing SMARTIRC_TYPE_ACTION.
- removed if(!$obj) check for newly created objects (closes PHP bug #24622),
required for PHP 4.1.2 compatibility.
changes:
- removed all irc commands from SmartIRC.php
they have now their own file (SmartIRC/irccommands.php).
- Net_SmartIRC_messagehandler class now extends Net_SmartIRC_irccommands.
- removed the 1. parameter (&$irc) of all message handlers, not needed anymore.
- renamed class Net_SmartIRC_user to Net_SmartIRC_channeluser,
added class Net_SmartIRC_ircuser.
- added prefix _event to all message handlers (needed because of class restructuring).
- tweaked filling of the ircdata objects.
- log() now checks the passed debug level bitwise.
- $data->message will be null instead of random garbage,
if the IRC message has no colon (the message part),
- All methods that depend on ChannelSync mode, checks if it's enabled.
- Optimized the usage of time() for $this->_lastrx.
- updated the URL of a SmartIRC based bot (atbs).
- _loggedin is now set to false when the socket is dead,
required for proper working reconnect().
- on a reconnect(), the logfile won't be overwritten anymore.
- updated phpdoc tags.
- all access to the channel array now uses strtolower() for the key.
- fixed typo in function name setChannelSynching(),
now it's called setChannelSyncing() with a BC wrapper.
- removed all SMARTIRC_ prefixes for debug output.
- changed isJoined($channel) to isJoined($channel, $nickname)
for checking if the specified user is joined.
- removed "destructors", because they don't free the memory.
new:
- added isOpped() isVoiced() isBanned().
- added debug output and debug level for the messageparser.
- reconnect() uses now the channel key if one exists.
- added channel key syncing in _mode().
- when an actionhandler message regex has a leading '/' then the regex is used as it is,
this allows complex perl regex's.
- added message type SMARTIRC_TYPE_CTCP_REQUEST and SMARTIRC_CTCP_REPLY for more advanced CTCP.
- added new log destinations SMARTIRC_NONE and SMARTIRC_BROWSEROUT
(for firendly browserouput). When the script is called from a browser,
the BROWSEROUT will automatic be used (closed sf.net bug #708155).
- added error handling for socket_select() in _rawreceive().
- added getMessage() to Net_SmartIRC_Error class.
- added debug level for ChannelSync code (SMARTIRC_DEBUG_CHANNELSYNCING).
- added filename and linenumber to debug output.
- added key property to channel class.
- added to all IRC commands optional $priority parameter with default value SMARTIRC_MEDIUM.
- added isError() for more advanced errorhandling, needed for encapsulation.
- added _isValidType() method, which checks for valid SMARTIRC_TYPE_* types.
v0.5.1
------
fixes:
- major bugs in ChannelSynching fixed.
- fsocks support fixed.
- setUseSocket() method fixed.
If false was passed as parameter, it tried to load the socket extension.
Also warnings are now suppressed with @ in front of dl().
- fixed a typo in reconnect().
- missing SMARTIRC_DEBUG_CHANNELSYNCHING constant added.
changes:
- new design for HTML documentation used (PEAR template).
- moved all examples to their own directory (examples/).
- moved the documentation to docs/HTML/.
- added new file descriptions to README.
- removed not needed parts of DOCUMENTATION (most is now in the HTML version).
- updated the HTML documentation.
new:
- example5/6/7.php added.
- setAutoRetry() method added.
Autoretrying of connecting to the IRC server, is now supported.
v0.5.0
------
fixes:
- fixed critical bug in the main _rawreceive() for() loop, messages were lost.
changes:
- License changed from GPL to LGPL.
- updated in all files the copyright year.
- changed documentation tags in front of all methods to the phpDocumentator compatible format.
- improved connect() errorhandling.
- changed login() parameters to $nick, $realname, $usermode = 0, $username = null, $password = null.
- changed join() parameters to $channelarray, $key = null.
- changed kick() parameters to $channel, $nicknamearray, $reason = null.
- changed listenFor() parameters to $messagetype
return value is now the result, instead the of a reference to the result parameter.
- sendbuffer has now 3 queues: high, medium and low
high sends 2 messages, then 1 of medium
low is only send if high _and_ medium is empty.
- select() call for sockets is strongly optimized
new:
- phpDocumentator package tags.
- include() for messagehandler.php (needed for the new API).
- setChannelSynching() method, for enabling the channel synching.
- setCtcpVersion() method, for changing the ctcp version reply string.
- setReceiveTimeout() method, for changing the receive timeout.
- setTransmitTimeout() method, for changing the transmit timeout.
- setAutoReconnect() method, for enabling the autoreconnect feature.
- channel variable, a reference to _channels because $object->channel("#chan")->topic is not possible in PHP4 (ZE1).
- reconnect() method, it will reconnect and also join all channels.
- channel() method, getting a reference to the channel, only if channelsynching is on.
- added ident, host, messageex and rawmessageex variables to the Net_SmartIRC_data class.
- class Net_SmartIRC_user, stores info about one user, only used if channelsynching is on.
- class Net_SmartIRC_channel, stores info about one channel, only used if channelsynching is on.
v0.4.0
------
* phpSmartIRCclass.inc.php:
- fixed serious socket bug
The buffer of the socket got full because only 512 bytes were read at once,
which caused losing some IRC messages that are comming fast like the MOTD.
Now it will read 10240 bytes at once, and doesn't loose any IRC message.
- fixed sendbuffer
The sendbuffer will only be sent, when the class is fully connected and
registered on the IRC network. Before if a nickname collision happened,
all sent IRC commands from the buffer were ignored by the IRC server.
- fixed socket status
Socket handling is now compatible with PHP 4.3 dev.
- fixed $_nick
When the nickname got changed because of nickname is already in use,
$_nick will be updated. (thanks for the hint to Andreas Streichardt).
- fixed actionhandler ids (unregister caused that the other ids were changed).
- fixed TYPE_TOPIC to the right bitoperator value.
- added a reference to the IRC class in actionhandler callbacks
WARNING: all user writtin methods have to be changed!!
method( &$data ) _has to be changed_ to method( &$irc, &$data )
If you don't change those, your IRC scripts will _not_ work anymore!
- changed internal methodnames to _methodname
- changed sendbuffer
Now it uses configurable senddelay, instead of static 2 messages
per second (send flood protection).
- changed TYPEs
All TYPE_* are now bitwise constants, register_actionhandler() can now
react to more than one message type.
- added TYPE_ACTION for those common /me messages.
- added timeevents Added method register_timehandler()
unregister_timeid() and reordertimehandler(). Those timehandler
can be used to call methods in specified intervalls, e.g. for
timeevents. Added needed class CphpSmartIRCclass_timehandler.
- moved all IRC related defines to defines.inc.php.
- changed if() elseif() structures where possible to switch() for
clearer/faster code.
- added more debug messages for actionhandler.
- added unregister_actionhandler() and unregister_actionid() method.
Also added needed reorderactionhandler(), which is called after an
unregister methods was called.
- added $data->channel to actionhandler callback.
* defines.inc.php:
- initial import.
- now all IRC related defines are now in this file instead of
phpSmartIRCclass.inc.php.
* DOCUMENTATION:
- updated/added methods description
* example.php:
- changed user function parameter to new style ( &$irc and &$data ).
- added TYPE_NOTICE to query_test example.
v0.3.2
------
* phpSmartIRCclass.inc.php:
- Replaced all quotes by single quote where possible for speedup.
- Added _disconnecttime for doing a clean IRC quit.
- Added Zend IDE style documentation for parameter variables types
and method descriptions.
- Spaces in nickname and username will be automaticly removed.
- Nicknamecollisions are automaticly detected and nickname will be
changed to nickname with 3 random numbers.
- New method nicknameuse().
- Fixed a serious fsock bug.
- Added new type TYPE_ERROR.
- Fixed wrong usage of & when calling methods with params that are
called by reference.
- Fixed a debug message "DEBUG: disconnected", now it will only
occur when debug mode is enabled.
- listen_for() will now do a quickdisconnect, for a big speedup.
- Changed logging system, now with debug levels, default is
DEBUG_NOTICE.
- Added benchmark system, now its possible to time things for doing
optimizations.
- New methods: benchmark(), benchmarktstart(), benchmarkend()
and show_benchmark() for the benchmark system
- Added microint(), for getting the microtime as float, needed for
the benchmarks.
- Added a couple of log() calls, for different debug levels.
- fsockets now runs in non blocking mode, because of broken?
getstatus for fsockets.
- Added mode() method, for chaning modes of a user or channel.
- Added op() and deop() method. Added ban() and unban() method
(thx for diff file to Peter Petermann).
* DOCUMENTATION:
- added documentation for new logging system
- added the whole DEBUG_* list
* HOWTO:
- changed parameter description for debug()
* example.php:
- replaced all quotes by singlequotes where possible.
- fixed wrong usage of message()
* example2.php:
- replaced all quotes by singlquotes where possible.
- added benchmark test to the example
v0.3.0
-----
* phpSmartIRCclass.inc.php:
- added "Ping? Pong!" log message for debugging
- added real linux/windows syslog logging
to setlogdestination().
- new method listen_for() makes it possible
to show irc related information on a homepage, like how many users
on a channel are.
* HOWTO:
- added how to run/call the selfwritten bot
* DOCUMENTATION:
- added (missing) explaination for new methods
* example2.php:
- new examplefile with the new listen_for() method
v0.2.6
------
* phpSmartIRCclass.inc.php:
- phpSmartIRCclass.inc renamed to
phpSmartIRCclass.inc.php because of security reasons
- changed function_exists() to get_loaded_extensions() for
checking if the PHP build has real socket support
- log() changed to create Linux style formated logs
- new methods for logging (daemon style)
log() for add log entries setlogdestination() can be STDOUT or FILE
setlogfile() sets the file
- changed received data processing in rawreceive()
* HOWTO:
- added a mini howto for using the class
* DOCUMENTATION:
- added class documentation of the project
* CREDITS:
- added credits file
v0.2.5
------
- improved socket handling
- bufferedsend fix
- new version number system
- cpu usage reduced
- added changelog file
-65
View File
@@ -1,65 +0,0 @@
/**
* $Id$
* $Revision$
* $Author$
* $Date$
*/
This is the creditslist for SmartIRC
The fields are:
(N) name
(E) email
(W) web-address
(P) PGP key ID and fingerprint
(D) description
(S) snail-mail address
---------------------------
N: Mirco 'meebey' Bauer
E: mail@meebey.net
E: meebey@php.net
W: www.meebey.net
P: 5051C9B9 / EF69 07A4 51AD 689E CF0C 767F CD9C 4C1A 5051 C9B9
D: Project Maintainer
S: Kroonhorst 42
S: 22549 Hamburg
S: Germany
N: Garrett Whitehorn
W: http://garrettw.net/
D: Project Maintainer as of 2014/02/04
N: Peter Petermann
E: webmaster@cyberfly.net
W: www.cyberfly.net
D: ban/unban diffs
N: Andreas Streichardt
E: mop@spaceregents.de
W: www.spaceregents.de
D: several hints for bugfixes
D: some patchfiles
N: Joern Heissler
E: joern@heissler.de
W: http://wulf.eu.org/
P: 57C76B66 / 6333 346F D7F4 928D 02B0 FDBF B398 EBC6 57C7 6B66
D: Quality Asurance (QA)
D: high improved concept for socket_select() handling
S: Willinghusener Weg 100
S: 21509 Glinde
S: Germany
N: Jani Taskinen
E: sniper@php.net
D: fixed several bugs
N: Ronald Hummelink
E: ronaldhummelink@users.sourceforge.net
D: reconnect delay patch (sf.net patch #883820)
D: autoretry patch (sf.net patch #883821)
N: Anatoly Techtonik
E: techtonik@users.sourceforge.net
D: load socket extension patch (sf.net patch #911993)
-61
View File
@@ -1,61 +0,0 @@
/**
* $Id$
* $Revision$
* $Author$
* $Date$
*/
Full featurelist of Net_SmartIRC
-------------------------------------
- full object-oriented programmed
- every received IRC message is parsed into an object
(containing the following info: from, nick, ident, host, channel, message, type, rawmessage)
- actionhandler for the API (on different types of messages [channel/notice/query/kick/join..], callbacks can be registered)
- messagehandler for the API (class-based messagehandling using IRC reply codes)
- time events (callbacks to methods in intervals)
- send/receive flood protection
- detects and changes nickname on nickname collisions
- auto-reconnect if connection is lost
- auto-retry for initially connecting to IRC servers
- debugging/logging system with log levels (destination can be file, stdout, syslog or browserout)
- supports fsocks and PHP socket extension
- supports PHP as old as 4.4.4 (but not for much longer)
- send buffer with a queue that has 3 priority levels (high, medium, low) plus a bypass level (critical)
- channel syncing (tracking of users/modes/topic etc in objects)
- user syncing (tracking the user in channels, nick/ident/host/realname/server/hopcount in objects)
- when channel syncing is activated, the following functions are available:
isJoined
isFounder
isAdmin
isOpped
isHopped
isVoiced
isBanned
- on reconnect all joined channels will be rejoined, even when keys are used
- own CTCP version reply can be set
- IRC commands:
pass
op
deop
voice
devoice
ban
unban
join
part
action
message
notice
query
ctcp
mode
topic
nick
invite
list
names
kick
who
whois
whowas
quit
-508
View File
@@ -1,508 +0,0 @@
/**
* $Id$
* $Revision$
* $Author$
* $Date$
*/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
File diff suppressed because it is too large Load Diff
-237
View File
@@ -1,237 +0,0 @@
<?php
/**
* $Id$
* $Revision$
* $Author$
* $Date$
*
* Copyright (c) 2002-2004 Mirco Bauer <meebey@meebey.net> <http://www.meebey.net>
*
* Full LGPL License: <http://www.gnu.org/licenses/lgpl.txt>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// don't change this! unless you know what you do
define('SMARTIRC_CRLF', "\r\n");
define('SMARTIRC_UNUSED', '*');
define('SMARTIRC_STDOUT', 0);
define('SMARTIRC_FILE', 1);
define('SMARTIRC_SYSLOG', 2);
define('SMARTIRC_BROWSEROUT', 3);
define('SMARTIRC_NONE', 4);
define('SMARTIRC_LOW', 0);
define('SMARTIRC_MEDIUM', 1);
define('SMARTIRC_HIGH', 2);
define('SMARTIRC_CRITICAL', 3);
define('SMARTIRC_STATE_DISCONNECTED', 0);
define('SMARTIRC_STATE_CONNECTING', 1);
define('SMARTIRC_STATE_CONNECTED', 2);
define('SMARTIRC_DEBUG_NONE', 0);
define('SMARTIRC_DEBUG_NOTICE', 1);
define('SMARTIRC_DEBUG_CONNECTION', 2);
define('SMARTIRC_DEBUG_SOCKET', 4);
define('SMARTIRC_DEBUG_IRCMESSAGES', 8);
define('SMARTIRC_DEBUG_MESSAGETYPES', 16);
define('SMARTIRC_DEBUG_ACTIONHANDLER', 32);
define('SMARTIRC_DEBUG_TIMEHANDLER', 64);
define('SMARTIRC_DEBUG_MESSAGEHANDLER', 128);
define('SMARTIRC_DEBUG_CHANNELSYNCING', 256);
define('SMARTIRC_DEBUG_MODULES', 512);
define('SMARTIRC_DEBUG_USERSYNCING', 1024);
define('SMARTIRC_DEBUG_MESSAGEPARSER', 2048);
define('SMARTIRC_DEBUG_DCC', 4096);
define('SMARTIRC_DEBUG_ALL', 8191);
define('SMARTIRC_TYPE_UNKNOWN', 1);
define('SMARTIRC_TYPE_CHANNEL', 2);
define('SMARTIRC_TYPE_QUERY', 4);
define('SMARTIRC_TYPE_CTCP', 8);
define('SMARTIRC_TYPE_NOTICE', 16);
define('SMARTIRC_TYPE_WHO', 32);
define('SMARTIRC_TYPE_JOIN', 64);
define('SMARTIRC_TYPE_INVITE', 128);
define('SMARTIRC_TYPE_ACTION', 256);
define('SMARTIRC_TYPE_TOPICCHANGE', 512);
define('SMARTIRC_TYPE_NICKCHANGE', 1024);
define('SMARTIRC_TYPE_KICK', 2048);
define('SMARTIRC_TYPE_QUIT', 4096);
define('SMARTIRC_TYPE_LOGIN', 8192);
define('SMARTIRC_TYPE_INFO', 16384);
define('SMARTIRC_TYPE_LIST', 32768);
define('SMARTIRC_TYPE_NAME', 65536);
define('SMARTIRC_TYPE_MOTD', 131072);
define('SMARTIRC_TYPE_MODECHANGE', 262144);
define('SMARTIRC_TYPE_PART', 524288);
define('SMARTIRC_TYPE_ERROR', 1048576);
define('SMARTIRC_TYPE_BANLIST', 2097152);
define('SMARTIRC_TYPE_TOPIC', 4194304);
define('SMARTIRC_TYPE_NONRELEVANT', 8388608);
define('SMARTIRC_TYPE_WHOIS', 16777216);
define('SMARTIRC_TYPE_WHOWAS', 33554432);
define('SMARTIRC_TYPE_USERMODE', 67108864);
define('SMARTIRC_TYPE_CHANNELMODE', 134217728);
define('SMARTIRC_TYPE_CTCP_REQUEST', 268435456);
define('SMARTIRC_TYPE_CTCP_REPLY', 536870912);
//define('SMARTIRC_TYPE_DCC', 536870912);
define('SMARTIRC_TYPE_ALL', 1073741823);
$SMARTIRC_replycodes = array(
'RPL_WELCOME' => '001',
'RPL_YOURHOST' => '002',
'RPL_CREATED' => '003',
'RPL_MYINFO' => '004',
'RPL_BOUNCE' => '005',
'RPL_TRACELINK' => '200',
'RPL_TRACECONNECTING' => '201',
'RPL_TRACEHANDSHAKE' => '202',
'RPL_TRACEUNKNOWN' => '203',
'RPL_TRACEOPERATOR' => '204',
'RPL_TRACEUSER' => '205',
'RPL_TRACESERVER' => '206',
'RPL_TRACESERVICE' => '207',
'RPL_TRACENEWTYPE' => '208',
'RPL_TRACECLASS' => '209',
'RPL_TRACERECONNECT' => '210',
'RPL_STATSLINKINFO' => '211',
'RPL_STATSCOMMANDS' => '212',
'RPL_ENDOFSTATS' => '219',
'RPL_UMODEIS' => '221',
'RPL_SERVLIST' => '234',
'RPL_SERVLISTEND' => '235',
'RPL_STATSUPTIME' => '242',
'RPL_STATSOLINE' => '243',
'RPL_LUSERCLIENT' => '251',
'RPL_LUSEROP' => '252',
'RPL_LUSERUNKNOWN' => '253',
'RPL_LUSERCHANNELS' => '254',
'RPL_LUSERME' => '255',
'RPL_ADMINME' => '256',
'RPL_ADMINLOC1' => '257',
'RPL_ADMINLOC2' => '258',
'RPL_ADMINEMAIL' => '259',
'RPL_TRACELOG' => '261',
'RPL_TRACEEND' => '262',
'RPL_TRYAGAIN' => '263',
'RPL_AWAY' => '301',
'RPL_USERHOST' => '302',
'RPL_ISON' => '303',
'RPL_UNAWAY' => '305',
'RPL_NOWAWAY' => '306',
'RPL_WHOISUSER' => '311',
'RPL_WHOISSERVER' => '312',
'RPL_WHOISOPERATOR' => '313',
'RPL_WHOWASUSER' => '314',
'RPL_ENDOFWHO' => '315',
'RPL_WHOISIDLE' => '317',
'RPL_ENDOFWHOIS' => '318',
'RPL_WHOISCHANNELS' => '319',
'RPL_LISTSTART' => '321',
'RPL_LIST' => '322',
'RPL_LISTEND' => '323',
'RPL_CHANNELMODEIS' => '324',
'RPL_UNIQOPIS' => '325',
'RPL_NOTOPIC' => '331',
'RPL_TOPIC' => '332',
'RPL_INVITING' => '341',
'RPL_SUMMONING' => '342',
'RPL_INVITELIST' => '346',
'RPL_ENDOFINVITELIST' => '347',
'RPL_EXCEPTLIST' => '348',
'RPL_ENDOFEXCEPTLIST' => '349',
'RPL_VERSION' => '351',
'RPL_WHOREPLY' => '352',
'RPL_NAMREPLY' => '353',
'RPL_LINKS' => '364',
'RPL_ENDOFLINKS' => '365',
'RPL_ENDOFNAMES' => '366',
'RPL_BANLIST' => '367',
'RPL_ENDOFBANLIST' => '368',
'RPL_ENDOFWHOWAS' => '369',
'RPL_INFO' => '371',
'RPL_MOTD' => '372',
'RPL_ENDOFINFO' => '374',
'RPL_MOTDSTART' => '375',
'RPL_ENDOFMOTD' => '376',
'RPL_YOUREOPER' => '381',
'RPL_REHASHING' => '382',
'RPL_YOURESERVICE' => '383',
'RPL_TIME' => '391',
'RPL_USERSSTART' => '392',
'RPL_USERS' => '393',
'RPL_ENDOFUSERS' => '394',
'RPL_NOUSERS' => '395',
'ERR_NOSUCHNICK' => '401',
'ERR_NOSUCHSERVER' => '402',
'ERR_NOSUCHCHANNEL' => '403',
'ERR_CANNOTSENDTOCHAN' => '404',
'ERR_TOOMANYCHANNELS' => '405',
'ERR_WASNOSUCHNICK' => '406',
'ERR_TOOMANYTARGETS' => '407',
'ERR_NOSUCHSERVICE' => '408',
'ERR_NOORIGIN' => '409',
'ERR_NORECIPIENT' => '411',
'ERR_NOTEXTTOSEND' => '412',
'ERR_NOTOPLEVEL' => '413',
'ERR_WILDTOPLEVEL' => '414',
'ERR_BADMASK' => '415',
'ERR_UNKNOWNCOMMAND' => '421',
'ERR_NOMOTD' => '422',
'ERR_NOADMININFO' => '423',
'ERR_FILEERROR' => '424',
'ERR_NONICKNAMEGIVEN' => '431',
'ERR_ERRONEUSNICKNAME' => '432',
'ERR_NICKNAMEINUSE' => '433',
'ERR_NICKCOLLISION' => '436',
'ERR_UNAVAILRESOURCE' => '437',
'ERR_USERNOTINCHANNEL' => '441',
'ERR_NOTONCHANNEL' => '442',
'ERR_USERONCHANNEL' => '443',
'ERR_NOLOGIN' => '444',
'ERR_SUMMONDISABLED' => '445',
'ERR_USERSDISABLED' => '446',
'ERR_NOTREGISTERED' => '451',
'ERR_NEEDMOREPARAMS' => '461',
'ERR_ALREADYREGISTRED' => '462',
'ERR_NOPERMFORHOST' => '463',
'ERR_PASSWDMISMATCH' => '464',
'ERR_YOUREBANNEDCREEP' => '465',
'ERR_YOUWILLBEBANNED' => '466',
'ERR_KEYSET' => '467',
'ERR_CHANNELISFULL' => '471',
'ERR_UNKNOWNMODE' => '472',
'ERR_INVITEONLYCHAN' => '473',
'ERR_BANNEDFROMCHAN' => '474',
'ERR_BADCHANNELKEY' => '475',
'ERR_BADCHANMASK' => '476',
'ERR_NOCHANMODES' => '477',
'ERR_BANLISTFULL' => '478',
'ERR_NOPRIVILEGES' => '481',
'ERR_CHANOPRIVSNEEDED' => '482',
'ERR_CANTKILLSERVER' => '483',
'ERR_RESTRICTED' => '484',
'ERR_UNIQOPPRIVSNEEDED' => '485',
'ERR_NOOPERHOST' => '491',
'ERR_UMODEUNKNOWNFLAG' => '501',
'ERR_USERSDONTMATCH' => '502',
);
$SMARTIRC_nreplycodes = array();
foreach ($SMARTIRC_replycodes as $key => $value) {
define('SMARTIRC_'.$key, $value);
$SMARTIRC_nreplycodes[$value] = $key;
}
?>
@@ -1,526 +0,0 @@
<?php
/**
* $Id$
* $Revision$
* $Author$
* $Date$
*
* Copyright (c) 2002-2004 Mirco Bauer <meebey@meebey.net> <http://www.meebey.net>
*
* Full LGPL License: <http://www.gnu.org/licenses/lgpl.txt>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
class Net_SmartIRC_irccommands extends Net_SmartIRC_base
{
/**
* sends a new message
*
* Sends a message to a channel or user.
*
* @see DOCUMENTATION
* @param integer $type specifies the type, like QUERY/ACTION or CTCP see 'Message Types'
* @param string $destination can be a user or channel
* @param mixed $message the message
* @return boolean
* @access public
*/
function message($type, $destination, $messagearray, $priority = SMARTIRC_MEDIUM)
{
if (!is_array($messagearray)) {
$messagearray = array($messagearray);
}
switch ($type) {
case SMARTIRC_TYPE_CHANNEL:
case SMARTIRC_TYPE_QUERY:
foreach ($messagearray as $message) {
$this->_send('PRIVMSG '.$destination.' :'.$message, $priority);
}
break;
case SMARTIRC_TYPE_ACTION:
foreach ($messagearray as $message) {
$this->_send('PRIVMSG '.$destination.' :'.chr(1).'ACTION '.$message.chr(1), $priority);
}
break;
case SMARTIRC_TYPE_NOTICE:
foreach ($messagearray as $message) {
$this->_send('NOTICE '.$destination.' :'.$message, $priority);
}
break;
case SMARTIRC_TYPE_CTCP: // backwards compatibilty
case SMARTIRC_TYPE_CTCP_REPLY:
foreach ($messagearray as $message) {
$this->_send('NOTICE '.$destination.' :'.chr(1).$message.chr(1), $priority);
}
break;
case SMARTIRC_TYPE_CTCP_REQUEST:
foreach ($messagearray as $message) {
$this->_send('PRIVMSG '.$destination.' :'.chr(1).$message.chr(1), $priority);
}
break;
default:
return false;
}
return true;
}
/**
* returns an object reference to the specified channel
*
* If the channel does not exist (because not joint) false will be returned.
*
* @param string $channelname
* @return object reference to the channel object
* @access public
*/
function &channel($channelname)
{
if (isset($this->_channels[strtolower($channelname)])) {
return $this->_channels[strtolower($channelname)];
} else {
return false;
}
}
// <IRC methods>
/**
* Joins one or more IRC channels with an optional key.
*
* @NOTE MODIFIED BY NZEDB TO ACCEPT PASSWORD PER CHANNEL.
*
* @param array $channelarray ; array('#channelname1' => 'password', '#channelname2' => null);
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return bool
* @access public
*/
function join($channelarray, $priority = SMARTIRC_MEDIUM)
{
foreach ($channelarray as $channel => $password) {
$this->_send('JOIN ' . $channel . ($password === null ? '' : ' ' . $password), $priority);
}
return true;
}
/**
* parts from one or more IRC channels with an optional reason
*
* @param mixed $channelarray
* @param string $reason
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function part($channelarray, $reason = null, $priority = SMARTIRC_MEDIUM)
{
if (!is_array($channelarray)) {
$channelarray = array($channelarray);
}
$channellist = implode(',', $channelarray);
if ($reason !== null) {
$this->_send('PART '.$channellist.' :'.$reason, $priority);
} else {
$this->_send('PART '.$channellist, $priority);
}
}
/**
* Kicks one or more user from an IRC channel with an optional reason.
*
* @param string $channel
* @param mixed $nicknamearray
* @param string $reason
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function kick($channel, $nicknamearray, $reason = null, $priority = SMARTIRC_MEDIUM)
{
if (!is_array($nicknamearray)) {
$nicknamearray = array($nicknamearray);
}
$nicknamelist = implode(',', $nicknamearray);
if ($reason !== null) {
$this->_send('KICK '.$channel.' '.$nicknamelist.' :'.$reason, $priority);
} else {
$this->_send('KICK '.$channel.' '.$nicknamelist, $priority);
}
}
/**
* gets a list of one ore more channels
*
* Requests a full channellist if $channelarray is not given.
* (use it with care, usualy its a looooong list)
*
* @param mixed $channelarray
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function getList($channelarray = null, $priority = SMARTIRC_MEDIUM)
{
if ($channelarray !== null) {
if (!is_array($channelarray)) {
$channelarray = array($channelarray);
}
$channellist = implode(',', $channelarray);
$this->_send('LIST '.$channellist, $priority);
} else {
$this->_send('LIST', $priority);
}
}
/**
* requests all nicknames of one or more channels
*
* The requested nickname list also includes op and voice state
*
* @param mixed $channelarray
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function names($channelarray = null, $priority = SMARTIRC_MEDIUM)
{
if ($channelarray !== null) {
if (!is_array($channelarray)) {
$channelarray = array($channelarray);
}
$channellist = implode(',', $channelarray);
$this->_send('NAMES '.$channellist, $priority);
} else {
$this->_send('NAMES', $priority);
}
}
/**
* sets a new topic of a channel
*
* @param string $channel
* @param string $newtopic
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function setTopic($channel, $newtopic, $priority = SMARTIRC_MEDIUM)
{
$this->_send('TOPIC '.$channel.' :'.$newtopic, $priority);
}
/**
* gets the topic of a channel
*
* @param string $channel
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function getTopic($channel, $priority = SMARTIRC_MEDIUM)
{
$this->_send('TOPIC '.$channel, $priority);
}
/**
* sets or gets the mode of an user or channel
*
* Changes/requests the mode of the given target.
*
* @param string $target the target, can be an user (only yourself) or a channel
* @param string $newmode the new mode like +mt
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function mode($target, $newmode = null, $priority = SMARTIRC_MEDIUM)
{
if ($newmode !== null) {
$this->_send('MODE '.$target.' '.$newmode, $priority);
} else {
$this->_send('MODE '.$target, $priority);
}
}
/**
* founders an user in the given channel
*
* @param string $channel
* @param string $nickname
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function founder($channel, $nickname, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '+q '.$nickname, $priority);
}
/**
* defounders an user in the given channel
*
* @param string $channel
* @param string $nickname
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function defounder($channel, $nickname, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '-q '.$nickname, $priority);
}
/**
* admins an user in the given channel
*
* @param string $channel
* @param string $nickname
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function admin($channel, $nickname, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '+a '.$nickname, $priority);
}
/**
* deadmins an user in the given channel
*
* @param string $channel
* @param string $nickname
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function deadmin($channel, $nickname, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '-a '.$nickname, $priority);
}
/**
* ops an user in the given channel
*
* @param string $channel
* @param string $nickname
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function op($channel, $nickname, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '+o '.$nickname, $priority);
}
/**
* deops an user in the given channel
*
* @param string $channel
* @param string $nickname
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function deop($channel, $nickname, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '-o '.$nickname, $priority);
}
/**
* hops an user in the given channel
*
* @param string $channel
* @param string $nickname
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function hop($channel, $nickname, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '+h '.$nickname, $priority);
}
/**
* dehops an user in the given channel
*
* @param string $channel
* @param string $nickname
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function dehop($channel, $nickname, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '-h '.$nickname, $priority);
}
/**
* voice a user in the given channel
*
* @param string $channel
* @param string $nickname
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function voice($channel, $nickname, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '+v '.$nickname, $priority);
}
/**
* devoice a user in the given channel
*
* @param string $channel
* @param string $nickname
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function devoice($channel, $nickname, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '-v '.$nickname, $priority);
}
/**
* bans a hostmask for the given channel or requests the current banlist
*
* The banlist will be requested if no hostmask is specified
*
* @param string $channel
* @param string $hostmask
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function ban($channel, $hostmask = null, $priority = SMARTIRC_MEDIUM)
{
if ($hostmask !== null) {
$this->mode($channel, '+b '.$hostmask, $priority);
} else {
$this->mode($channel, 'b', $priority);
}
}
/**
* unbans a hostmask on the given channel
*
* @param string $channel
* @param string $hostmask
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function unban($channel, $hostmask, $priority = SMARTIRC_MEDIUM)
{
$this->mode($channel, '-b '.$hostmask, $priority);
}
/**
* invites a user to the specified channel
*
* @param string $nickname
* @param string $channel
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function invite($nickname, $channel, $priority = SMARTIRC_MEDIUM)
{
$this->_send('INVITE '.$nickname.' '.$channel, $priority);
}
/**
* changes the own nickname
*
* Trys to set a new nickname, nickcollisions are handled.
*
* @param string $newnick
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function changeNick($newnick, $priority = SMARTIRC_MEDIUM)
{
$this->_send('NICK '.$newnick, $priority);
$this->_nick = $newnick;
}
/**
* requests a 'WHO' from the specified target
*
* @param string $target
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function who($target, $priority = SMARTIRC_MEDIUM)
{
$this->_send('WHO '.$target, $priority);
}
/**
* requests a 'WHOIS' from the specified target
*
* @param string $target
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function whois($target, $priority = SMARTIRC_MEDIUM)
{
$this->_send('WHOIS '.$target, $priority);
}
/**
* requests a 'WHOWAS' from the specified target
* (if he left the IRC network)
*
* @param string $target
* @param integer $priority message priority, default is SMARTIRC_MEDIUM
* @return void
* @access public
*/
function whowas($target, $priority = SMARTIRC_MEDIUM)
{
$this->_send('WHOWAS '.$target, $priority);
}
/**
* sends QUIT to IRC server and disconnects
*
* @param string $quitmessage optional quitmessage
* @param integer $priority message priority, default is SMARTIRC_CRITICAL
* @return void
* @access public
*/
function quit($quitmessage = null, $priority = SMARTIRC_CRITICAL)
{
if ($quitmessage !== null) {
$this->_send('QUIT :'.$quitmessage, $priority);
} else {
$this->_send('QUIT', $priority);
}
$this->disconnect(true);
}
}
@@ -1,526 +0,0 @@
<?php
/**
* $Id$
* $Revision$
* $Author$
* $Date$
*
* Copyright (c) 2002-2004 Mirco Bauer <meebey@meebey.net> <http://www.meebey.net>
*
* Full LGPL License: <http://www.gnu.org/licenses/lgpl.txt>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
class Net_SmartIRC_messagehandler extends Net_SmartIRC_irccommands
{
/* misc */
function _event_ping(&$ircdata)
{
$this->_pong(substr($ircdata->rawmessage, 5));
}
function _event_error(&$ircdata)
{
if ($this->_autoretry == true) {
$this->_delayReconnect();
$this->reconnect();
} else {
$this->disconnect(true);
}
}
function _event_join(&$ircdata)
{
if ($this->_channelsyncing == true) {
if ($this->_nick == $ircdata->nick) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: joining channel: '.$ircdata->channel, __FILE__, __LINE__);
$channel = new Net_SmartIRC_channel();
$channel->name = $ircdata->channel;
$microint = $this->_microint();
$channel->synctime_start = $microint;
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: synctime_start for '.$ircdata->channel.' set to: '.$microint, __FILE__, __LINE__);
$this->_channels[strtolower($channel->name)] = &$channel;
// the class will get his own who data from the whole who channel list
$this->mode($channel->name);
$this->who($channel->name);
$this->ban($channel->name);
} else {
// the class didn't join but someone else, lets get his who data
$this->who($ircdata->nick);
}
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: '.$ircdata->nick.' joins channel: '.$ircdata->channel, __FILE__, __LINE__);
$channel = &$this->_channels[strtolower($ircdata->channel)];
$user = new Net_SmartIRC_channeluser();
$user->nick = $ircdata->nick;
$user->ident = $ircdata->ident;
$user->host = $ircdata->host;
$this->_adduser($channel, $user);
}
}
function _event_part(&$ircdata)
{
if ($this->_channelsyncing == true) {
$this->_removeuser($ircdata);
}
}
function _event_kick(&$ircdata)
{
if ($this->_channelsyncing == true) {
$this->_removeuser($ircdata);
}
}
function _event_quit(&$ircdata)
{
if ($this->_channelsyncing == true) {
$this->_removeuser($ircdata);
}
}
function _event_nick(&$ircdata)
{
if ($this->_channelsyncing == true) {
$newnick = $ircdata->rawmessageex[2];
$lowerednewnick = strtolower($newnick);
$lowerednick = strtolower($ircdata->nick);
$channelkeys = array_keys($this->_channels);
foreach ($channelkeys as $channelkey) {
// loop through all channels
$channel = &$this->_channels[$channelkey];
foreach ($channel->users as $uservalue) {
// loop through all user in this channel
if ($ircdata->nick == $uservalue->nick) {
// found him
// time for updating the object and his nickname
$channel->users[$lowerednewnick] = $channel->users[$lowerednick];
$channel->users[$lowerednewnick]->nick = $newnick;
if ($lowerednewnick != $lowerednick) {
unset($channel->users[$lowerednick]);
}
// he was maybe op or voice, update comming
if (isset($channel->founders[$ircdata->nick])) {
$channel->founders[$newnick] = $channel->founders[$ircdata->nick];
unset($channel->founders[$ircdata->nick]);
}
if (isset($channel->admins[$ircdata->nick])) {
$channel->admins[$newnick] = $channel->admins[$ircdata->nick];
unset($channel->admins[$ircdata->nick]);
}
if (isset($channel->ops[$ircdata->nick])) {
$channel->ops[$newnick] = $channel->ops[$ircdata->nick];
unset($channel->ops[$ircdata->nick]);
}
if (isset($channel->hops[$ircdata->nick])) {
$channel->hops[$newnick] = $channel->hops[$ircdata->nick];
unset($channel->hops[$ircdata->nick]);
}
if (isset($channel->voices[$ircdata->nick])) {
$channel->voices[$newnick] = $channel->voices[$ircdata->nick];
unset($channel->voices[$ircdata->nick]);
}
break;
}
}
}
}
}
function _event_mode(&$ircdata)
{
// check if its own usermode
if ($ircdata->rawmessageex[2] == $this->_nick) {
$this->_usermode = substr($ircdata->rawmessageex[3], 1);
} else if ($this->_channelsyncing == true) {
// it's not, and we do channel syching
$channel = &$this->_channels[strtolower($ircdata->channel)];
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: updating channel mode for: '.$channel->name, __FILE__, __LINE__);
$mode = $ircdata->rawmessageex[3];
$parameters = array_slice($ircdata->rawmessageex, 4);
$add = false;
$remove = false;
$modelength = strlen($mode);
for ($i = 0; $i < $modelength; $i++) {
switch($mode[$i]) {
case '-':
$remove = true;
$add = false;
break;
case '+':
$add = true;
$remove = false;
break;
// user modes
case 'q':
$nick = array_shift($parameters);
$lowerednick = strtolower($nick);
if ($add) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: adding founder: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
$channel->founders[$nick] = true;
$channel->users[$lowerednick]->founder = true;
}
if ($remove) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removing founder: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
unset($channel->founders[$nick]);
$channel->users[$lowerednick]->founder = false;
}
break;
case 'a':
$nick = array_shift($parameters);
$lowerednick = strtolower($nick);
if ($add) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: adding admin: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
$channel->admins[$nick] = true;
$channel->users[$lowerednick]->admin = true;
}
if ($remove) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removing admin: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
unset($channel->admins[$nick]);
$channel->users[$lowerednick]->admin = false;
}
break;
case 'o':
$nick = array_shift($parameters);
$lowerednick = strtolower($nick);
if ($add) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: adding op: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
$channel->ops[$nick] = true;
$channel->users[$lowerednick]->op = true;
}
if ($remove) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removing op: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
unset($channel->ops[$nick]);
$channel->users[$lowerednick]->op = false;
}
break;
case 'h':
$nick = array_shift($parameters);
$lowerednick = strtolower($nick);
if ($add) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: adding half-op: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
$channel->hops[$nick] = true;
$channel->users[$lowerednick]->hop = true;
}
if ($remove) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removing half-op: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
unset($channel->hops[$nick]);
$channel->users[$lowerednick]->hop = false;
}
break;
case 'v':
$nick = array_shift($parameters);
$lowerednick = strtolower($nick);
if ($add) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: adding voice: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
$channel->voices[$nick] = true;
$channel->users[$lowerednick]->voice = true;
}
if ($remove) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removing voice: '.$nick.' to channel: '.$channel->name, __FILE__, __LINE__);
unset($channel->voices[$nick]);
$channel->users[$lowerednick]->voice = false;
}
break;
case 'k':
$key = array_shift($parameters);
if ($add) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: stored channel key for: '.$channel->name, __FILE__, __LINE__);
$channel->key = $key;
}
if ($remove) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removed channel key for: '.$channel->name, __FILE__, __LINE__);
$channel->key = '';
}
break;
case 'l':
if ($add) {
$limit = array_shift($parameters);
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: stored user limit for: '.$channel->name, __FILE__, __LINE__);
$channel->user_limit = $limit;
}
if ($remove) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removed user limit for: '.$channel->name, __FILE__, __LINE__);
$channel->user_limit = false;
}
break;
default:
// channel modes
if ($mode[$i] == 'b') {
$hostmask = array_shift($parameters);
if ($add) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: adding ban: '.$hostmask.' for: '.$channel->name, __FILE__, __LINE__);
$channel->bans[$hostmask] = true;
}
if ($remove) {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: removing ban: '.$hostmask.' for: '.$channel->name, __FILE__, __LINE__);
unset($channel->bans[$hostmask]);
}
} else {
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: storing unknown channelmode ('.$mode.') in channel->mode for: '.$channel->name, __FILE__, __LINE__);
if ($add) {
$channel->mode .= $mode[$i];
}
if ($remove) {
$channel->mode = str_replace($mode[$i], '', $channel->mode);
}
}
}
}
}
}
function _event_topic(&$ircdata)
{
if ($this->_channelsyncing == true) {
$channel = &$this->_channels[strtolower($ircdata->rawmessageex[2])];
$channel->topic = $ircdata->message;
}
}
function _event_privmsg(&$ircdata)
{
if ($ircdata->type & SMARTIRC_TYPE_CTCP_REQUEST) {
// substr must be 1,4 because of \001 in CTCP messages
if (substr($ircdata->message, 1, 4) == 'PING') {
$this->message(SMARTIRC_TYPE_CTCP_REPLY, $ircdata->nick, 'PING '.substr($ircdata->message, 5, -1));
} elseif (substr($ircdata->message, 1, 7) == 'VERSION') {
if (!empty($this->_ctcpversion)) {
$versionstring = $this->_ctcpversion;
} else {
$versionstring = SMARTIRC_VERSIONSTRING;
}
$this->message(SMARTIRC_TYPE_CTCP_REPLY, $ircdata->nick, 'VERSION '.$versionstring);
} elseif (substr($ircdata->message, 1, 10) == 'CLIENTINFO') {
$this->message(SMARTIRC_TYPE_CTCP_REPLY, $ircdata->nick, 'CLIENTINFO PING VERSION CLIENTINFO');
}
}
}
/* rpl_ */
function _event_rpl_welcome(&$ircdata)
{
$this->_loggedin = true;
$this->log(SMARTIRC_DEBUG_CONNECTION, 'DEBUG_CONNECTION: logged in', __FILE__, __LINE__);
// updating our nickname, that we got (maybe cutted...)
$this->_nick = $ircdata->rawmessageex[2];
}
function _event_rpl_motdstart(&$ircdata)
{
$this->_motd[] = $ircdata->message;
}
function _event_rpl_motd(&$ircdata)
{
$this->_motd[] = $ircdata->message;
}
function _event_rpl_endofmotd(&$ircdata)
{
$this->_motd[] = $ircdata->message;
}
function _event_rpl_umodeis(&$ircdata)
{
$this->_usermode = $ircdata->message;
}
function _event_rpl_channelmodeis(&$ircdata) {
if ($this->_channelsyncing == true && $this->isJoined($ircdata->channel)) {
$mode = $ircdata->rawmessageex[4];
$parameters = array_slice($ircdata->rawmessageex, 5);
$ircdata->rawmessageex = array( 0 => '',
1 => '',
2 => '',
3 => $mode);
foreach ($parameters as $value) {
$ircdata->rawmessageex[] = $value;
}
// let _mode() handle the received mode
$this->_event_mode($ircdata);
}
}
function _event_rpl_whoreply(&$ircdata)
{
if ($this->_channelsyncing == true) {
$nick = $ircdata->rawmessageex[7];
if ($ircdata->channel == '*') {
// we got who info without channel info, so we need to search the user
// on all channels and update him
foreach ($this->_channels as $channel) {
if ($this->isJoined($channel->name, $nick)) {
$ircdata->channel = $channel->name;
$this->_event_rpl_whoreply($ircdata);
}
}
} else {
if (!$this->isJoined($ircdata->channel, $nick)) {
return;
}
$channel = &$this->_channels[strtolower($ircdata->channel)];
$user = new Net_SmartIRC_channeluser();
$user->ident = $ircdata->rawmessageex[4];
$user->host = $ircdata->rawmessageex[5];
$user->server = $ircdata->rawmessageex[6];
$user->nick = $ircdata->rawmessageex[7];
$user->ircop = false;
$user->founder = false;
$user->admin = false;
$user->op = false;
$user->hop = false;
$user->voice = false;
$usermode = $ircdata->rawmessageex[8];
$usermodelength = strlen($usermode);
for ($i = 0; $i < $usermodelength; $i++) {
switch ($usermode[$i]) {
case 'H':
$user->away = false;
break;
case 'G':
$user->away = true;
break;
case '*':
$user->ircop = true;
break;
case '~':
$user->founder = true;
break;
case '&':
$user->admin = true;
break;
case '@':
$user->op = true;
break;
case '%':
$user->hop = true;
break;
case '+':
$user->voice = true;
break;
}
$user->modes .= $usermode[$i];
}
$user->hopcount = substr($ircdata->rawmessageex[9], 1);
$user->realname = implode(array_slice($ircdata->rawmessageex, 10), ' ');
$this->_adduser($channel, $user);
}
}
}
function _event_rpl_namreply(&$ircdata)
{
if ($this->_channelsyncing == true) {
$channel = &$this->_channels[strtolower($ircdata->channel)];
$userarray = explode(' ', rtrim($ircdata->message));
$userarraycount = count($userarray);
for ($i = 0; $i < $userarraycount; $i++) {
$user = new Net_SmartIRC_channeluser();
$usermode = substr($userarray[$i], 0, 1);
switch ($usermode) {
case '~':
$user->founder = true;
$user->nick = substr($userarray[$i], 1);
break;
case '&':
$user->admin = true;
$user->nick = substr($userarray[$i], 1);
break;
case '@':
$user->op = true;
$user->nick = substr($userarray[$i], 1);
break;
case '%':
$user->hop = true;
$user->nick = substr($userarray[$i], 1);
break;
case '+':
$user->voice = true;
$user->nick = substr($userarray[$i], 1);
break;
default:
$user->nick = $userarray[$i];
}
$user->modes .= $usermode[$i];
$this->_adduser($channel, $user);
}
}
}
function _event_rpl_banlist(&$ircdata)
{
if ($this->_channelsyncing == true && $this->isJoined($ircdata->channel)) {
$channel = &$this->_channels[strtolower($ircdata->channel)];
$hostmask = $ircdata->rawmessageex[4];
$channel->bans[$hostmask] = true;
}
}
function _event_rpl_endofbanlist(&$ircdata)
{
if ($this->_channelsyncing == true && $this->isJoined($ircdata->channel)) {
$channel = &$this->getChannel($ircdata->channel);
if ($channel->synctime_stop == 0) {
// we received end of banlist and the stop timestamp is not set yet
$microint = $this->_microint();
$channel->synctime_stop = $microint;
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: synctime_stop for '.$ircdata->channel.' set to: '.$microint, __FILE__, __LINE__);
$channel->synctime = ((float)$channel->synctime_stop - (float)$channel->synctime_start);
$this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: synced channel '.$ircdata->channel.' in '.round($channel->synctime, 2).' secs', __FILE__, __LINE__);
}
}
}
function _event_rpl_topic(&$ircdata)
{
if ($this->_channelsyncing == true) {
$channel = &$this->_channels[strtolower($ircdata->channel)];
$topic = substr(implode(array_slice($ircdata->rawmessageex, 4), ' '), 1);
$channel->topic = $topic;
}
}
/* err_ */
function _event_err_nicknameinuse(&$ircdata)
{
$this->_nicknameinuse();
}
}
-88
View File
@@ -1,88 +0,0 @@
/**
* $Id$
* $Revision$
* $Author$
* $Date$
*/
Net_SmartIRC
----------------
What is this?
Net_SmartIRC is a PHP class for communication with IRC networks conforming to
RFC 2812 -- an API that handles all IRC protocol messages. This class is
designed for creating IRC bots, chatting, and showing IRC-related info on
web pages.
official PEAR package page:
https://pear.php.net/package/Net_SmartIRC/
files included in SmartIRC
--------------------------
SmartIRC.php
The class itself.
FEATURES
A full list of features that SmartIRC includes
CHANGELOG
Listing of changes between all versions.
README
this file
LICENSE
The license of Net_SmartIRC.
CREDITS
Creditlist with people that work/help on Net_SmartIRC.
SmartIRC/
defines.php
Nessesary IRC related defines (IRC reply codes).
messagehandler.php
All defined messagehandler that SmartIRC currently uses for channelsynching
and some other API handling.
irccommands.php
All supported IRC commands (like join/part/kick/etc..)
docs/
DOCUMENTATION
Appendix to the HTML documention for developers.
HOWTO
Mini howto with detailed information, step by step.
HTML/
index.html
the full documenation of SmartIRC
examples/
example.php
An example of how you can use this class for a mini php bot.
example2.php
This example shows how to display the amount of users in a specific
IRC channel on your homepage.
example3.php
This bot echos the oplist if !ops is said on the channel.
example4.php
This bot checks all realnames of people that are on the channel
and displays the result.
example5.php
This bot can kicks users when !kick NICKNAME is said on the channel.
example6.php
This example shows how an onjoin greeting can be done with SmartIRC.
example7.php
This is an example how timers can be used and how to unregister them.
modules/
PingFix.php
This is a module you can load with your script to fix a connection keep-alive
issue until it gets fixed in the main class code.
-34
View File
@@ -1,34 +0,0 @@
<?php
class Net_SmartIRC_module_PingFix
{
public $name = 'PingFix';
public $version = '1.0';
public $description = 'An active-pinging system to keep the bot from dropping the connection';
public $author = 'Garrett W.';
public $license = 'LGPL';
private $irc;
private $thid;
function __construct (&$irc) {
$this->irc = $irc;
$this->thid = $this->irc->registerTimehandler(
$this->irc->_rxtimeout/8*1000, $this, 'pingCheck'
);
}
function __destruct () {
$this->irc->unregisterTimeid($this->thid);
}
function pingCheck () {
if (time() - $this->irc->_lastrx > $this->irc->_rxtimeout) {
$this->irc->reconnect();
$this->irc->_lastrx = time();
} elseif (time() - $this->irc->_lastrx > $this->irc->_rxtimeout/3) {
$this->irc->_send('PING '.$this->irc->_address, SMARTIRC_CRITICAL);
}
}
}
?>
+1 -1
View File
@@ -66,7 +66,7 @@ elif len(sys.argv) > 1 and (sys.argv[1] == "filename"):
datas = cur[0].fetchall()
elif len(sys.argv) > 1 and (sys.argv[1] == "md5"):
while len(datas) == 0 and maxtries >= -5:
run = "SELECT DISTINCT rel.ID FROM releases rel INNER JOIN releasefiles rf ON rel.ID = rf.releaseID WHERE isrenamed = 0 AND rel.dehashstatus BETWEEN %s AND 0 AND rel.passwordstatus >= -1 AND (rel.ishashed = 1 OR rf.name REGEXP'[a-fA-F0-9]{32,40}') ORDER BY postdate ASC LIMIT %s"
run = "SELECT DISTINCT rel.ID FROM releases rel INNER JOIN releasefiles rf ON rel.ID = rf.releaseID WHERE isrenamed = 0 AND rel.dehashstatus BETWEEN %s AND 0 AND rel.passwordstatus >= -1 AND (rel.ishashed = 1 OR rf.ishashed = 1) ORDER BY postdate ASC LIMIT %s"
cur[0].execute(run, (maxtries, int(perrun[0])*int(run_threads[0])))
datas = cur[0].fetchall()
maxtries = maxtries - 1
-34
View File
@@ -1,34 +0,0 @@
#!/usr/bin/env bash
SOURCE="${BASH_SOURCE[0]}"
DIR="$( dirname "$SOURCE" )"
while [ -h "$SOURCE" ]
do
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
source $DIR/../defaults.sh
#updates to newest svn
svn co --force --username svnplus --password $SVN_PASSWORD svn://svn.newznab.com/nn/branches/nnplus $NEWZPATH/
sleep 2
#force download/overwrite of current svn
svn export --force --username svnplus --password $SVN_PASSWORD svn://svn.newznab.com/nn/branches/nnplus $NEWZPATH/
#update db to current rev
cd $NEWZPATH"/misc/update_scripts"
$PHP update_database_version.php
rm -fr $NEWZPATH"/www/install"
cd $DIR/scripts
./fix_files.sh
+1 -1
View File
@@ -14,7 +14,7 @@ $tmux = $t->get();
$patch = (isset($tmux->sqlpatch)) ? $tmux->sqlpatch : 0;
// Check database patch version
if ($patch < 34) {
if ($patch < 35) {
exit($c->error("\nYour database is not up to date. Please update.\nphp ${DIR}/lib/DB/patchDB.php\n"));
}
$tmux_session = (isset($tmux->tmux_session)) ? $tmux->tmux_session : 0;