Commit 82dafeb3 authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 2.13+dfsg

parent df4c1b68
......@@ -109,5 +109,10 @@ irker-$(VERS).md5:
dist: irker-$(VERS).tar.gz irker-$(VERS).md5
release: irker-$(VERS).tar.gz irker-$(VERS).md5 irkerd.html irk.html irkerhook.html install.html security.html hacking.html
WEBDOCS = irkerd.html irk.html irkerhook.html install.html security.html hacking.html
release: irker-$(VERS).tar.gz irker-$(VERS).md5 $(WEBDOCS)
shipper version=$(VERS) | sh -e -x
refresh: $(WEBDOCS)
shipper -N -w version=$(VERS) | sh -e -x
irker history
2.13: 2015-06-14
SSL validation fix.
Hardening agains Unicode decode errors.
irk becomes a library so it can be re-used.
2.12: 2014-10-22
Catch erroneous UTF-8 or non-UTF-8 from servers.
Also autodetect the right logging device under FreeBSD: /var/run/syslog
......
......@@ -3,22 +3,23 @@
Package: irker
Description: An IRC client that runs as a daemon accepting notification requests
as JSON objects presented to a listening socket. It is meant to be
used by hook scripts in version-control repositories, allowing them
to send commit notifications to project IRC channels. A hook script
that works with git, hg, and svn is included in the distribution.
Description: An IRC client that runs as a daemon accepting notification requests.
You preesnt them JSON objects presented to a listening socket. It is
meant to be used by hook scripts in version-control repositories,
allowing them to send commit notifications to project IRC channels.
A hook script that works with git, hg, and svn is included in the
distribution.
XBS-Gitorious-URL: https://gitorious.org/irker
XBS-Ohloh-URL: http://www.ohloh.net/p/irker
XBS-Destinations: freecode
#XBS-Destinations: freshcode
Homepage: http://www.catb.org/~esr/irker
XBS-HTML-Target: index.html
XBS-Repository-URL: https://gitlab.com/esr/irker
XBS-OpenHub-URL: http://www.openhub.net/p/irker
XBS-IRC-Channel: irc://chat.freenode.net/#irker
XBS-Logo: irker-logo.png
......
......@@ -33,7 +33,7 @@ type switch. It can deduce the repo type by looking, so it should.
== Release procedure ==
1. Check for merge requests at https://gitorious.org/irker
1. Check for merge requests at the repository.
2. Do 'make pylint' to audit the code.
......
......@@ -12,28 +12,38 @@ import socket
import sys
import fileinput
DEFAULT_SERVER = ("localhost", 6659)
def connect(server = DEFAULT_SERVER):
return socket.create_connection(server)
def send(s, target, message):
data = {"to": target, "privmsg" : message}
#print(json.dumps(data))
s.sendall(json.dumps(data))
def irk(target, message, server = DEFAULT_SERVER):
s = connect(server)
if "irc:" not in target and "ircs:" not in target:
target = "irc://chat.freenode.net/{0}".format(target)
if message == '-':
for line in fileinput.input('-'):
send(s, target, line.rstrip('\n'))
else:
send(s, target, message)
s.close()
def main():
target = sys.argv[1]
message = " ".join(sys.argv[2:])
# XXX: why is this necessary?
message = message.decode('string_escape')
try:
s.sendall(json.dumps(data))
except socket.error, e:
irk(target, message)
except socket.error as e:
sys.stderr.write("irk: write to server failed: %r\n" % e)
sys.exit(1)
try:
s = socket.create_connection(("localhost", 6659))
except socket.error, e:
sys.stderr.write("irk: no irkerd running: %r\n" % e)
sys.exit(1)
target = sys.argv[1]
if "irc:" not in target and "ircs:" not in target:
target = "irc://chat.freenode.net/{0}".format(target)
message = " ".join(sys.argv[2:])
message = message.decode('string_escape')
if message == '-':
for line in fileinput.input('-'):
send(s, target, line.rstrip('\n'))
else:
send(s, target, message)
s.close()
if __name__ == '__main__':
main()
......@@ -40,7 +40,7 @@ CONNECTION_MAX = 200 # To avoid hitting a thread limit
# No user-serviceable parts below this line
version = "2.12"
version = "2.13"
import argparse
import logging
......@@ -248,6 +248,8 @@ class IRCServerConnection():
ssl_version=protocol, ca_certs=cafile)
else:
ssl_context.verify_mode = ssl.CERT_REQUIRED
if certfile:
ssl_context.load_cert_chain(certfile)
if cafile:
ssl_context.load_verify_locations(cafile=cafile)
else:
......@@ -843,9 +845,11 @@ class Irker:
def _handle_every_raw_message(self, _connection, event):
"Log all messages when in watcher mode."
if self.logfile:
with open(self.logfile, "a") as logfp:
logfp.write("%03f|%s|%s\n" % \
(time.time(), event.source, event.arguments[0]))
with open(self.logfile, "ab") as logfp:
message = u"%03f|%s|%s\n" % \
(time.time(), event.source, event.arguments[0])
logfp.write(message.encode('utf-8'))
def pending(self):
"Do we have any pending message traffic?"
return [k for (k, v) in self.servers.items() if v.pending()]
......@@ -987,7 +991,7 @@ if __name__ == '__main__':
if not args.log_file and in_background():
# The Linux, Mac, and FreeBSD values of the logging device.
logdev = [x for x in ('/dev/log', '/var/run/syslog', '/var/run/log')
if os.path.exists(x)]
if os.path.exists(x) and not os.path.isdir(x)]
if len(logdev) != 1:
sys.stderr.write("can't initialize log device, bailing out!\n")
raise SystemExit(1)
......
......@@ -37,7 +37,7 @@ default_channels = "irc://chat.freenode.net/#commits"
# No user-serviceable parts below this line:
#
version = "2.11"
version = "2.13"
import os, sys, commands, socket, urllib, subprocess, locale, datetime, re
from pipes import quote as shellquote
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment