summaryrefslogtreecommitdiff
path: root/doc/en/plugin_fifo.en.xml
blob: 0b181b999d4bb758d2af9112785fca7dd343e887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?xml version="1.0" encoding="UTF-8"?>

<!--

WeeChat documentation (english version)

Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>

This manual is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This manual is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

-->

<section id="secPluginFifo">
  <title>FIFO plugin</title>
  
  <para>
    You can remote control WeeChat, by sending commands or text to a
    FIFO pipe (if option "plugins.var.fifo.fifo" is enabled, it is by default).
  </para>
  
  <para>
    The FIFO pipe is located in "<literal>~/.weechat/</literal>" and is
    called "weechat_fifo_xxxxx" (where xxxxx is the process ID (PID) of
    running WeeChat).
  </para>
  
  <para>
    Syntax for the FIFO pipe commands/text is one of following:
    <screen>
      category,name *text or command here
      name *text or command here
      *text or command here
    </screen>
  </para>
  
  <para>
    Some examples:
    <itemizedlist>
      <listitem>
        <para>
          nick change on freenode to "mynick|out" :
          <screen><prompt>$ </prompt><userinput>echo 'freenode,freenode */nick mynick|out' &gt;~/.weechat/weechat_fifo_12345</userinput></screen>
        </para>
      </listitem>
      <listitem>
        <para>
          display text on #weechat channel:
          <screen><prompt>$ </prompt><userinput>echo 'freenode,#weechat *hello everybody!' >~/.weechat/weechat_fifo_12345</userinput></screen>
        </para>
      </listitem>
      <listitem>
        <para>
          display text on current channel (buffer displayed by WeeChat):
          <screen><prompt>$ </prompt><userinput>echo '*hello!' >~/.weechat/weechat_fifo_12345</userinput></screen>
          <emphasis>Warning:</emphasis> this is dangerous and you should
          not do that except if you know what you do!
        </para>
      </listitem>
      <listitem>
        <para>
          send two commands to unload/reload Perl scripts (you have to
          separate them with "\n"):
          <screen><prompt>$ </prompt><userinput>echo -e " weechat,weechat */perl unload\nweechat,weechat */perl autoload" >~/.weechat/weechat_fifo_12345</userinput></screen>
        </para>
      </listitem>
    </itemizedlist>
  </para>
  
  <para>
    You can write a script to send command to all running WeeChat at same
    time, for example:
<screen>
#!/bin/sh
if [ $# -eq 1 ]; then
    for fifo in ~/.weechat/weechat_fifo_*
    do
        echo -e "$1" >$fifo
    done
fi
</screen>
    If the script is called "auto_weechat_command", you can run it with:
<screen><prompt>$ </prompt><userinput>./auto_weechat_command "freenode,#weechat *hello"</userinput></screen>
  </para>
  
</section>