Old comments

Those comments are about Neutron 0.4.2 or earlier. There are keeped for archiving purposes only.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Problem starting neutron

I have installed the latest version of neutron on my jabber server (Suse 9.1) and when I try and start it with ./neutron.py I get this:

backup:~/neutron-0.4.2 # ./neutron.py
Traceback (most recent call last):
File "./neutron.py", line 7, in ?
import xmpp
File "modules/xmpp/__init__.py", line 29, in ?
import simplexml,protocol,debug,auth,transports,roster,dispatcher,features,browser,filetransfer
File "modules/xmpp/simplexml.py", line 20, in ?
import xml.parsers.expat
ImportError: No module named xml.parsers.expat

Please, any clues? I can't find a module names xml.parsers.expat anywhere.

Thanks
Mick

xml.parsers.expat is a standard Python library

xml.parsers.expat is a standard library in Python, it should be easy to get on any distro.

For example, in Debian it is included in a package called python2.3-xml.

Take a look at Suse. Once you find a way to install it, could you please comment it here for other Suse users? Thanks.

pythion.xml not installed by default in SUSE 9.1

OK, thanks. It seems installing the main python module in SUSE 9.1 via YaST doen't install a module called python.xml, which must be installed separately. Apparently newer SUSE Python modules include this module by default. Should have upgraded my install after installing Python, it seems.

Now It will run, but won't connect and start. I get this now:

....
File "./neutron.py", line 452, in ?
start()
File "./neutron.py", line 425, in start
if JCON.auth(USERNAME, PASSWORD, RESOURCE):
File "modules/xmpp/client.py", line 195, in auth
if auth.NonSASL(user,password,resource).PlugIn(self):
File "modules/xmpp/client.py", line 71, in PlugIn
if self.__class__.__dict__.has_key('plugin'): return self.plugin(owner)
File "modules/xmpp/auth.py", line 46, in plugin
resp=owner.Dispatcher.SendAndWaitForResponse(Iq('get',NS_AUTH,payload=[Node('username',payload=[self.user])]))
File "modules/xmpp/dispatcher.py", line 274, in SendAndWaitForResponse
return self.WaitForResponse(self.send(stanza),timeout)
File "modules/xmpp/dispatcher.py", line 258, in WaitForResponse
if not self.Process(0.04):
File "modules/xmpp/dispatcher.py", line 98, in Process
data=self._owner.Connection.receive()
File "modules/xmpp/transports.py", line 106, in receive
self._owner.disconnected()
File "modules/xmpp/client.py", line 123, in disconnected
for i in self.disconnect_handlers: i()
File "modules/xmpp/client.py", line 131, in DisconnectHandler
raise IOError('Disconnected from server.')
IOError: Disconnected from server.

Do I need to change the RESOURCES or the ADMIN PASSWORD settings in config.txt? The install instructions don't mention them, but it's the only thing I can see that might need to be changed.

Thanks
Mick

It should work

Do I need to change the RESOURCES or the ADMIN PASSWORD settings in config.txt? The install instructions don't mention them, but it's the only thing I can see that might need to be changed.

No, that is enought. I've downloaded Neutron 0.4.2, unpacked, modified SERVER, PORT, USERNAME and PASSWORD on config.txt and it logins correctly. If I put wrong data in those parameters Neutron shows an error message, but not the same as you.

Different problem

OK, I changed the SERVER parameter from FQDN to the hostname (neutron installed on jabber server). Now I don't get those errors, I get just this, after all the scripts are read when I run neutron.py:

Connected
eek -> feature-not-implemented 501

Is there something I have to turn on in the server config??

Thanks for you help, I really want to get this bot working if I can.

Cheers
Mick

problem in getting it working properly

Just in case anyone else has similar problems I found that I was unable to get the chatbot to work unless I had it running on the same server as the ejabber server. I am not sure if it is a firewall problem as I was able to log into the neutron user using gaim from the server I was trying to set it up on. From the ejabber log I could see that it had connected successfully and the web admin said that the user was online but gaim would not show the presence and I got no response. I ended up creating the neutron@localhost user and then adding that to the roster of the admin user and it appeared in my gaim fine and I was able to admin it.

I am also using the starttls_required option so it appears that it works fine with tls.

Works great!
Thankyou

Chat Logging

I've tried out bandersnatch and I'm leaning more towards neutron to log chat rooms instead (since bandersnatch logs ALL in/out messages).

A couple of questions:

1. Is there a way to adjust the timezone setting of the client? It seems to be set to GMT/UTC. I can't find a config (except the source itself) to change it.

2. I noticed for logging, a file is open and kept until the conversation ends. I was wondering if there was a way to rollover logs -- useful for chatrooms where they can stay open but have a new log opened when the date changes.

I pointed Mike Mintz to your

I pointed Mike Mintz to your questions, and here are his responses:

1. Is there a way to adjust the timezone setting of the client?

There's no config option for it, but if you search plugins/log_plugin.py for the two instances of gmtime() and change them to localtime() it puts it in the local timezone.

If you think it is important, I can add a config thing to specify GMT offset hours.

I was wondering if there was a way to rollover logs

I thought it already did that by default. Doesn't it make a new file every time the date changes?

SSL support?

Does neutron support connecting to Jabber servers over SSL (i.e. port 5223 instead of 5222)?

If so, then that should probably be documented in the README (but it doesn't look like it is supported).

If not, then what would it take to be added? I am not super familiar with the Jabber protocol, but I assume the only difference is that an SSL connection is established with the server before the normal authentication proceeds. With some pointers I'd be happy to work on it.

I think both SSL and STARTTLS are supported

If I remember correctly, the author told me that you just need to configure Neutron on config.txt to use the port 5223, and it will use SSL automatically.

Maybe it even tries to use STARTTLS on 5222 if the server supports it.

register_presence_handler?

is there a register_presence_handler that trigers on changes in pressence. I wan't to execute commands when people go away/online/offline..

I reported your question to

I reported your question to Mike Mintz, and he answered this:

About the presence handler: tell this person to look at presence_plugin.py. They can just make a similar plugin, but on these two lines:

 elif type == 'available':
  pass
 elif type == 'unavailable':
  pass

instead of "pass", actually have a command. I think I might have done it wrong, so there should be a type == None or something like that for available presence, but I'd have to look into it.

Misstype in plugins/admin_plugin.py

There is no global variable NICK setted in neutron.py. There is only DEFAULT_NICK.
so nick = NICK in handler_admin_join, must be nick = DEFAULT_NICK

A small annoying bug in log_plugin.py

Current code:

def log_regex_url(matchobj):
    return '<a href="' + matchobj.string + '">' + matchobj.string + '</a>'

body = [..] body.replace('\n', '<br />')
body = re.sub('(http|ftp)(\:\/\/\S+)', log_regex_url, body)

This sequence of htmlizers and misuse of matchobj.string causes an endless span of an <a> tag in the case when url in multiline message is immediately followed by a new line.

Example log (look at 22:49)

Proposed fixed code:

def log_regex_url(matchobj):
    return '<a href="' + matchobj.group(0) + '">' + matchobj.group(0) + '</a>'

    body = re.sub('(http|ftp)\:\/\/[^\s<]+', log_regex_url, body)

Syndicate content