xmlrpc: expose IRCBot.reply, use it over privmsg
converts dispatch and the admin form to reply closes bss/dr.botzo#21
This commit is contained in:
@@ -30,8 +30,8 @@ def send_privmsg(request):
|
||||
message = form.cleaned_data['message']
|
||||
|
||||
bot_url = 'http://{0:s}:{1:d}/'.format(settings.IRCBOT_XMLRPC_HOST, settings.IRCBOT_XMLRPC_PORT)
|
||||
bot = xmlrpc.client.ServerProxy(bot_url)
|
||||
bot.privmsg(target, message)
|
||||
bot = xmlrpc.client.ServerProxy(bot_url, allow_none=True)
|
||||
bot.reply(None, message, False, target)
|
||||
form = PrivmsgForm()
|
||||
else:
|
||||
form = PrivmsgForm()
|
||||
|
||||
@@ -377,7 +377,8 @@ class IRCBot(irc.client.SimpleIRCClient):
|
||||
t.start()
|
||||
|
||||
# register XML-RPC stuff
|
||||
self.xmlrpc.register_function(self.privmsg, 'privmsg')
|
||||
self.xmlrpc_register_function(self.privmsg, 'privmsg')
|
||||
self.xmlrpc_register_function(self.reply, 'reply')
|
||||
|
||||
def _connected_checker(self):
|
||||
if not self.connection.is_connected():
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from django.forms import Form, CharField
|
||||
from django.forms import Form, CharField, Textarea
|
||||
|
||||
log = logging.getLogger('markov.forms')
|
||||
|
||||
@@ -12,4 +12,4 @@ class PrivmsgForm(Form):
|
||||
"""Accept a privmsg to send to the ircbot."""
|
||||
|
||||
target = CharField()
|
||||
message = CharField()
|
||||
message = CharField(widget=Textarea)
|
||||
|
||||
Reference in New Issue
Block a user