Permalink
Browse files

Removed changelog from python modules and refactor license header

  • Loading branch information...
danielepantaleone committed Dec 1, 2017
1 parent 624c393 commit ce8707c5961cd6a89b16a226c70b5b70b4e69024
Showing 383 changed files with 8,618 additions and 7,992 deletions.
@@ -1,48 +1,26 @@
# coding=utf-8
#
# BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2005 Michael "ThorN" Thornton
#
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
#
# CHANGELOG
#
# 2010/02/20 - Courgette - user friendly handling of parser import error: prints a detailed message and exits
# 2010/02/24 - Courgette - user friendly message on missing config file option
# 2010/03/20 - 1.1.0 - xl8or - ability to disable automatic setup procedure when option -n, --nosetup is passed
# 2010/09/16 - 1.1.1 - GrosBedo - can now run in a thread (functions profiler mode)
# 2010/10/20 - 1.1.2 - GrosBedo - added TEAM_FREE for non team based gametypes (eg: deathmatch)
# 2014/07/20 - 1.2 - Fenix - syntax cleanup
# 2014/09/07 - 1.2.1 - Courgette - fix getAbsolutePath @b3 and @conf expansion on path using windows style separators
# 2014/12/14 - 1.3 - Fenix - let the parser know if we are running B3 in auto-restart mode or not
# 2015/05/04 - 1.4 - Fenix - added getPlatform() function: return the current platform name
# - better update data printing in stdout
# - added getWritableFilePath function: return a valid writable filepath
# 2015/05/22 - 1.5 - Fenix - allow system filepaths to be decoded using default filesystem encoding
# 2015/05/23 - 1.5.1 - Fenix - moved decoding feature into b3.functions
# - added getShortPath function: convert back an absolute path in its short form by
# adding back replaced tokens such as @b3, @conf, ~ (mainly used for clean logging)
# 2015/05/26 - 1.6 - Fenix - rearrange constants and functions declarations to solve some import issues
# 2015/06/07 - 1.7 - Fenix - added optional 'conf' parameter to getAbsolutePath and getConfPath: allow the retrieval
# of @conf by passing a specific configuration file (path or instance) to the function
# instead of using the globally definied confdir variable (fix @conf retrieval from GUI)
# 2015/06/17 - 1.8 - Fenix - changed getAbsolutePath to resolve @home token
# 2015/07/03 - 1.9 - Fenix - added getHomePath() function: return the b3 HOME path creating it if it doesn't exists
# 2015/07/04 - 1.10 - Fenix - correctly retrieve @home token in getShortPath() function
# 2015/07/08 - 1.11 - Fenix - added getB3versionInfo function: return a tuple with B3 version information
# - changed getPlatform to return 'nt' instead of 'win32'
# -*- coding: utf-8 -*-
# ################################################################### #
# #
# BigBrotherBot(B3) (www.bigbrotherbot.net) #
# Copyright (C) 2005 Michael "ThorN" Thornton #
# #
# 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. #
# #
# ################################################################### #
import os
@@ -1,77 +1,26 @@
# coding: latin-1
#
# BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2005 Michael "ThorN" Thornton
#
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
#
# CHANGELOG
#
# 2017/09/09 - 1.10.11 - Supiri - add a countermeasure against sql injections
#
# 2015/06/25 - 1.8.1 - Fenix - changed client.message to accept positional parameter for string substitution
# 2015/03/19 - 1.8 - Fenix - actually catch Exception class in try-except
# - removed deprecated usage of dict.has_key (us 'in dict' instead)
# 2014/08/09 - 1.7.1 - Courgette - fire new event EVT_CLIENT_TEAM_CHANGE2
# 2014/07/26 - 1.7 - Fenix - syntax cleanup
# - reformat changelog
# 2014/05/09 - 1.6.5 - Fenix - changed kick.time_expire = 0 -> kick.time_expire = -1: fix inability to
# retrieve kick penalties from the storage
# 2014/05/05 - 1.6.4 - Fenix - fixed None comparison performed with equality operators
# - removed class attributes duplicate declaration
# - added missing super constructor to Clients class
# - simplified some chained comparisons
# 2014/02/22 - 1.6.3 - Courgette - fix issue #162 - 'None' string get written to the database 'clients.pbid'
# column when Client.pbid is None
# 2014/01/11 - 1.6.2 - Courgette - fix mask_level is set with group id while it should be group level
# 07/08/2013 - 1.6.1 - Courgette - getting a client by its db id will return the existing client object if
# found in the list of connected clients
# 15/07/2013 - 1.6 - Courgette - fire EVT_CLIENT_WARN and EVT_CLIENT_NOTICE events
# 26/11/2012 - 1.5 - Courgette - add database columns 'login' and 'password' to the Client model
# 27/08/2012 - 1.4.1 - Courgette - fix bug in get_by_magic when parameter is a cid which is not in use: was
# returning [None] instead of []
# 28/10/2012 - 1.4.0 - Courgette - Client.save() now raises a EVT_CLIENT_UPDATE event
# 16/07/2011 - 1.3.6 - xlr8or - Client.bot added - ability to identify a bot
# 08/04/2011 - 1.3.5 - Courgette - make sure Clients.empty() does not delete hidden clients
# 08/04/2011 - 1.3.4 - Courgette - changes to allow cid to be a unicode string
# 30/03/2011 - 1.3.3 - Courgette - new_client() now returns the created client object
# 26/03/2011 - 1.3.2 - Courgette - fix bug on Client.__init__()
# 12/11/2010 - 1.3.1 - Courgette - harden _set_name for cases where console is not set
# 01/11/2010 - 1.3.0 - Courgette - Clients::get_clients_by_name() now ignores blank characters from names
# - add automated tests for Clients::get_clients_by_name()
# 15/08/2010 - 1.2.13 - xlr8or - minor addition for bfbc2 in alias checking
# 21/05/2010 - 1.2.12 - xlr8or - catch ValueError in clients.get_by_cid to allow names as CID's, but still
# - fix the previous exploit in q3a based games
# 11/05/2010 - 1.2.11 - Courgette - fix exploit by using player cid prefixed with '0' for commands making use
# of clients.get_by_cid
# 08/01/2010 - 1.2.10 - xlr8or - disabled adding aliasses for world
# 01/01/2010 - 1.2.9 - Courgette - clients get* methods' code is now more meaningful as :
# b = weakref.ref(a)()
# b = a
# are strictly identical
# 01/01/2010 - 1.2.8 - Courgette - fix bug in Clients.get_by_name()
# 14/12/2009 - 1.2.7 - Courgette - change the way client.name and client.exactname are set and when the
# client name changed event is triggered
# - a new alias is given the default num_used 1 (was 0)
# 26/02/2009 - 1.2.6 - xlr8or - changed last_visit to a global client variable
# 05/06/2008 - 1.2.5 - xlr8or - client object now saves the current IP in auth function
# 29/10/2005 - 1.2.0 - ThorN - removed direct references to PunkBuster. Authorization is now proxied
# through the console.
# 07/23/2005 - 1.1.0 - ThorN - added data field to Penalty
# - added data parameter to Client.warn()
# - added data parameter to Client.tempban()
# -*- coding: utf-8 -*-
# ################################################################### #
# #
# BigBrotherBot(B3) (www.bigbrotherbot.net) #
# Copyright (C) 2005 Michael "ThorN" Thornton #
# #
# 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. #
# #
# ################################################################### #
import b3
import b3.events
@@ -83,6 +32,7 @@
import time
import traceback
class ClientVar(object):
value = None
@@ -910,7 +860,7 @@ def save(self, console=None):
return False
else:
# fix missing pbid. Workaround a bug in the database layer that would insert the string "None"
# in db if pbid is None :/ The empty string being the default value for that db column!! ôO
# in db if pbid is None :/ The empty string being the default value for that db column!! ôO
if self.pbid is None:
self.pbid = ''
if console:
@@ -1541,7 +1491,7 @@ def getByCID(self, cid):
else:
return None
return None
def escape_string(self, value, mapping=None):
"""
@@ -1560,7 +1510,7 @@ def escape_string(self, value, mapping=None):
value = value.replace("'", "\\'")
value = value.replace('"', '\\"')
return value
def lookupByName(self, name):
"""
Return a lst of clients matching the given name.
@@ -1571,9 +1521,9 @@ def lookupByName(self, name):
c = self.getClientLikeName(name)
if c and not c.hide:
return [c]
name = self.escape_string(name)
sclient = self.console.storage.getClientsMatching({'%name%': name})
if not sclient:
@@ -1,59 +1,26 @@
#
# BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2005 Michael "ThorN" Thornton
#
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
#
# CHANGELOG
#
# 22/02/2009 - 1.2.1 - Courgette - fix the compatibility issue with ElementTree and display an explicit
# error message to avoid noobish questions on B3 forums :P
# 14/11/2009 - 1.2.2 - Courgette - detect xml parsing errors and raise a specific exception in that case
# 22/11/2009 - 1.2.3 - Courgette - fix bug with resolution of @conf on linux
# 29/11/2009 - 1.3.0 - Courgette - XmlConfigParser can also be parsed from string
# 20/12/2009 - 1.3.1 - Courgette - fix bug in resolving @b3 which was failing for the win32 standalone release
# 03/12/2011 - 1.3.2 - Courgette - fixes xlr8or/big-brother-bot#18 : @conf in XML only works when b3_run.py config
# parameter contains path component
# 31/03/2012 - 1.3.3 - Courgette - change behavior of XmlConfigParser methods getboolean, getint, getfloat when
# config value is an empty string
# 11/04/2012 - 1.4 - Courgette - CfgConfigParser now implements methods getDuration, getboolean,
# getpath, load_from_string
# 10/04/2013 - 1.4.1 - Courgette - fix ConfigFileNotFound and ConfigFileNotValid __str__ method
# 19/07/2014 - 1.5 - Fenix - syntax cleanup
# - declared get method in B3ConfigParserMixin for design consistency
# - added stub constructor in XmlConfigParser
# 06/09/2014 - 1.5.1 - Courgette - remove duplicated code by using b3.getAbsolutePath
# 07/09/2014 - 1.6 - Fenix - added 'allow_no_value' keyword to CfgConfigParser constructor so we can load
# plugins which don't specify a configuration file
# 07/09/2014 - 1.7 - Courgette - added MainConfig class to parser B3 main configuration file from .xml and .ini format
# 07/09/2014 - 1.7.1 - Fenix - patch the RawConfigParser class when python 2.6 is used to run b3: this allows
# python 2.6 to make use of the new feature of the RawConfigParser class that load
# keys from configuration files with non specified values
# - return empty string instead of None in get() method: this fixes possible failures in
# string replacements when we retrieve empty option from a .ini configuration file
# 15/01/2015 - 1.7.2 - Fenix - Make sure users can't load 'admin', 'publist', 'ftpytail', 'sftpytail', 'httpytail'
# as disabled from main B3 configuration file
# 22/01/2015 - 1.7.3 - Fenix - added add_comment method to CfgConfigParser and overridden write() method
# to properly write comments in a newly generated configuration file
# 03/03/2015 - 1.7.4 - Fenix - removed python 2.6 support
# 03/03/2015 - 1.7.5 - Fenix - moved exception classes in a separate module
# 19/03/2015 - 1.7.6 - Fenix - raise NotImplementedError instead of NotImplemented
# 22/04/2015 - 1.7.7 - Fenix - raise ConfigFileNotValid in ConfigParser.readfp for consistency with XmlConfigParser
# - added 'analyze()' method in MainConfig
# 26/05/2015 - 1.7.8 - Fenix - changed analyze() to validate also storage protocol
# 17/06/2015 - 1.7.9 - Fenix - fixed bad indent which was causing analyze() to generate false positives on admin plugin
# -*- coding: utf-8 -*-
# ################################################################### #
# #
# BigBrotherBot(B3) (www.bigbrotherbot.net) #
# Copyright (C) 2005 Michael "ThorN" Thornton #
# #
# 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. #
# #
# ################################################################### #
__author__ = 'ThorN, Courgette, Fenix'
__version__ = '1.7.9'
Oops, something went wrong.

0 comments on commit ce8707c

Please sign in to comment.