sleduc / weechat-xmpp Goto Github PK
View Code? Open in Web Editor NEWA fork of the jabber plugin for weechat
A fork of the jabber plugin for weechat
Is is possible to update the README with the usage? Is it the same as the short explanation listed here? http://dev.weechat.org/post/2010/08/04/Script-jabber.py
when i use strace with weechat's pid
it show me log as follows:
fcntl(42, F_GETFD) = 0
poll([{fd=5, events=POLLIN}, {fd=9, events=POLLIN}, {fd=11, events=POLLIN}, {fd=0, events=POLLIN}, {fd=29, events=POLLIN}, {fd=22, events=POLLIN}, {fd=27, events=POLLIN}, {fd=25, events=POLLIN}, {fd=36, events=POLLIN}, {fd=42, events=POLLIN}], 10, 5) = 1 ([{fd=42, revents=POLLIN}])
read(42, "", 5) = 0
read(42, "", 5) = 0
fcntl(5, F_GETFD) = 0
fcntl(9, F_GETFD) = 0
fcntl(11, F_GETFD) = 0
fcntl(0, F_GETFD) = 0
fcntl(29, F_GETFD) = 0
fcntl(22, F_GETFD) = 0
fcntl(27, F_GETFD) = 0
fcntl(25, F_GETFD) = 0
fcntl(36, F_GETFD) = 0
fcntl(42, F_GETFD) = 0
poll([{fd=5, events=POLLIN}, {fd=9, events=POLLIN}, {fd=11, events=POLLIN}, {fd=0, events=POLLIN}, {fd=29, events=POLLIN}, {fd=22, events=POLLIN}, {fd=27, events=POLLIN}, {fd=25, events=POLLIN}, {fd=36, events=POLLIN}, {fd=42, events=POLLIN}], 10, 5) = 1 ([{fd=42, revents=POLLIN}])
read(42, "", 5) = 0
read(42, "", 5) = 0
fcntl(5, F_GETFD) = 0
fcntl(9, F_GETFD) = 0
fcntl(11, F_GETFD) = 0
fcntl(0, F_GETFD) = 0
fcntl(29, F_GETFD) = 0
fcntl(22, F_GETFD) = 0
fcntl(27, F_GETFD) = 0
fcntl(25, F_GETFD) = 0
fcntl(36, F_GETFD) = 0
fcntl(42, F_GETFD) = 0
poll([{fd=5, events=POLLIN}, {fd=9, events=POLLIN}, {fd=11, events=POLLIN}, {fd=0, events=POLLIN}, {fd=29, events=POLLIN}, {fd=22, events=POLLIN}, {fd=27, events=POLLIN}, {fd=25, events=POLLIN}, {fd=36, events=POLLIN}, {fd=42, events=POLLIN}], 10, 4) = 1 ([{fd=42, revents=POLLIN}])
read(42, "", 5) = 0
read(42, "", 5) = 0
fcntl(5, F_GETFD) = 0
fcntl(9, F_GETFD) = 0
fcntl(11, F_GETFD) = 0
fcntl(0, F_GETFD) = 0
fcntl(29, F_GETFD) = 0
fcntl(22, F_GETFD) = 0
fcntl(27, F_GETFD) = 0
fcntl(25, F_GETFD) = 0
fcntl(36, F_GETFD) = 0
fcntl(42, F_GETFD) = 0
poll([{fd=5, events=POLLIN}, {fd=9, events=POLLIN}, {fd=11, events=POLLIN}, {fd=0, events=POLLIN}, {fd=29, events=POLLIN}, {fd=22, events=POLLIN}, {fd=27, events=POLLIN}, {fd=25, events=POLLIN}, {fd=36, events=POLLIN}, {fd=42, events=POLLIN}], 10, 1) = 1 ([{fd=42, revents=POLLIN}])
read(42, "", 5) = 0
read(42, "", 5)
In Fact a better Argument parsing would be better.
https://docs.python.org/3/library/argparse.html
Il would be great if thoses kind of part use argparse:
def jabber_cmd_jabber(data, buffer, args):
""" Command '/jabber'. """
global jabber_servers, jabber_config_option
if args == "" or args == "list":
jabber_list_servers_chats("")
else:
argv = args.split(" ")
argv1eol = ""
pos = args.find(" ")
if pos > 0:
argv1eol = args[pos+1:]
if argv[0] == "list":
jabber_list_servers_chats(argv[1])
elif argv[0] == "add":
if len(argv) >= 4:
server = jabber_search_server_by_name(argv[1])
if server:
weechat.prnt("", "jabber: server '%s' already exists" % argv[1])
else:
kwargs = {'jid': argv[2], 'password': argv[3]}
if len(argv) > 4:
conn_server, _, conn_port = argv[4].partition(':')
if conn_port and not conn_port.isdigit():
weechat.prnt("", "jabber: error, invalid port, digits only")
return weechat.WEECHAT_RC_OK
if conn_server: kwargs['server'] = conn_server
if conn_port: kwargs['port'] = conn_port
server = Server(argv[1], **kwargs)
jabber_servers.append(server)
weechat.prnt("", "jabber: server '%s' created" % argv[1])
else:
weechat.prnt("", "jabber: unable to add server, missing arguments")
weechat.prnt("", "jabber: usage: /jabber add name jid password [server[:port]]")
elif argv[0] == "alias":
alias_command = AliasCommand(buffer, argv=argv[1:])
alias_command.run()
elif argv[0] == "connect":
# [...]
with command
/jabber add facebook xxxxx xxxxxxxxxx chat.facebook.com:5222
The following traceback was generated:
python: stdout/stderr: Traceback (most recent call last):
python: stdout/stderr: File "/usr/share/weechat/python/jabber.py", line 1952, in jabber_fd_cb
python: stdout/stderr: server.recv()
python: stdout/stderr: File "/usr/share/weechat/python/jabber.py", line 686, in recv
python: stdout/stderr: self.client.Process(1)
python: stdout/stderr: File "/usr/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 303, in dispatch
python: stdout/stderr: handler['func'](session,stanza)
python: stdout/stderr: File "/usr/share/weechat/python/jabber.py", line 679, in message_handler
python: stdout/stderr: recv_object.recv_muc_message(buddy, resource.encode("utf-8"), body.encode("utf-8"))
python: stdout/stderr: UnboundLocalError: local variable 'resource' referenced before assignment
python: error in function "jabber_fd_cb"
| weechat | python: stdout/stderr (jabber): Traceback (most recent call last):
│ weechat | python: stdout/stderr (jabber): File "/home/l3d/.weechat/python/autoload/jabber.py", line 1952, in jabber_fd_cb
│ weechat | python: stdout/stderr (jabber): server.recv()
│ weechat | python: stdout/stderr (jabber): File "/home/l3d/.weechat/python/autoload/jabber.py", line 686, in recv
│ weechat | python: stdout/stderr (jabber): self.client.Process(1)
| weechat | python: stdout/stderr (jabber): File "/usr/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 122, in Process
│ weechat | python: stdout/stderr (jabber): self.Stream.Parse(data)
| weechat | python: stdout/stderr (jabber): xml.parsers.expat.ExpatError: parsing finished: line 2, column 186
│ weechat =!= | python: error in function "jabber_fd_cb"
All 5 minutes I get this error.
Please help!
It would be super cool to have the OTR support on this weechat plugin !
I don't ever know how XMPP is doing this.
Fails at the 3rd step.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.