Difference between revisions of "Irssi-otr"

From ArchWiki
Jump to: navigation, search
m (Minor formatting.)
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[Category:Internet and Email (English)]]
+
[[Category:Internet Applications]]
[[Category:HOWTOs (English)]]
+
[[Category:Internet Relay Chat]]
 
+
= About =
=About=
+
  
 
The [http://irssi-otr.tuxfamily.org/ irssi-otr] module brings
 
The [http://irssi-otr.tuxfamily.org/ irssi-otr] module brings
Line 11: Line 10:
  
 
You can install the Irssi OTR module from the
 
You can install the Irssi OTR module from the
[http://aur.archlinux.org/packages.php?ID=19488 AUR].
+
[https://aur.archlinux.org/packages.php?ID=19488 AUR].
 
If you like to test bleeding edge software, there is also a
 
If you like to test bleeding edge software, there is also a
[http://aur.archlinux.org/packages.php?ID=23366 Git version].
+
[https://aur.archlinux.org/packages.php?ID=23366 Git version].
  
 
=Usage=
 
=Usage=
Line 22: Line 21:
 
=Loading the module on startup=
 
=Loading the module on startup=
  
If you are tired of typing <tt>/LOAD otr</tt> you can put the following
+
If you are tired of typing {{Ic|/LOAD otr}} you can put the following
in your <tt>~/.irssi/startup</tt>:
+
in your {{Ic|~/.irssi/startup}}:
  
 
  LOAD otr
 
  LOAD otr
 
=Finishing OTR conversations on /QUIT=
 
 
If <tt>otr_finishonunload</tt> is set irssi-otr will finish all your
 
OTR conversations when the module is unloaded.  However when you
 
<tt>/QUIT</tt>, Irssi disconnects from the IRC networks first and
 
unloads its modules afterwards.  Of course this will prevent your OTR
 
conversations form being finished correctly.  To circumvent this you
 
can define the following alias:
 
 
/ALIAS quit unload otr; quit
 
  
 
=Stripping HTML=
 
=Stripping HTML=
Line 47: Line 35:
 
[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.  You can either do this
 
sure you load the script before the otr module.  You can either do this
manually or again make your <tt>~/.irssi/startup</tt> 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
  
Also make sure that <tt>trigger.pl</tt> is not in
+
Also make sure that {{Ic|trigger.pl}} is not in
<tt>~/.irssi/scripts/autorun</tt> since the files from this directory
+
{{Ic|~/.irssi/scripts/autorun}} since the files from this directory
are loaded after <tt>~/.irssi/startup</tt>.
+
are loaded after {{Ic|~/.irssi/startup}}.
  
 
Since it is not possible to perfectly match HTML code with regular
 
Since it is not possible to perfectly match HTML code with regular
Line 61: Line 49:
 
network, where we assume you added you server.
 
network, where we assume you added you server.
  
You can <tt>/TRIGGER add</tt> the following lines or copy them to
+
You can {{Ic|/TRIGGER add}} the following lines or copy them to
<tt>~/.irssi/triggers</tt>.
+
{{Ic|~/.irssi/triggers}}.
  
 
<pre>
 
<pre>
Line 70: Line 58:
 
You can even make HTML line breaks look like multiple messages:
 
You can even make HTML line breaks look like multiple messages:
  
  -privmsgs -nocase -tags 'BitlBee' -regexp '( *&lt;br&gt; *)+' -replace '\n�8/<�g�</$N�8/>�g �e'  
+
  -privmsgs -nocase -tags 'BitlBee' -regexp '(\s*&lt;br&gt;\s*)+' -replace '\n�8/<�g�</$N�8/>�g �e'  
  
Where <tt></tt> is the non-printable character <tt>^D</tt>.  In vi(m)
+
Where {{Ic|}} is the non-printable character {{Ic|^D}}.  In vi(m)
you can get it by pressing <tt>Ctrl-v Ctrl-d</tt> in insert mode.
+
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
 
If your are using a theme different than the default one you probably
 
have to adapt the replacing string to match color and indentation.
 
have to adapt the replacing string to match color and indentation.
Line 83: Line 71:
 
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;lt;' -replace '<'  
 
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;lt;' -replace '<'  
 
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;quot;' -replace '"'  
 
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;quot;' -replace '"'  
 +
 +
These are just some basic replaces, just extend them if you need more.
  
 
<!--
 
<!--
 
vim: filetype=Wikipedia nowrap spell spelllang=en
 
vim: filetype=Wikipedia nowrap spell spelllang=en
 
-->
 
-->

Revision as of 17:57, 23 April 2012

About

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

Installing

You can install the Irssi OTR module from the AUR. If you like to test bleeding edge software, there is also a Git version.

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 doesn't 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.