Coder Social home page Coder Social logo

signal-weechat's Introduction

Signal Weechat

Use Signal (via signald) in weechat.

Dependencies

Required:

  • Weechat
  • signald

Optional:

  • qrcode python library (pip install qrcode/apt install python-qrcode) - required to render QR codes when linking to new devices

Installing

  1. Install this script: cp signal.py ~/.weechat/python/signal.py
  2. Load it in weechat: /python load signal.py
  3. Connect to signald via netcat to either register or link an account. Qrcodes can be encoded via qrencode.

Use

  • /smsg +12025551212
  • /signal list contacts
  • /signal list groups
  • /signal attach <comma-separated filename(s)>

Limitations

Some current limitations:

  • Can only register one number.
  • No read receipts

TODO

  • Handle syncMessage read receipts

Support

Feel free to file an issue

Contributing

Pull requests welcome.

signal-weechat's People

Contributors

jspricke avatar mic92 avatar schubisu avatar thefinn93 avatar tych0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

signal-weechat's Issues

Requires $DISPLAY

It appears that python-dbus prevents me from executing this while running Weechat on a headless SSH server behind tmux(1) or screen(1).

python: stdout/stderr (signal): Traceback (most recent call last):
python: stdout/stderr (signal):   File "/home/aaron/.weechat/python/signal.py", line 115, in send
python: stdout/stderr (signal):     getSignal().sendMessage(message, dbus.Array(signature="s"), number)
python: stdout/stderr (signal):   File "/home/aaron/.weechat/python/signal.py", line 104, in getSignal
python: stdout/stderr (signal):     bus = dbus.SessionBus()
python: stdout/stderr (signal):   File "/usr/lib/python2.7/dist-packages/dbus/_dbus.py", line 211, in __new__
python: stdout/stderr (signal):     mainloop=mainloop)
python: stdout/stderr (signal):   File "/usr/lib/python2.7/dist-packages/dbus/_dbus.py", line 100, in __new__
python: stdout/stderr (signal):     bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
python: stdout/stderr (signal):   File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 122, in __new__
python: stdout/stderr (signal):     bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
python: stdout/stderr (signal): dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
=!= python: error in function "send"

Command link doesn't work

Hi,
I seem to be unable to run the command link.
I use Weechat 1.9 on ArchLinux with OpenJDK 1.8. Here is exactly what I did:

cd ~/.weechat/python
wget https://raw.githubusercontent.com/thefinn93/signal-weechat/master/signal.py

Then in weechat:

/script load signal.py
/signal install
/signal link

The last is idling on the following message:

Preparing to link to a device...

How can I link the device ? Thanks.

Support for weechat-notify-send?

It would appear that signal-weechat doesn't work with weechat-notify-send, is this what you would expect?

I am fairly new to WeeChat so am not too familiar with how it works "internally". My goal is to be notified of Signal messages on my Linux machine without needing Signal Desktop open. Is this a feature I would need to add myself if I wanted it? Not sure if I've just missed something somewhere.

clarify license

hi there,
to users out there it might be nice to know under what type of license the source code is distributed.
would it perhaps be possible to add a license to clarify?

Messages I send via other signal clients don't show up in weechat

I'm trying your script out (thanks for making it!) and have noticed that messages I send to others via signal-weechat/signald show up on the official signal desktop client and android app, but that messages I send to others via the desktop client or android app do not show up on signal-weechat/signald.

I'm curious - is that by design? Do I have something mis-configured? Is it a bug?

Any help or pointers welcome - thanks!

how to make this work with non-default socket location

I'm running signald as container and path to the socket is not the default one. I've tried to change it in the default_options{ socket}, but no luck. Maybe I'm doing something wrong, please see below:

x@arch ~ % tail -n 5 ~/.weechat/logs/signal.log
ERROR:weechat_script:Failed to connect to signald socket
Traceback (most recent call last):
	File "/home/x/.weechat/python/signal.py", line 341, in init_socket
		signald_socket.connect(options["socket"])
FileNotFoundError: [Errno 2] Nie ma takiego pliku ani katalogu
x@arch ~ % grep docker/run ~/.weechat/python/signal.py
"socket": "/home/x/docker/run/signald.sock",
x@arch ~ % ls -la /home/x/docker/run/signald.sock
srw-rw-rw- 1 100999 100999 0 10-02 10:26 /home/x/docker/run/signald.sock
x@arch ~ % nc -U /home/x/docker/run/signald.sock
{"type":"version","data":{"name":"signald","version":"unversioned","branch":"","commit":""}}
#it works with netcat

Thank you

Doesn't handle attachments well

It's not entirely clear what to do when we need to show a message with an attachment. currently we don't show it, nor do we mention that we're not showing it.

error when sending via /smsg

On getting linked to an existing account via the signal-cli executable in a terminal ("$ ./signal-cli link"), I attempted to send a signal message in weechat using /smsg and got the following error:

python: stdout/stderr: Traceback (most recent call last):
python: stdout/stderr: File "/home/buck/.weechat/python/autoload/signal.py", line 115, in send
python: stdout/stderr: getSignal().sendMessage(message, dbus.Array(signature="s"), number)
python: stdout/stderr: File "/home/buck/.weechat/python/autoload/signal.py", line 105, in getSignal
python: stdout/stderr: return bus.get_object('org.asamk.Signal', '/org/asamk/Signal')
python: stdout/stderr: File "/usr/local/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
python: stdout/stderr: follow_name_owner_changes=follow_name_owner_changes)
python: stdout/stderr: File "/usr/local/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in init
python: stdout/stderr: self._named_service = conn.activate_name_owner(bus_name)
python: stdout/stderr: File "/usr/local/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
python: stdout/stderr: self.start_service_by_name(bus_name)
python: stdout/stderr: File "/usr/local/lib/python2.7/dist-packages/dbus/bus.py", line 278, in
start_service_by_name
python: stdout/stderr: 'su', (bus_name, flags)))
python: stdout/stderr: File "/usr/local/lib/python2.7/dist-packages/dbus/connection.py", line 651,
in call_blocking
python: stdout/stderr: message, timeout)
python: stdout/stderr: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.asamk.Signal was not provided by any .service files
python: error in function "send"

-Weechat 2.0-dev, Xubuntu 17.04, OpenJDK-8 (from package in ubuntu repo)
-Used script gotten by cloning project and copying into ~./.weechat/python/autoload/
-"/script load signal.py", "/signal install"

cannot see replies

i see in the README that you have "No read receipts" - but i was assuming you'd at least see replies from other users. right now, with Signal-cli 0.5.5, i do not see replies...

i tried to enable debugging, but i do not actually see any more information.

note that i do see messages coming in from the daemon command output on another terminal... maybe this is related to the issues i have with automatically starting that daemon (see #3)?

Insecure handing of /tmp

There are several cases where this plugin creates files in /tmp/ in an insecure way:

tarball = "/tmp/signal-cli-%s.tar.gz" % new_version
filename = "/tmp/%s" % asset['name']

The issue is if an attacker on the same system can create a symlink in /tmp/ since it is world-writeable and therefore trick the plugin into writing to it: https://owasp.org/www-community/vulnerabilities/Insecure_Temporary_File

An attacker could even gain write-access to the signal-cli tarball and modify it during the update process.

The fix is to use python's tempfile module: https://docs.python.org/3.8/library/tempfile.html
This also takes care of deleting data after being used

Can't handle unicode

A friend texted me some unicode characters (a ฤ‰ character and some emoji) resulting in this error:

python: wrong arguments for function "prnt" (script: signal)
python: stdout/stderr: UnicodeEncodeError: 'ascii' codec can't encode character u'\u0109' in position 25: ordinal not in range(128)
python: error in function "receive"

We should be able to deal with unicode.

/smsg Doesn't seem to do anything

I have been trying to send a message via /smsg +1XXXYYYXXXX my message contents in Weechat and nothing happens. I haven't found any relevant error logs in ~/.weechat/logs to indicate why nothing is happening.

If somebody sends me a message I get them and I am able to respond without an issue to the conversations when they appear in my buffer after someone sends me a message. Everything seems to work except composing and sending a new message with /smsg.

I have Weechat running in a Docker container (the Dockerfile and relevant run.sh are here in case you want to reference) and I have the signal.py plugin installed in the correct directory:

/weechat # ls -l /weechat/.weechat/python/signal.py 
-rw-r--r--    1 weechat  weechat      13578 Sep 17 00:12 /weechat/.weechat/python/signal.py

I have signald also running in a Docker container and that's what is running my back end. I don't see any relevant logs from signald either.

So, a couple of questions:

  1. Is there a logfile I should specifically look at for error logs? I'm pretty sure I would have found it if there was an error, but still, maybe I missed it.
  2. Any ideas on what I'm missing? Perhaps my Docker container is missing a dependency that signal-weechat relies on?

Thanks for any suggestions! :)

New socket file location

Hello,
This is to let you know that signald is moving it's default socket file location. The old location and the new location should both be searched, as the old location isn't being deprecated any time soon.

more details in #66, although what you need to know is:

please ensure your client's default behavior when the user has not specified a different path to the socket file is to first attempt to connect to $XDG_RUNTIME_DIR/signald/signald.sock, then fall back to /var/run/signald/signald.sock.

signald has a CLI flag --user-socket to it to make it use the new behavior.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.