summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-06-25 23:39:23 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-06-25 23:39:23 +0000
commit0dbfd281c93ed672319ee34defe67a40452c79e0 (patch)
treeffdcaba9fbb926199574fc451b1e4a6349e9f76b /docs
parent69b8d4f81b4dc82ff95e8b845c9a211b62f0248f (diff)
downloadirssi-0dbfd281c93ed672319ee34defe67a40452c79e0.zip
Created signal_get_uniq_id() macro. Added some documentation about
signals to design.txt. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@381 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'docs')
-rw-r--r--docs/design.txt39
-rw-r--r--docs/signals.txt5
2 files changed, 43 insertions, 1 deletions
diff --git a/docs/design.txt b/docs/design.txt
index 66790b6a..5c8ddcf1 100644
--- a/docs/design.txt
+++ b/docs/design.txt
@@ -35,6 +35,45 @@
about the chat protocols. This should allow implementing modules to
whatever chat protocols and with whatever frontends easily.
+ ** Signals
+
+ Communication between different modules are done with "signals". They are
+ not related to UNIX signals in any way, you could more like think of them
+ as "events" - which might be a better name for them, but I don't really
+ want to change it anymore :)
+
+ So, you send signal with signal_emit() and it's sent to all modules that
+ have grabbed it by calling signal_add() in their init function. For
+ example:
+
+ signal_emit("mysignal", 1, "hello");
+
+ Sends a "mysignal" function with one argument "hello" - before that, you
+ should have grabbed the signal somewhere else with:
+
+ static void sig_mysignal(const char *arg1)
+ {
+ /* arg1 contains "hello" */
+ }
+
+ signal_add("mysignal", (SIGNAL_FUNC) sig_mysignal);
+
+ There are three different signal_add() functions which you can use to
+ specify if you want to grab the signal first, "normally" or last. You can
+ also stop the signal from going any further.
+
+ Emitting signal with it's name creates a small overhead since it has to
+ look up the signal's numeric ID first, after which it looks up the signal
+ structure. This is done because if you call a signal _really_ often,
+ it's faster to find it with it's numeric ID instead of the string. You
+ can use signal_get_uniq_id() macro to convert the signal name into ID -
+ you'll have to do this only once! - and use signal_emit_id() to emit the
+ signal. Don't bother to do this unless your signal is sent (or could be
+ sent) several times in a second.
+
+ See src/core/signals.h for defination of the signal function, and
+ signals.txt for a list of signals.
+
** lib-popt
diff --git a/docs/signals.txt b/docs/signals.txt
index 8acbe419..c2b9a6d0 100644
--- a/docs/signals.txt
+++ b/docs/signals.txt
@@ -1,10 +1,13 @@
+List of signals irssi emits - see design.txt for more information about
+signals.
+
IRC base
--------
* Requires to work properly:
"gui exit"
-"send command", char *command, SERVER_REC, WI_ITEM_REC
+ "send command", char *command, SERVER_REC, WI_ITEM_REC
* Provides signals: