# both!)
# If in doubt always re-compile and restart.
+# The following line is required, don't remove it!
+from qwebirc.config_options import *
+
# IRC OPTIONS
# ---------------------------------------------------------------------
#
REALNAME = "http://moo.com/"
# OPTION: IDENT
-# ident to use on irc, set to the literal value None to use a
-# hexadecimal version of the IP address, e.g.:
-# IDENT = None
+# ident to use on irc, possible values include:
+# - a string, e.g. IDENT = "webchat"
+# - the literal value IDENT_HEX, this will set the ident to the
+# a hexadecimal version of the users IP address, e.g
+# IDENT = HEX_IDENT
+# - the literal value IDENT_NICKNAME, this will use the users
+# supplied nickname as their ident.
IDENT = "webchat"
# OPTION: WEBIRC_MODE
-from root import RootSite
--- /dev/null
+IDENT_HEX = object()\r
+IDENT_NICKNAME = object()\r
+WEBIRC_REALNAME = object()
\ No newline at end of file
from twisted.names import client
from twisted.internet import reactor, error
from authgateengine import login_optional, getSessionData
-import simplejson, md5, sys, os, time, config, weakref, traceback, socket
+import simplejson, md5, sys, os, time, config, qwebirc.config_options as config_options, traceback, socket
import qwebirc.ircclient as ircclient
from adminengine import AdminEngineAction
from qwebirc.util import HitCounter
perform = ["PRIVMSG %s :TICKETAUTH %s" % (msg_mask, qticket)]
ident, realname = config.IDENT, config.REALNAME
- if ident is None:
+ if ident is config_options.IDENT_HEX or ident is None: # latter is legacy
ident = socket.inet_aton(ip).encode("hex")
+ elif ident is config_options.IDENT_NICKNAME:
+ ident = nick
self.__connect_hit()
client = ircclient.createIRC(session, nick=nick, ident=ident, ip=ip, realname=realname, perform=perform, hostname=hostname)
session.client = client
- if config.WEBIRC_MODE != "hmac":
+ if not hasattr(config, "WEBIRC_MODE") or config.WEBIRC_MODE == "hmac":
+ proceed(None)
+ elif config.WEBIRC_MODE != "hmac":
notice = lambda x: session.event(connect_notice(x))
notice("Looking up your hostname...")
def callback(hostname):
notice("Couldn't look up your hostname!")
proceed(ip)
qdns.lookupAndVerifyPTR(ip, timeout=[config.DNS_TIMEOUT]).addCallbacks(callback, errback)
- else:
- proceed(None) # hmac doesn't care
Sessions[id] = session
from twisted.web import resource, server
from twisted.protocols import basic
-import hmac, time, config
+import hmac, time, config, qwebirc.config_options as config_options
from config import HMACTEMPORAL
-if config.WEBIRC_MODE == "hmac":
+if hasattr(config, "WEBIRC_MODE") and config.WEBIRC_MODE == "hmac":
HMACKEY = hmac.HMAC(key=config.HMACKEY)
def hmacfn(*args):
self.__nickname = nick
self.__perform = f.get("perform")
- if config.WEBIRC_MODE == "hmac":
+ if not hasattr(config, "WEBIRC_MODE"):
+ self.write("USER %s bleh bleh %s :%s" % (ident, ip, realname))
+ elif config.WEBIRC_MODE == "hmac":
hmac = hmacfn(ident, ip)
self.write("USER %s bleh bleh %s %s :%s" % (ident, ip, hmac, realname))
elif config.WEBIRC_MODE == "webirc":
elif config.WEBIRC_MODE == "cgiirc":
self.write("PASS %s_%s_%s" % (config.CGIIRC_STRING, ip, hostname))
self.write("USER %s bleh %s :%s" % (ident, ip, realname))
- else:
+ elif config.WEBIRC_MODE == config_options.WEBIRC_REALNAME or config.WEBIRC_MODE is None: # last bit is legacy
if ip == hostname:
dispip = ip
else:
from twisted.application import internet, strports
from twisted.web import static, server
-from qwebirc import RootSite
+from qwebirc.root import RootSite
class Options(usage.Options):
optParameters = [["port", "p", "9090","Port to start the server on."],