mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-18 14:30:42 +01:00
Sort imports via isort
This commit is contained in:
parent
19d794a6f5
commit
80188c3673
2
.isort.cfg
Normal file
2
.isort.cfg
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[settings]
|
||||||
|
line_length=100
|
22
classes.py
22
classes.py
@ -7,25 +7,27 @@ connections and objects used to represent IRC servers, users, and channels.
|
|||||||
Here be dragons.
|
Here be dragons.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import threading
|
import collections
|
||||||
import time
|
import collections.abc
|
||||||
import socket
|
import functools
|
||||||
import ssl
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import queue
|
import queue
|
||||||
QUEUE_FULL = queue.Full
|
|
||||||
import functools
|
|
||||||
import string
|
|
||||||
import re
|
import re
|
||||||
import collections
|
import socket
|
||||||
import collections.abc
|
import ssl
|
||||||
|
import string
|
||||||
import textwrap
|
import textwrap
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
|
||||||
from . import world, utils, structures, conf, __version__, selectdriver
|
from . import __version__, conf, selectdriver, structures, utils, world
|
||||||
from .log import *
|
from .log import *
|
||||||
from .utils import ProtocolError # Compatibility with PyLink 1.x
|
from .utils import ProtocolError # Compatibility with PyLink 1.x
|
||||||
|
|
||||||
|
QUEUE_FULL = queue.Full
|
||||||
|
|
||||||
|
|
||||||
### Internal classes (users, servers, channels)
|
### Internal classes (users, servers, channels)
|
||||||
|
|
||||||
class ChannelState(structures.IRCCaseInsensitiveDict):
|
class ChannelState(structures.IRCCaseInsensitiveDict):
|
||||||
|
5
conf.py
5
conf.py
@ -10,13 +10,14 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError("PyLink requires PyYAML to function; please install it and try again.")
|
raise ImportError("PyLink requires PyYAML to function; please install it and try again.")
|
||||||
|
|
||||||
import sys
|
|
||||||
import os.path
|
|
||||||
import logging
|
import logging
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from . import world
|
from . import world
|
||||||
|
|
||||||
|
|
||||||
class ConfigurationError(RuntimeError):
|
class ConfigurationError(RuntimeError):
|
||||||
"""Error when config conditions aren't met."""
|
"""Error when config conditions aren't met."""
|
||||||
|
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
"""
|
"""
|
||||||
control.py - Implements SHUTDOWN and REHASH functionality.
|
control.py - Implements SHUTDOWN and REHASH functionality.
|
||||||
"""
|
"""
|
||||||
import signal
|
|
||||||
import os
|
|
||||||
import threading
|
|
||||||
import sys
|
|
||||||
import atexit
|
import atexit
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
|
|
||||||
|
from pylinkirc import conf, utils, world # Do not import classes, it'll import loop
|
||||||
|
from pylinkirc.log import _get_console_log_level, _make_file_logger, _stop_file_loggers, log
|
||||||
|
|
||||||
|
from . import login, permissions
|
||||||
|
|
||||||
from pylinkirc import world, utils, conf # Do not import classes, it'll import loop
|
|
||||||
from pylinkirc.log import log, _make_file_logger, _stop_file_loggers, _get_console_log_level
|
|
||||||
from . import permissions, login
|
|
||||||
|
|
||||||
def remove_network(ircobj):
|
def remove_network(ircobj):
|
||||||
"""Removes a network object from the pool."""
|
"""Removes a network object from the pool."""
|
||||||
|
@ -3,12 +3,13 @@ corecommands.py - Implements core PyLink commands.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
import sys
|
|
||||||
import importlib
|
import importlib
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from pylinkirc import conf, utils, world
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
from . import control, login, permissions
|
from . import control, login, permissions
|
||||||
from pylinkirc import utils, world, conf
|
|
||||||
from pylinkirc.log import log
|
|
||||||
|
|
||||||
# Essential, core commands go here so that the "commands" plugin with less-important,
|
# Essential, core commands go here so that the "commands" plugin with less-important,
|
||||||
# but still generic functions can be reloaded.
|
# but still generic functions can be reloaded.
|
||||||
|
@ -5,6 +5,7 @@ exttargets.py - Implements extended targets like $account:xyz, $oper, etc.
|
|||||||
from pylinkirc import world
|
from pylinkirc import world
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
|
|
||||||
def bind(func):
|
def bind(func):
|
||||||
"""
|
"""
|
||||||
Binds an exttarget with the given name.
|
Binds an exttarget with the given name.
|
||||||
|
@ -3,9 +3,10 @@ handlers.py - Implements miscellaneous IRC command handlers (WHOIS, services log
|
|||||||
"""
|
"""
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from pylinkirc import utils, conf
|
from pylinkirc import conf, utils
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
|
|
||||||
def handle_whois(irc, source, command, args):
|
def handle_whois(irc, source, command, args):
|
||||||
"""Handle WHOIS queries."""
|
"""Handle WHOIS queries."""
|
||||||
target = args['target']
|
target = args['target']
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
permissions.py - Permissions Abstraction for PyLink IRC Services.
|
permissions.py - Permissions Abstraction for PyLink IRC Services.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from collections import defaultdict
|
|
||||||
import threading
|
import threading
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
|
from pylinkirc import conf, utils
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
# Global variables: these store mappings of hostmasks/exttargets to lists of permissions each target has.
|
# Global variables: these store mappings of hostmasks/exttargets to lists of permissions each target has.
|
||||||
default_permissions = defaultdict(set)
|
default_permissions = defaultdict(set)
|
||||||
|
|
||||||
from pylinkirc import conf, utils
|
|
||||||
from pylinkirc.log import log
|
|
||||||
|
|
||||||
def add_default_permissions(perms):
|
def add_default_permissions(perms):
|
||||||
"""Adds default permissions to the index."""
|
"""Adds default permissions to the index."""
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
service_support.py - Implements handlers for the PyLink ServiceBot API.
|
service_support.py - Implements handlers for the PyLink ServiceBot API.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pylinkirc import utils, world, conf
|
from pylinkirc import conf, utils, world
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
|
|
||||||
def spawn_service(irc, source, command, args):
|
def spawn_service(irc, source, command, args):
|
||||||
"""Handles new service bot introductions."""
|
"""Handles new service bot introductions."""
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
Generates HTML versions of the mode list .csv definitions.
|
Generates HTML versions of the mode list .csv definitions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import csv
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import csv
|
|
||||||
|
|
||||||
os.chdir(os.path.dirname(__file__))
|
os.chdir(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
@ -4,10 +4,11 @@ PyLink IRC Services launcher.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import signal
|
import signal
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from pylinkirc import world, conf, __version__, real_version
|
|
||||||
|
from pylinkirc import __version__, conf, real_version, world
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import psutil
|
import psutil
|
||||||
|
3
log.py
3
log.py
@ -10,7 +10,7 @@ import logging
|
|||||||
import logging.handlers
|
import logging.handlers
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from . import world, conf
|
from . import conf, world
|
||||||
|
|
||||||
# Stores a list of active file loggers.
|
# Stores a list of active file loggers.
|
||||||
fileloggers = []
|
fileloggers = []
|
||||||
@ -153,4 +153,3 @@ class PyLinkChannelLogger(logging.Handler):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.called = False
|
self.called = False
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# antispam.py: Basic services-side spamfilters for IRC
|
# antispam.py: Basic services-side spamfilters for IRC
|
||||||
|
|
||||||
from pylinkirc import utils, world, conf
|
from pylinkirc import conf, utils, world
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
mydesc = ("Provides anti-spam functionality.")
|
mydesc = ("Provides anti-spam functionality.")
|
||||||
|
@ -4,9 +4,9 @@ hostmasks or exttargets.
|
|||||||
"""
|
"""
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
from pylinkirc import utils, conf, world, structures
|
from pylinkirc import conf, structures, utils, world
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
from pylinkirc.coremods import permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
mydesc = ("The \x02Automode\x02 plugin provides simple channel ACL management by giving prefix modes "
|
mydesc = ("The \x02Automode\x02 plugin provides simple channel ACL management by giving prefix modes "
|
||||||
"to users matching hostmasks or exttargets.")
|
"to users matching hostmasks or exttargets.")
|
||||||
|
@ -3,8 +3,9 @@ bots.py: Spawn virtual users/bots on a PyLink server and make them interact
|
|||||||
with things.
|
with things.
|
||||||
"""
|
"""
|
||||||
from pylinkirc import utils
|
from pylinkirc import utils
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
from pylinkirc.coremods import permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
|
|
||||||
@utils.add_cmd
|
@utils.add_cmd
|
||||||
def spawnclient(irc, source, args):
|
def spawnclient(irc, source, args):
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"""
|
"""
|
||||||
Changehost plugin - automatically changes the hostname of matching users.
|
Changehost plugin - automatically changes the hostname of matching users.
|
||||||
"""
|
"""
|
||||||
from pylinkirc import utils, world, conf
|
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
|
||||||
|
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
from pylinkirc import conf, utils, world
|
||||||
|
from pylinkirc.coremods import permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
# Characters allowed in a hostname.
|
# Characters allowed in a hostname.
|
||||||
allowed_chars = string.ascii_letters + '-./:' + string.digits
|
allowed_chars = string.ascii_letters + '-./:' + string.digits
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
# commands.py: base PyLink commands
|
# commands.py: base PyLink commands
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from pylinkirc import conf, utils, __version__, world, real_version
|
from pylinkirc import __version__, conf, real_version, utils, world
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
from pylinkirc.coremods import permissions
|
||||||
|
|
||||||
from pylinkirc.coremods.login import pwd_context
|
from pylinkirc.coremods.login import pwd_context
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
default_permissions = {"*!*@*": ['commands.status', 'commands.showuser', 'commands.showchan', 'commands.shownet']}
|
default_permissions = {"*!*@*": ['commands.status', 'commands.showuser', 'commands.showchan', 'commands.shownet']}
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
# ctcp.py: Handles basic CTCP requests.
|
# ctcp.py: Handles basic CTCP requests.
|
||||||
import random
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import random
|
||||||
|
|
||||||
from pylinkirc import utils
|
from pylinkirc import utils
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
|
|
||||||
def handle_ctcp(irc, source, command, args):
|
def handle_ctcp(irc, source, command, args):
|
||||||
"""
|
"""
|
||||||
CTCP event handler.
|
CTCP event handler.
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# example.py: An example PyLink plugin.
|
# example.py: An example PyLink plugin.
|
||||||
|
import random
|
||||||
|
|
||||||
from pylinkirc import utils
|
from pylinkirc import utils
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
import random
|
|
||||||
|
|
||||||
# Example PRIVMSG hook that returns "hi there!" when PyLink's nick is mentioned
|
# Example PRIVMSG hook that returns "hi there!" when PyLink's nick is mentioned
|
||||||
# in a channel.
|
# in a channel.
|
||||||
|
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
"""
|
"""
|
||||||
exec.py: Provides commands for executing raw code and debugging PyLink.
|
exec.py: Provides commands for executing raw code and debugging PyLink.
|
||||||
"""
|
"""
|
||||||
|
import importlib
|
||||||
import pprint
|
import pprint
|
||||||
import threading
|
|
||||||
|
|
||||||
from pylinkirc import *
|
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
|
||||||
|
|
||||||
# These imports are not strictly necessary, but make the following modules
|
# These imports are not strictly necessary, but make the following modules
|
||||||
# easier to access through eval and exec.
|
# easier to access through eval and exec.
|
||||||
import re
|
import re
|
||||||
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import pylinkirc
|
import pylinkirc
|
||||||
import importlib
|
from pylinkirc import *
|
||||||
|
from pylinkirc.coremods import permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
exec_locals_dict = {}
|
exec_locals_dict = {}
|
||||||
PPRINT_MAX_LINES = 20
|
PPRINT_MAX_LINES = 20
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# fantasy.py: Adds FANTASY command support, to allow calling commands in channels
|
# fantasy.py: Adds FANTASY command support, to allow calling commands in channels
|
||||||
from pylinkirc import utils, world, conf
|
from pylinkirc import conf, utils, world
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
|
|
||||||
def handle_fantasy(irc, source, command, args):
|
def handle_fantasy(irc, source, command, args):
|
||||||
"""Fantasy command handler."""
|
"""Fantasy command handler."""
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
import string
|
import string
|
||||||
|
|
||||||
from pylinkirc import conf, utils, world
|
from pylinkirc import conf, utils, world
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
from pylinkirc.coremods import permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
DEFAULT_FORMAT = "[$sender@$fullnetwork] $text"
|
DEFAULT_FORMAT = "[$sender@$fullnetwork] $text"
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"""Networks plugin - allows you to manipulate connections to various configured networks."""
|
"""Networks plugin - allows you to manipulate connections to various configured networks."""
|
||||||
import importlib
|
import importlib
|
||||||
import types
|
|
||||||
import threading
|
import threading
|
||||||
|
import types
|
||||||
|
|
||||||
import pylinkirc
|
import pylinkirc
|
||||||
from pylinkirc import utils, world
|
from pylinkirc import utils, world
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import control, permissions
|
from pylinkirc.coremods import control, permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
REMOTE_IN_USE = threading.Event()
|
REMOTE_IN_USE = threading.Event()
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ opercmds.py: Provides a subset of network management commands.
|
|||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from pylinkirc import utils, world
|
from pylinkirc import utils, world
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
from pylinkirc.coremods import permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
# Having a hard limit here is sensible because otherwise it can flood the client or server off.
|
# Having a hard limit here is sensible because otherwise it can flood the client or server off.
|
||||||
CHECKBAN_MAX_RESULTS = 200
|
CHECKBAN_MAX_RESULTS = 200
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
raw.py: Provides a 'raw' command for sending raw text to IRC.
|
raw.py: Provides a 'raw' command for sending raw text to IRC.
|
||||||
"""
|
"""
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
|
||||||
from pylinkirc import utils
|
from pylinkirc import utils
|
||||||
|
from pylinkirc.coremods import permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
|
|
||||||
@utils.add_cmd
|
@utils.add_cmd
|
||||||
def raw(irc, source, args):
|
def raw(irc, source, args):
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
# relay.py: PyLink Relay plugin
|
# relay.py: PyLink Relay plugin
|
||||||
import time
|
|
||||||
import threading
|
|
||||||
import string
|
|
||||||
from collections import defaultdict
|
|
||||||
import inspect
|
|
||||||
import base64
|
import base64
|
||||||
|
import inspect
|
||||||
|
import string
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
from pylinkirc import utils, world, conf, structures
|
from pylinkirc import conf, structures, utils, world
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
from pylinkirc.coremods import permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
CHANNEL_DELINKED_MSG = "Channel delinked."
|
CHANNEL_DELINKED_MSG = "Channel delinked."
|
||||||
RELAY_UNLOADED_MSG = "Relay plugin unloaded."
|
RELAY_UNLOADED_MSG = "Relay plugin unloaded."
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# relay_clientbot.py: Clientbot extensions for Relay
|
# relay_clientbot.py: Clientbot extensions for Relay
|
||||||
|
import shlex
|
||||||
import string
|
import string
|
||||||
import time
|
import time
|
||||||
import shlex
|
|
||||||
|
|
||||||
from pylinkirc import utils, conf, world
|
from pylinkirc import conf, utils, world
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
# Clientbot default styles:
|
# Clientbot default styles:
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# servermaps.py: Maps out connected IRC servers.
|
# servermaps.py: Maps out connected IRC servers.
|
||||||
|
|
||||||
from pylinkirc import utils, world
|
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
|
from pylinkirc import utils, world
|
||||||
|
from pylinkirc.coremods import permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
DEFAULT_PERMISSIONS = {"$ircop": ['servermaps.localmap']}
|
DEFAULT_PERMISSIONS = {"$ircop": ['servermaps.localmap']}
|
||||||
|
|
||||||
def main(irc=None):
|
def main(irc=None):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from pylinkirc import utils, conf
|
from pylinkirc import conf, utils
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
"""
|
"""
|
||||||
stats.py: Simple statistics for PyLink IRC Services.
|
stats.py: Simple statistics for PyLink IRC Services.
|
||||||
"""
|
"""
|
||||||
import time
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import time
|
||||||
|
|
||||||
from pylinkirc import utils, world, conf
|
from pylinkirc import conf, utils, world
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.coremods import permissions
|
from pylinkirc.coremods import permissions
|
||||||
|
from pylinkirc.log import log
|
||||||
|
|
||||||
|
|
||||||
def timediff(before, now):
|
def timediff(before, now):
|
||||||
"""
|
"""
|
||||||
|
@ -6,14 +6,14 @@ clientbot.py: Clientbot (regular IRC bot) protocol module for PyLink.
|
|||||||
# that a regular server would have (e.g. spawning virtual users for things like Relay). Somehow it
|
# that a regular server would have (e.g. spawning virtual users for things like Relay). Somehow it
|
||||||
# works on most networks though!
|
# works on most networks though!
|
||||||
|
|
||||||
import time
|
|
||||||
import threading
|
|
||||||
import base64
|
import base64
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
|
||||||
from pylinkirc import utils, conf
|
from pylinkirc import conf, utils
|
||||||
|
from pylinkirc.classes import *
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
from pylinkirc.protocols.ircs2s_common import *
|
from pylinkirc.protocols.ircs2s_common import *
|
||||||
from pylinkirc.classes import *
|
|
||||||
|
|
||||||
FALLBACK_REALNAME = 'PyLink Relay Mirror Client'
|
FALLBACK_REALNAME = 'PyLink Relay Mirror Client'
|
||||||
|
|
||||||
|
@ -4,11 +4,12 @@ hybrid.py: IRCD-Hybrid protocol module for PyLink.
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from pylinkirc import utils, conf
|
from pylinkirc import conf, utils
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.classes import *
|
from pylinkirc.classes import *
|
||||||
|
from pylinkirc.log import log
|
||||||
from pylinkirc.protocols.ts6 import *
|
from pylinkirc.protocols.ts6 import *
|
||||||
|
|
||||||
|
|
||||||
# This protocol module inherits from the TS6 protocol.
|
# This protocol module inherits from the TS6 protocol.
|
||||||
class HybridProtocol(TS6Protocol):
|
class HybridProtocol(TS6Protocol):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
inspircd.py: InspIRCd 2.0, 3.0 protocol module for PyLink.
|
inspircd.py: InspIRCd 2.0, 3.0 protocol module for PyLink.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
|
||||||
import threading
|
import threading
|
||||||
|
import time
|
||||||
|
|
||||||
from pylinkirc import utils, conf
|
from pylinkirc import conf, utils
|
||||||
from pylinkirc.classes import *
|
from pylinkirc.classes import *
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
from pylinkirc.protocols.ts6_common import *
|
from pylinkirc.protocols.ts6_common import *
|
||||||
|
|
||||||
|
|
||||||
class InspIRCdProtocol(TS6BaseProtocol):
|
class InspIRCdProtocol(TS6BaseProtocol):
|
||||||
|
|
||||||
S2S_BUFSIZE = 0 # InspIRCd allows infinitely long S2S messages, so set bufsize to infinite
|
S2S_BUFSIZE = 0 # InspIRCd allows infinitely long S2S messages, so set bufsize to infinite
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
ircs2s_common.py: Common base protocol class with functions shared by TS6 and P10-based protocols.
|
ircs2s_common.py: Common base protocol class with functions shared by TS6 and P10-based protocols.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
from pylinkirc import conf, utils
|
||||||
from pylinkirc.classes import IRCNetwork, ProtocolError
|
from pylinkirc.classes import IRCNetwork, ProtocolError
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
from pylinkirc import utils, conf
|
|
||||||
|
|
||||||
class IncrementalUIDGenerator():
|
class IncrementalUIDGenerator():
|
||||||
"""
|
"""
|
||||||
|
@ -5,6 +5,7 @@ nefarious.py: Migration stub to the new P10 protocol module.
|
|||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
from pylinkirc.protocols.p10 import *
|
from pylinkirc.protocols.p10 import *
|
||||||
|
|
||||||
|
|
||||||
class NefariousProtocol(P10Protocol):
|
class NefariousProtocol(P10Protocol):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
@ -7,14 +7,15 @@ ngircd.py: PyLink protocol module for ngIRCd.
|
|||||||
# and https://tools.ietf.org/html/rfc2813
|
# and https://tools.ietf.org/html/rfc2813
|
||||||
##
|
##
|
||||||
|
|
||||||
import time
|
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
from pylinkirc import utils, conf, __version__
|
from pylinkirc import __version__, conf, utils
|
||||||
from pylinkirc.classes import *
|
from pylinkirc.classes import *
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
from pylinkirc.protocols.ircs2s_common import *
|
from pylinkirc.protocols.ircs2s_common import *
|
||||||
|
|
||||||
|
|
||||||
class NgIRCdProtocol(IRCS2SProtocol):
|
class NgIRCdProtocol(IRCS2SProtocol):
|
||||||
def __init__(self, irc):
|
def __init__(self, irc):
|
||||||
super().__init__(irc)
|
super().__init__(irc)
|
||||||
|
@ -4,14 +4,15 @@ p10.py: P10 protocol module for PyLink, supporting Nefarious IRCu and others.
|
|||||||
|
|
||||||
import base64
|
import base64
|
||||||
import struct
|
import struct
|
||||||
from ipaddress import ip_address
|
|
||||||
import time
|
import time
|
||||||
|
from ipaddress import ip_address
|
||||||
|
|
||||||
from pylinkirc import utils, structures, conf
|
from pylinkirc import conf, structures, utils
|
||||||
from pylinkirc.classes import *
|
from pylinkirc.classes import *
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
from pylinkirc.protocols.ircs2s_common import *
|
from pylinkirc.protocols.ircs2s_common import *
|
||||||
|
|
||||||
|
|
||||||
class P10UIDGenerator(IncrementalUIDGenerator):
|
class P10UIDGenerator(IncrementalUIDGenerator):
|
||||||
"""Implements an incremental P10 UID Generator."""
|
"""Implements an incremental P10 UID Generator."""
|
||||||
|
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
ts6.py: PyLink protocol module for TS6-based IRCds (charybdis, elemental-ircd).
|
ts6.py: PyLink protocol module for TS6-based IRCds (charybdis, elemental-ircd).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
from pylinkirc import utils, conf
|
from pylinkirc import conf, utils
|
||||||
from pylinkirc.classes import *
|
from pylinkirc.classes import *
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
from pylinkirc.protocols.ts6_common import *
|
from pylinkirc.protocols.ts6_common import *
|
||||||
|
|
||||||
|
|
||||||
class TS6Protocol(TS6BaseProtocol):
|
class TS6Protocol(TS6BaseProtocol):
|
||||||
|
|
||||||
SUPPORTED_IRCDS = ('charybdis', 'elemental', 'chatircd', 'ratbox')
|
SUPPORTED_IRCDS = ('charybdis', 'elemental', 'chatircd', 'ratbox')
|
||||||
|
@ -5,11 +5,12 @@ ts6_common.py: Common base protocol class with functions shared by the UnrealIRC
|
|||||||
import string
|
import string
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from pylinkirc import utils, structures, conf
|
from pylinkirc import conf, structures, utils
|
||||||
from pylinkirc.classes import *
|
from pylinkirc.classes import *
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
from pylinkirc.protocols.ircs2s_common import *
|
from pylinkirc.protocols.ircs2s_common import *
|
||||||
|
|
||||||
|
|
||||||
class TS6SIDGenerator():
|
class TS6SIDGenerator():
|
||||||
"""
|
"""
|
||||||
TS6 SID Generator. <query> is a 3 character string with any combination of
|
TS6 SID Generator. <query> is a 3 character string with any combination of
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
unreal.py: UnrealIRCd 4.x protocol module for PyLink.
|
unreal.py: UnrealIRCd 4.x protocol module for PyLink.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
|
||||||
import codecs
|
import codecs
|
||||||
import socket
|
|
||||||
import re
|
import re
|
||||||
|
import socket
|
||||||
|
import time
|
||||||
|
|
||||||
from pylinkirc import utils, conf
|
from pylinkirc import conf, utils
|
||||||
from pylinkirc.classes import *
|
from pylinkirc.classes import *
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
from pylinkirc.protocols.ts6_common import *
|
from pylinkirc.protocols.ts6_common import *
|
||||||
|
1
pylink
1
pylink
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from pylinkirc import launcher
|
from pylinkirc import launcher
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
Password hashing utility for PyLink IRC Services.
|
Password hashing utility for PyLink IRC Services.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pylinkirc.coremods.login import pwd_context
|
|
||||||
import getpass
|
import getpass
|
||||||
|
|
||||||
|
from pylinkirc.coremods.login import pwd_context
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
4
setup.py
4
setup.py
@ -1,6 +1,8 @@
|
|||||||
"""Setup module for PyLink IRC Services."""
|
"""Setup module for PyLink IRC Services."""
|
||||||
|
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from codecs import open
|
||||||
|
|
||||||
if sys.version_info < (3, 4):
|
if sys.version_info < (3, 4):
|
||||||
raise RuntimeError("PyLink requires Python 3.4 or higher.")
|
raise RuntimeError("PyLink requires Python 3.4 or higher.")
|
||||||
@ -9,8 +11,6 @@ try:
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError("Please install Setuptools and try again.")
|
raise ImportError("Please install Setuptools and try again.")
|
||||||
from codecs import open
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
with open('VERSION', encoding='utf-8') as f:
|
with open('VERSION', encoding='utf-8') as f:
|
||||||
version = f.read().strip()
|
version = f.read().strip()
|
||||||
|
@ -7,14 +7,14 @@ This module contains custom data structures that may be useful in various situat
|
|||||||
import collections
|
import collections
|
||||||
import collections.abc
|
import collections.abc
|
||||||
import json
|
import json
|
||||||
import pickle
|
|
||||||
import os
|
import os
|
||||||
|
import pickle
|
||||||
|
import string
|
||||||
import threading
|
import threading
|
||||||
from copy import copy, deepcopy
|
from copy import copy, deepcopy
|
||||||
import string
|
|
||||||
|
|
||||||
from .log import log
|
|
||||||
from . import conf
|
from . import conf
|
||||||
|
from .log import log
|
||||||
|
|
||||||
_BLACKLISTED_COPY_TYPES = []
|
_BLACKLISTED_COPY_TYPES = []
|
||||||
|
|
||||||
|
@ -3,8 +3,10 @@ Test cases for utils.py
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from pylinkirc import utils
|
from pylinkirc import utils
|
||||||
|
|
||||||
|
|
||||||
class UtilsTestCase(unittest.TestCase):
|
class UtilsTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_strip_irc_formatting(self):
|
def test_strip_irc_formatting(self):
|
||||||
|
20
utils.py
20
utils.py
@ -5,20 +5,20 @@ This module contains various utility functions related to IRC and/or the PyLink
|
|||||||
framework.
|
framework.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import string
|
|
||||||
import re
|
|
||||||
import importlib
|
|
||||||
import os
|
|
||||||
import collections
|
|
||||||
import argparse
|
import argparse
|
||||||
import ipaddress
|
import collections
|
||||||
import functools
|
import functools
|
||||||
|
import importlib
|
||||||
from .log import log
|
import ipaddress
|
||||||
from . import world, conf, structures
|
import os
|
||||||
|
import re
|
||||||
|
import string
|
||||||
|
|
||||||
# Load the protocol and plugin packages.
|
# Load the protocol and plugin packages.
|
||||||
from pylinkirc import protocols, plugins
|
from pylinkirc import plugins, protocols
|
||||||
|
|
||||||
|
from . import conf, structures, world
|
||||||
|
from .log import log
|
||||||
|
|
||||||
PLUGIN_PREFIX = plugins.__name__ + '.'
|
PLUGIN_PREFIX = plugins.__name__ + '.'
|
||||||
PROTOCOL_PREFIX = protocols.__name__ + '.'
|
PROTOCOL_PREFIX = protocols.__name__ + '.'
|
||||||
|
2
world.py
2
world.py
@ -2,9 +2,9 @@
|
|||||||
world.py: Stores global variables for PyLink, including lists of active IRC objects and plugins.
|
world.py: Stores global variables for PyLink, including lists of active IRC objects and plugins.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from collections import defaultdict, deque
|
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
from collections import defaultdict, deque
|
||||||
|
|
||||||
# This indicates whether we're running in tests mode. What it actually does
|
# This indicates whether we're running in tests mode. What it actually does
|
||||||
# though is control whether IRC connections should be threaded or not.
|
# though is control whether IRC connections should be threaded or not.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user