93 lines
3 KiB
Markdown
93 lines
3 KiB
Markdown
# Installation
|
|
|
|
~~~
|
|
# apt install ii
|
|
~~~
|
|
|
|
ii - irc it ! Le client IRC basé seulement aux lancement en ligne de commande et à la manipulation à partir de fichiers FIFO.
|
|
|
|
# Utilisation
|
|
|
|
~~~
|
|
$ # ii -i <repertoire> -s <servername> -p <port> -k <environment> -n <nickname> -f <realname>
|
|
$ ii -i ~/.irc/ -s localhost -n evouser
|
|
|
|
~~~
|
|
Une fois lancé, le programme ne rend pas la main, donc on pourra préférer le mettre en tâche de fond.
|
|
|
|
Pour se connecter à un serveur IRC qui nécessite mot de passe, il faut passer le mot de passe en variable d'environnement (pour que le mot de passe ne soit pas visible par un autre utilisateur connecté sur la machine).
|
|
|
|
~~~
|
|
$ IIPASS='motdepasse' ii -i ~/.irc/ -s localhost -k IIPASS -n evouser
|
|
~~~
|
|
|
|
|
|
Exemple d'utilisation :
|
|
|
|
~~~
|
|
$ ls ~/.irc/
|
|
localhost
|
|
$ ls -l ~/.irc/localhost/
|
|
prwx------ 1 evouser evolix 0 Feb 10 09:33 in
|
|
-rw-r--r-- 1 evouser evolix 4762 Feb 10 09:33 out
|
|
$ echo "/j #channel" > ~/.irc/localhost/in
|
|
$ ls -l ~/.irc/localhost
|
|
prwx------ 1 evouser evolix 0 Feb 10 09:33 in
|
|
-rw-r--r-- 1 evouser evolix 5132 Feb 10 09:36 out
|
|
drwx------ 2 evouser evolix 4096 Feb 10 09:36 #channel
|
|
$ ls -l ~/.irc/locahost/\#channel
|
|
prwx------ 1 evouser evolix 0 Feb 10 09:36 in
|
|
-rw-r--r-- 1 evouser evolix 74 Feb 10 09:36 out
|
|
$ echo "coucou je parle grâce à ii !" > ~/.irc/localhost/\#channel/in
|
|
$ tail -f ~/.irc/localhost/\#channel/out
|
|
2017-02-10 09:37 -!- evouser(~evouser@evouser.evolix.net) has joined #channel
|
|
2017-02-10 09:39 <evouser> coucou je parle grâce à ii !
|
|
~~~
|
|
|
|
# Astuce
|
|
|
|
Pour savoir lorsque nouveaux messages et être certains de récupérer la nouvelle ligne (dans script - pour un bot par exemple), il faut rendre le fichier 'out' en un fichier FIFO => donc pas de logs possible.
|
|
|
|
~~~{.bash}
|
|
$ rm "~/.irc/localhost/\#channel/out"
|
|
$ mkfifo "~/.irc/localhost/\#channel/out"
|
|
$ cat "~/.irc/localhost/\#channel/out"
|
|
2017-02-10 11:50 <user> evouser: coucou evouser !
|
|
$
|
|
~~~
|
|
|
|
# Le petit frère sic
|
|
|
|
Avec **sic**, pas de répertoire et de hiérarchie de server/#channel/fichier, tout se passe avec STDIN et STDOUT (donc très pratique pour une automatisation simplifié dans un script) :
|
|
|
|
~~~
|
|
$ sic -h localhost -p 6667 -n evouser
|
|
localhost: 03/16/17 11:58 >< NOTICE (*): *** Looking up your hostname
|
|
localhost: 03/16/17 11:58 >< NOTICE (*): *** Checking Ident
|
|
localhost: 03/16/17 11:58 >< NOTICE (*): *** No Ident response
|
|
localhost: 03/16/17 11:58 >< NOTICE (*): *** Found your hostname
|
|
localhost: 03/16/17 11:58 >< 001 (evouser): Welcome to the irc Internet Relay Chat Network evouser
|
|
...
|
|
~~~
|
|
|
|
à partir de là, en entrée on peut se connecter à un channel :
|
|
|
|
~~~
|
|
:j #test
|
|
evouser : 03/16/17 12:02 >< JOIN (): #test
|
|
localhost: 03/16/17 12:02 >< 353 (evouser = #test): evouser
|
|
localhost: 03/16/17 12:02 >< 366 (evouser #test): End of /NAMES list.
|
|
~~~
|
|
|
|
Voir si quelqu'un se connecte :
|
|
|
|
~~~
|
|
evoadmin : 03/16/17 12:03 >< JOIN (): #test
|
|
~~~
|
|
|
|
Puis envoyer un message sur ce même channel :
|
|
|
|
~~~
|
|
:m #test evoadmin: Salut \0/
|
|
#test : 03/16/17 12:08 <evouser> evoadmin: Salut \0/
|
|
~~~ |