Difference between revisions of "Irssi-otr"

From ArchWiki
Jump to: navigation, search
(Some content)
m (a few style fixes)
(20 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Category:Internet and Email (English)]]
+
[[Category:Internet Applications]]
[[Category:HOWTOs (English)]]
+
[[Category:Internet Relay Chat]]
 
+
=About=
+
 
+
 
The [http://irssi-otr.tuxfamily.org/ irssi-otr] module brings
 
The [http://irssi-otr.tuxfamily.org/ irssi-otr] module brings
 
[http://www.cypherpunks.ca/otr/ Off-the-Record Messaging] to your
 
[http://www.cypherpunks.ca/otr/ Off-the-Record Messaging] to your
 
[http://irssi.org/ favorite IRC client].
 
[http://irssi.org/ favorite IRC client].
  
=Installing=
+
==Installing==
  
You can install the Irssi OTR module from the
+
You can install the {{AUR|irssi-otr}} module from the [[AUR]].
[http://aur.archlinux.org/packages.php?ID=19488 AUR].
+
If you like to test bleeding edge software, there is also {{AUR|irssi-otr-git}}.
If you like to test bleeding edge software, there is also a
+
[http://aur.archlinux.org/packages.php?ID=23366 Git version].
+
  
=Usage=
+
==Usage==
  
An example session ;)
+
See the
 
+
[http://git.tuxfamily.org/irssiotr/irssiotr.git?p=gitroot/irssiotr/irssiotr.git;a=blob_plain;f=README;hb=HEAD README].
/load otr
+
/query someone ?OTR?
+
Encypted message!
+
/otr finish
+
/unload otr
+
 
+
=Automatic loading & unloading=
+
  
 
==Loading the module on startup==
 
==Loading the module on startup==
 +
 +
If you are tired of typing {{Ic|/LOAD otr}} you can put the following
 +
in your {{Ic|~/.irssi/startup}}:
  
 
  LOAD otr
 
  LOAD otr
  
==Finishing conversations on /quit==
+
==Stripping HTML==
  
/alias QUIT unload otr; quit
+
If you are using irssi-otr with [[Bitlbee | BitlBee]] you will notice
 
+
that some clients send you HTML formatted messages.  Normally BitlBee
=Stripping HTML=
+
 
+
If you use irssi-otr with [[Bitlbee | BitlBee]] you will notice that
+
some clients send you HTML formatted messages.  Normally BitlBee
+
 
automatically strips the HTML formatting, but since the messages are
 
automatically strips the HTML formatting, but since the messages are
encrypted this doesn't work anymore.  Nevertheless you can achieve
+
encrypted this does not work anymore.  Nevertheless you can achieve
 
the same by stripping the HTML with regular expressions using the
 
the same by stripping the HTML with regular expressions using the
 
[http://wouter.coekaerts.be/site/irssi/trigger Trigger script].  Just make
 
[http://wouter.coekaerts.be/site/irssi/trigger Trigger script].  Just make
sure you load the script before the otr module either manually or make
+
sure you load the script before the otr module.  You can either do this
your ~/.irssi/startup look like this:
+
manually or again make your {{Ic|~/.irssi/startup}} look like this:
  
 
  SCRIPT LOAD trigger.pl
 
  SCRIPT LOAD trigger.pl
 
  LOAD otr
 
  LOAD otr
  
-privmsgs -nocase -tags 'BitlBee' -regexp '</?(a|b|body|div|em|font|i|s|u)( +\w+=".*?")*>' -replace ''
+
Also make sure that {{Ic|trigger.pl}} is not in
 +
{{Ic|~/.irssi/scripts/autorun}} since the files from this directory
 +
are loaded after {{Ic|~/.irssi/startup}}.
  
Finally convert some escaped HTML characters:
+
Since it is not possible to perfectly match HTML code with regular
 +
expressions we will take a somewhat conservative approach.  We will only
 +
strip HTML tags we explicitly specified from PRIVMSGS from the BitlBee
 +
network, where we assume you added you server.
 +
 
 +
You can {{Ic|/TRIGGER add}} the following lines or copy them to
 +
{{Ic|~/.irssi/triggers}}.
 +
 
 +
{{bc|<nowiki>
 +
-privmsgs -nocase -tags 'BitlBee' -regexp '</?(a|b|body|div|em|font|i|s|u)( +\w+=".*?")*>' -replace ''
 +
</nowiki>}}
 +
 
 +
You can even make HTML line breaks look like multiple messages:
 +
 
 +
-privmsgs -nocase -tags 'BitlBee' -regexp '(\s*&lt;br&gt;\s*)+' -replace '\n�8/<�g�</$N�8/>�g �e'
 +
 
 +
Where {{Ic|�}} is the non-printable character {{Ic|^D}}.  In vi(m)
 +
you can get it by pressing {{Ic|Ctrl-v Ctrl-d}} in insert mode.
 +
If your are using a theme different than the default one you probably
 +
have to adapt the replacing string to match color and indentation.
 +
 
 +
And finally we convert some escaped HTML characters:
  
 
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;amp;' -replace '&'  
 
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;amp;' -replace '&'  
Line 58: Line 68:
 
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;quot;' -replace '"'  
 
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;quot;' -replace '"'  
  
blafoo
+
These are just some basic replaces, just extend them if you need more.
 +
 
 +
<!--
 +
vim: filetype=Wikipedia nowrap spell spelllang=en
 +
-->

Revision as of 14:56, 25 December 2013

The irssi-otr module brings Off-the-Record Messaging to your favorite IRC client.

Installing

You can install the irssi-otrAUR module from the AUR. If you like to test bleeding edge software, there is also irssi-otr-gitAUR.

Usage

See the README.

Loading the module on startup

If you are tired of typing /LOAD otr you can put the following in your ~/.irssi/startup:

LOAD otr

Stripping HTML

If you are using irssi-otr with BitlBee you will notice that some clients send you HTML formatted messages. Normally BitlBee automatically strips the HTML formatting, but since the messages are encrypted this does not work anymore. Nevertheless you can achieve the same by stripping the HTML with regular expressions using the Trigger script. Just make sure you load the script before the otr module. You can either do this manually or again make your ~/.irssi/startup look like this:

SCRIPT LOAD trigger.pl
LOAD otr

Also make sure that trigger.pl is not in ~/.irssi/scripts/autorun since the files from this directory are loaded after ~/.irssi/startup.

Since it is not possible to perfectly match HTML code with regular expressions we will take a somewhat conservative approach. We will only strip HTML tags we explicitly specified from PRIVMSGS from the BitlBee network, where we assume you added you server.

You can /TRIGGER add the following lines or copy them to ~/.irssi/triggers.

-privmsgs -nocase -tags 'BitlBee' -regexp '</?(a|b|body|div|em|font|i|s|u)( +\w+=".*?")*>' -replace '' 

You can even make HTML line breaks look like multiple messages:

-privmsgs -nocase -tags 'BitlBee' -regexp '(\s*<br>\s*)+' -replace '\n�8/<�g�</$N�8/>�g �e' 

Where is the non-printable character ^D. In vi(m) you can get it by pressing Ctrl-v Ctrl-d in insert mode. If your are using a theme different than the default one you probably have to adapt the replacing string to match color and indentation.

And finally we convert some escaped HTML characters:

-privmsgs -nocase -tags 'BitlBee' -regexp '&amp;' -replace '&' 
-privmsgs -nocase -tags 'BitlBee' -regexp '&gt;' -replace '>' 
-privmsgs -nocase -tags 'BitlBee' -regexp '&lt;' -replace '<' 
-privmsgs -nocase -tags 'BitlBee' -regexp '&quot;' -replace '"' 

These are just some basic replaces, just extend them if you need more.