Open malfino opened 8 years ago
The included cmdline client is not meant to be more than a simple demo, a test of the API and an example of how to build task specific ones if one so wishes. So maybe forking the tool (having a simple go cmd in a repo depending on the lib is enough) is another option, especially if further features needed for such a use case are foreseen.
OTOH a raw mode is possible to add I guess, not sure when I can get around to it.
Trying the same here ;)
Having a bot for fun (and useful purposes later for sure). However, i'm no good programmer, so my attempt is similar to @malfino , just using existent linux stuff to mis-use your program. I could probably create my own cmd, but this would be copy and pasting your code pretty much.
I also added a little -hook
cmd line switch to my local fork so textsecure is now running as daemon and sends messages to an external parser to deal with.
Communication is done via named pipe (pulled up by systemd), so the flow is:
Incoming Message > textsecure cmd > parser script (which can do stuff and answer by talking to the named pipe)
Lastly, i've added a little keyword parser into the message part which scans for slashed commands and execute other stuff based on it (all ugly, but works). Example: If i send \attachment:/tmp/whatever.jpg
this one gets sent as file attachment instead of text message.
there is this home automation service "fhem" that is widely used in Germany. We have managed to integrate your cmdline tool in a way, that your home can send status updates to your phone via signal.. A fellow user raised the question, if it'd be possible to have a bidirectional communication via signal.
We have come up with the following solution, that works.
/opt/textsecure/bin/textsecure -to="+49157xxxxxxxxx" | while read line; do mes=$(echo $line| sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" | awk '{ print substr($0, index($0,$5)) }'); $process_in_other_application $mes ; done
As you can see, we need to filter out the color-codes (sed) and suppress columns 1-4 in order to receive the plain responses and act on it.It'd be much easier, if you could add a -raw cmd-line switch that only outputs the plain message.
Additionally someone could easily tunnel a telnet or ssh session through signal, if the additional characters could be suppressed.
The following almost works, but the color-codes and other text are problematic.
mkfifo ts
nc server 23 < ts | /opt/textsecure/bin/textsecure -raw -to="+4915xxxx" > ts
It might seem purely cosmetic, but it would make shell integration much easier, if you could implement that raw mode.