aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-01-09 11:40:33 +0000
committerTom Feist <shabble@metavore.org>2011-01-09 11:40:33 +0000
commit06fd33dafab7e5ce5e96ce5cf5cd8379116185ec (patch)
tree8cb92943c2955f010ef495f2054e274173970a90
parentuberprompt: added /help prompt to mimic built-in help stuffs. (diff)
downloadirssi-scripts-06fd33dafab7e5ce5e96ce5cf5cd8379116185ec.tar.gz
irssi-scripts-06fd33dafab7e5ce5e96ce5cf5cd8379116185ec.zip
module/test: documented it a bit better, and add an unload message.
-rw-r--r--modules/test/Makefile28
-rw-r--r--modules/test/README.md17
-rw-r--r--modules/test/test_core.c1
-rw-r--r--modules/test/test_core.h2
-rw-r--r--modules/test/test_impl.c7
-rw-r--r--modules/test/test_impl.h4
6 files changed, 42 insertions, 17 deletions
diff --git a/modules/test/Makefile b/modules/test/Makefile
index 8ba234d..7becf66 100644
--- a/modules/test/Makefile
+++ b/modules/test/Makefile
@@ -1,14 +1,26 @@
-CFLAGS = -Wall -O2 -Werror -g
-LDFLAGS = -avoid-version -module -bundle -flat_namespace -undefined suppress
-FIND = gfind # stupid non-gnu defaults.
-OBJECTS = test_core.o \
- test_impl.o
+### Edit these parameters ###
+# change this to 'find' if you're on a decent system.
+FIND = gfind # stupid OSX non-gnu defaults.
+# Where your irssi include files live. You might need to install an
+# 'irssi-dev' package or something like that.
IRSSI_DIST = /opt/stow/repo/irssi/include/irssi
+# probably $(HOME)/.irssi for most people.
IRSSI_USER_DIR = $(HOME)/projects/tmp/test/irssi
+MODULE_NAME = test
+
+### You shouldn't need to edit anything beyond this point ###
+
+LIB_NAME = lib$(MODULE_NAME).so
+CFLAGS = -Wall -O2 -Werror -g -DMODULE_NAME=\"$(MODULE_NAME)\"
+LDFLAGS = -avoid-version -module -bundle -flat_namespace -undefined suppress
+
+# When you start adding more components to your module, add them here.
+OBJECTS = test_core.o \
+ test_impl.o
IRSSI_INCLUDE = -I$(IRSSI_DIST) \
-I$(IRSSI_DIST)/src \
@@ -23,15 +35,15 @@ IRSSI_INCLUDE = -I$(IRSSI_DIST) \
GLIB_CFLAGS = $(shell pkg-config glib-2.0 --cflags)
-all: libtest.so
+all: $(LIB_NAME)
%.o: %.c Makefile
$(CC) $(CFLAGS) $(GLIB_CFLAGS) $(IRSSI_INCLUDE) -I. -fPIC -c $<
-libtest.so: $(OBJECTS)
+$(LIB_NAME): $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o $@
-install: libtest.so
+install: $(LIB_NAME)
install $< $(IRSSI_USER_DIR)/modules
clean:
diff --git a/modules/test/README.md b/modules/test/README.md
index bc98767..0c92477 100644
--- a/modules/test/README.md
+++ b/modules/test/README.md
@@ -12,9 +12,18 @@ Note that modules are significantly more effort (and less portable, without
a huge amount of effort), so Perl scripts are to be preferred in call cases
where possible.
+## Usage
+
+* Edit the Makefile as per the comments at the top.
+* `make && make install`
+* Start up a spare Irssi client (no point segfaulting your main one)
+* `/load test`
+* Party in the streets.
+
## Contributing
-Contributions to this project are welcome
+Contributions to this project are welcome (i.e.: to demonstrate more useful
+things that a module can do)
* Patches can be submitted via e-mail, or preferably via forking
and sending a pull-request using GitHub. The repository for this
@@ -31,11 +40,11 @@ Contributions to this project are welcome
## Authors
- * Alexander Færøy &lt;ahf@irssi.org&gt;
+ * Alexander Færøy <ahf@irssi.org>
Original Author of irssi-lua, who did all the hard work figuring
out the module interface stuff. Also an Irssi project committer, I
believe, so that probably counts as cheating.
- * Tom Feist `&lt;shabble+irssi@metavore.org&gt;`
-
+ * Tom Feist `[shabble+irssi@metavore.org](mailto://shabble+irssi@metavore.org)`
+ Chief plunderer of the modular goodness.
diff --git a/modules/test/test_core.c b/modules/test/test_core.c
index 1b5d8c8..a61c0c4 100644
--- a/modules/test/test_core.c
+++ b/modules/test/test_core.c
@@ -30,4 +30,5 @@ void test_init() {
}
void test_deinit() {
+ print_unload_message();
}
diff --git a/modules/test/test_core.h b/modules/test/test_core.h
index 4119ffc..d0d594c 100644
--- a/modules/test/test_core.h
+++ b/modules/test/test_core.h
@@ -21,8 +21,6 @@
#ifndef GUARD_TEST_CORE_H
#define GUARD_TEST_CORE_H 1
-#define MODULE_NAME "test"
-
void test_init();
void test_deinit();
diff --git a/modules/test/test_impl.c b/modules/test/test_impl.c
index b086aff..4192bfd 100644
--- a/modules/test/test_impl.c
+++ b/modules/test/test_impl.c
@@ -9,3 +9,10 @@ void print_load_message(void) {
}
+void print_unload_message(void) {
+
+ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+ "Goodbye, Cruel World. ~signed \"%s\"", MODULE_NAME);
+
+}
+
diff --git a/modules/test/test_impl.h b/modules/test/test_impl.h
index bd9b185..e5bde72 100644
--- a/modules/test/test_impl.h
+++ b/modules/test/test_impl.h
@@ -1,9 +1,7 @@
#ifndef _TEST_IMPL_H_
#define _TEST_IMPL_H_ 1
-
void print_load_message(void);
-
-
+void print_unload_message(void);
#endif /* _TEST_IMPL_H_ */