summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Davis <loafier@gmail.com>2006-08-15 05:04:04 +0000
committerChristopher Davis <loafier@gmail.com>2006-08-15 05:04:04 +0000
commit9283d8982431b9e1371efdd5cd731fe4e7db7fe8 (patch)
tree68e30c306ae491acc85368bae14ffb837a717583
parent501cfa59a78c2cb7ea76e9686aa33221c77ac9f3 (diff)
downloadirssi-python-9283d8982431b9e1371efdd5cd731fe4e7db7fe8.tar.gz
irssi-python-9283d8982431b9e1371efdd5cd731fe4e7db7fe8.tar.xz
irssi-python-9283d8982431b9e1371efdd5cd731fe4e7db7fe8.zip
fixing up for test1
git-svn-id: http://svn.irssi.org/repos/irssi-python@4315 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--INSTALL248
-rw-r--r--Makefile.am2
-rw-r--r--README81
-rw-r--r--TODO6
-rw-r--r--configure.in2
-rw-r--r--docs/irssi-python.html (renamed from docs/irssi.html)0
-rw-r--r--scripts/Makefile.am2
-rw-r--r--scripts/fork.py63
-rw-r--r--src/objects/ban-object.c2
-rw-r--r--src/objects/base-objects.c4
-rw-r--r--src/objects/channel-object.c2
-rw-r--r--src/objects/chatnet-object.c2
-rw-r--r--src/objects/command-object.c2
-rw-r--r--src/objects/connect-object.c2
-rw-r--r--src/objects/dcc-chat-object.c2
-rw-r--r--src/objects/dcc-get-object.c2
-rw-r--r--src/objects/dcc-object.c2
-rw-r--r--src/objects/dcc-send-object.c2
-rw-r--r--src/objects/ignore-object.c2
-rw-r--r--src/objects/irc-channel-object.c2
-rw-r--r--src/objects/irc-connect-object.c2
-rw-r--r--src/objects/irc-server-object.c2
-rw-r--r--src/objects/log-object.c2
-rw-r--r--src/objects/logitem-object.c2
-rw-r--r--src/objects/main-window-object.c2
-rw-r--r--src/objects/netsplit-channel-object.c2
-rw-r--r--src/objects/netsplit-object.c2
-rw-r--r--src/objects/netsplit-server-object.c2
-rw-r--r--src/objects/nick-object.c2
-rw-r--r--src/objects/notifylist-object.c2
-rw-r--r--src/objects/process-object.c2
-rw-r--r--src/objects/pyscript-object.c2
-rw-r--r--src/objects/query-object.c2
-rw-r--r--src/objects/rawlog-object.c2
-rw-r--r--src/objects/reconnect-object.c2
-rw-r--r--src/objects/server-object.c2
-rw-r--r--src/objects/statusbar-item-object.c2
-rw-r--r--src/objects/textdest-object.c2
-rw-r--r--src/objects/theme-object.c2
-rw-r--r--src/objects/window-item-object.c2
-rw-r--r--src/objects/window-object.c2
-rw-r--r--src/pyloader.c5
42 files changed, 152 insertions, 325 deletions
diff --git a/INSTALL b/INSTALL
index 56b077d..14b8d4e 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,236 +1,32 @@
-Installation Instructions
-*************************
+1. Download and unpack the irssi source (ie irssi-0.8.10a.tar.gz) if you haven't
+ done so already. irssi-python will need access to Irssi's headers.
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
-Software Foundation, Inc.
+2. Run the configure script, making sure to specify the correct location of
+ Irssi's distribution. For example:
-This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
+ $ configure --with-irssi=~/irssi-0.8.10
-Basic Installation
-==================
+ If configure has trouble linking a Python test program due to missing pthread
+ symbols (occasionally on FreeBSD), try:
-These are generic installation instructions.
+ $ LDFLAGS="-pthread" configure --with-irssi=<path/to/distro>
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
+ Make sure the prefix for irssi-python matches Irssi's (/usr, /usr/local,
+ etc) so that the module and scripts are installed in the right places.
- It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. (Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.)
+3. As usual, run make.
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
+4. make install if OK. libirssi_python.so should be copied to irssi/modules/,
+ scripts to irssi/scripts/ and irssi-python.html to irssi/docs/.
+
+5. You should be able to load irssi_python in Irssi after installing, IE:
+
+ /load irssi_python
- The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You only need
-`configure.ac' if you want to change it or regenerate `configure' using
-a newer version of `autoconf'.
+ If you get missing pthread symbols, you may have to preload the thread safe
+ C library before running irssi. export LD_PRELOAD=/usr/lib/libc_r.so seems to
+ work on FreeBSD.
-The simplest way to compile this package is:
-
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
-
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
-
- 2. Type `make' to compile the package.
-
- 3. Optionally, type `make check' to run any self-tests that come with
- the package.
-
- 4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
- for the package's developers. If you use it, you may have to get
- all sorts of other programs in order to regenerate files that came
- with the distribution.
-
-Compilers and Options
-=====================
-
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about. Run `./configure --help' for
-details on some of the pertinent environment variables.
-
- You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment. Here
-is an example:
-
- ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
-
- *Note Defining Variables::, for more details.
-
-Compiling For Multiple Architectures
-====================================
-
-You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
- If you have to use a `make' that does not support the `VPATH'
-variable, you have to compile the package for one architecture at a
-time in the source code directory. After you have installed the
-package for one architecture, use `make distclean' before reconfiguring
-for another architecture.
-
-Installation Names
-==================
-
-By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PREFIX'.
-
- You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files. If you
-give `configure' the option `--exec-prefix=PREFIX', the package will
-use PREFIX as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
-Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
- For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
-`--build=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
-
- CPU-COMPANY-SYSTEM
-
-where SYSTEM can have one of these forms:
-
- OS KERNEL-OS
-
- See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the machine type.
-
- If you are _building_ compiler tools for cross-compiling, you should
-use the `--target=TYPE' option to select the type of system they will
-produce code for.
-
- If you want to _use_ a cross compiler, that generates code for a
-platform different from the build platform, you should specify the
-"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
-
-Sharing Defaults
-================
-
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Defining Variables
-==================
-
-Variables not defined in a site shell script can be set in the
-environment passed to `configure'. However, some packages may run
-configure again during the build, and the customized values of these
-variables may be lost. In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'. For example:
-
- ./configure CC=/usr/local2/bin/gcc
-
-causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script). Here is a another example:
-
- /bin/bash ./configure CONFIG_SHELL=/bin/bash
-
-Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
-configuration-related scripts to be executed by `/bin/bash'.
-
-`configure' Invocation
-======================
-
-`configure' recognizes the following options to control how it operates.
-
-`--help'
-`-h'
- Print a summary of the options to `configure', and exit.
-
-`--version'
-`-V'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`--cache-file=FILE'
- Enable the cache: use and save the results of the tests in FILE,
- traditionally `config.cache'. FILE defaults to `/dev/null' to
- disable caching.
-
-`--config-cache'
-`-C'
- Alias for `--cache-file=config.cache'.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`configure' also accepts some other, not widely useful, options. Run
-`configure --help' for more details.
+ You may want to load one of the example scripts like hello or fork.
+Also check out README and docs/irssi-python.html
diff --git a/Makefile.am b/Makefile.am
index 3af145a..543d47d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = src scripts
+SUBDIRS = src scripts docs
variables:
echo @PYTHON_CPPFLAGS@
diff --git a/README b/README
index ed4201f..e0b2434 100644
--- a/README
+++ b/README
@@ -1,62 +1,21 @@
-Pytest for Irssi
-
-This module embeds Python into an Irssi module. It provides just enough of an
-interface to port the hello.pl example from the Perl docs to Python. There are
-still a lot of things needed to be done, and some design issues to work out.
-See the scripts/ directory for two small example scripts.
-
-To compile:
- So far I've compiled it on Debian i386 and on FreeBSD i386. Haven't tried
- elsewhere. The Makefile will need to be edited for it to be compiled. It
- requires Python 2.4 installed. Put libpytest.so wherever Irssi recognizes
- modules.
-
-In pytest so far:
- -Looks for scripts in ~/.irssi/pyscripts
- -Created base object wrappers for structs with type and chat_type members.
- -Wrapped members of most of the core structs:
- SERVER_REC
- WI_ITEM_REC
- CHANNEL_REC
- QUERY_REC
- -Wrapped print methods for the global module, server, and window item.
- -Wrapped command methods for server and window item.
- -Included a signal handler in the base server and window item types that
- seems to prevent crashes when an object is accessed after a server is
- disconnected or a window item is removed (channel close, etc).
- -Python stdout and stderr are redirected to the Irssi status window.
- -The command_bind method of the Script object binds commands.
-
-TODO:
- -Wrap the rest of the *_REC structs.
- -Wrap the important methods and functions.
- -Signal handling
- -Wrapper object factory
- -Handle settings
- -Handle timeouts
- -Bunch of other stuff
-
-Design issues:
- -Threading. Pytest doesn't consider thread usage by scripts at all. Any
- thread usage would likely cause a crash, as pytest makes no attempt to
- manipulate Python's interpreter lock or thread state. It would be easy to
- use PyGILState_* critical sections around important parts where Irssi
- calls into Python, but I don't know about the larger impact on Irssi for
- allowing threads to run. With the signal system and timeouts, is this
- really an important issue?
-
- -Structure. C modules could use some adjustment, especially as more code
- is added. I also noticed how the Perl wrapper, like the rest of Irssi,
- seems to be organized around interface type. The Python wrapper may need
- some adjustment for this(?)
-
- -Also, command_bind currently isn't a function in the main namespace like in
- the Perl wrapper. Instead, its a method of the Script object, which includes
- a list of bound signals for record keeping. That way, the context is always
- certain. Currently, the Script object is inserted into the user's script
- through a startup hook function (irssi_main). There could be a better way
- of doing this (perhaps by inserting the script object directly into the
- script's globals and using an import hook to distribute it to modules the
- script imports).
-
+irssi-python test1
+
+irssi-python embeds Python into an Irssi module, providing most of the
+functionality of the Perl wrapper to Python scripts using a similar interface.
+Read INSTALL for setup instructions.
+
+Currently, all of the objects and functions are accessible through the irssi
+module. See docs/irssi-python.html for a listing. Basic docs are also available
+online in Irssi, as well. Use the /pyexec command to send commands to the Python
+interpreter while in Irssi.
+
+This will print help for the Window object:
+ /pyexec import irssi
+ /pyexec help(irssi.Window)
+
+Other commands (XXX: change these to /py <cmd>):
+ /pyload load a Python script
+ /pyunload unload a Python script
+ /pylist list loaded scripts
+
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..afe22cf
--- /dev/null
+++ b/TODO
@@ -0,0 +1,6 @@
+-- Change commands from py<cmd> to py <cmd> (add space), and add help
+ documentation.
+
+-- Fix loader to handle module hierarchies better.
+
+-- Fix irssi-python to better match Irssi's structure.
diff --git a/configure.in b/configure.in
index 8976f9d..07821bd 100644
--- a/configure.in
+++ b/configure.in
@@ -58,5 +58,5 @@ fi
#AC_CONFIG_FILES([src/Makefile src/objects/Makefile])
#AC_OUTPUT([Makefile src/Makefile src/objects/Makefile])
#AC_OUTPUT([Makefile src/Makefile src/objects/Makefile])
-AC_CONFIG_FILES([Makefile scripts/Makefile src/Makefile src/objects/Makefile])
+AC_CONFIG_FILES([Makefile scripts/Makefile docs/Makefile src/Makefile src/objects/Makefile])
AC_OUTPUT
diff --git a/docs/irssi.html b/docs/irssi-python.html
index 998a763..998a763 100644
--- a/docs/irssi.html
+++ b/docs/irssi-python.html
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 9d06b34..32ad5a3 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,6 +1,6 @@
scriptsdir = $(datadir)/irssi/scripts
-scripts_DATA = hello.py dumper.py test_window.py
+scripts_DATA = hello.py dumper.py test_window.py fork.py
EXTRA_DIST = $(scripts_DATA)
diff --git a/scripts/fork.py b/scripts/fork.py
new file mode 100644
index 0000000..8d1e855
--- /dev/null
+++ b/scripts/fork.py
@@ -0,0 +1,63 @@
+import irssi
+import os
+import time
+import sys
+
+child_pid = 0
+
+def sig_pidwait(pid, status):
+ if child_pid != pid:
+ print 'pidwait dont know',pid
+ return
+
+ if os.WIFSIGNALED(status):
+ print '%d killed by signal' % pid
+ elif os.WIFEXITED(status):
+ print '%d exited(%d)' % (pid, os.WEXITSTATUS(status))
+
+ irssi.signal_remove('pidwait')
+
+def read_child(fd, condition, out):
+ data = os.read(fd, 512)
+ if not data:
+ return False
+ out.write(data)
+ return True
+
+def childfunc():
+ """ do your stuff """
+ for i in xrange(30):
+ print 'ME CHILD', i
+ time.sleep(1)
+
+
+def cmd_forkoff(data, server, witem):
+ global child_pid
+
+ rs, ws = os.pipe()
+ re, we = os.pipe()
+
+ pid = os.fork()
+ if pid > 0:
+ #parent
+ child_pid = pid
+ irssi.pidwait_add(pid)
+ print 'forked off',pid
+ irssi.signal_add('pidwait', sig_pidwait)
+
+ #redirect child output
+ irssi.io_add_watch(rs, read_child, sys.stdout)
+ irssi.io_add_watch(re, read_child, sys.stderr)
+
+ else:
+ #child
+ sys.stdout = os.fdopen(ws, 'w', 0)
+ sys.stderr = os.fdopen(we, 'w', 0)
+
+ childfunc()
+
+ sys.stdout.close()
+ sys.stderr.close()
+ os._exit(5)
+
+irssi.command_bind('forkoff', cmd_forkoff)
diff --git a/src/objects/ban-object.c b/src/objects/ban-object.c
index 908bae2..5420315 100644
--- a/src/objects/ban-object.c
+++ b/src/objects/ban-object.c
@@ -85,7 +85,7 @@ static PyMethodDef PyBan_methods[] = {
PyTypeObject PyBanType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Ban", /*tp_name*/
+ "irssi.Ban", /*tp_name*/
sizeof(PyBan), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyBan_dealloc, /*tp_dealloc*/
diff --git a/src/objects/base-objects.c b/src/objects/base-objects.c
index 42f5cac..84d15d7 100644
--- a/src/objects/base-objects.c
+++ b/src/objects/base-objects.c
@@ -74,7 +74,7 @@ static PyMethodDef PyIrssiBase_methods[] = {
PyTypeObject PyIrssiBaseType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "IrssiBase", /*tp_name*/
+ "irssi.IrssiBase", /*tp_name*/
sizeof(PyIrssiBase), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyIrssiBase_dealloc, /*tp_dealloc*/
@@ -178,7 +178,7 @@ static PyMethodDef PyIrssiChatBase_methods[] = {
PyTypeObject PyIrssiChatBaseType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "IrssiChatBase", /*tp_name*/
+ "irssi.IrssiChatBase", /*tp_name*/
sizeof(PyIrssiChatBase), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyIrssiChatBase_dealloc, /*tp_dealloc*/
diff --git a/src/objects/channel-object.c b/src/objects/channel-object.c
index fa4edd4..63f7f35 100644
--- a/src/objects/channel-object.c
+++ b/src/objects/channel-object.c
@@ -303,7 +303,7 @@ static PyMethodDef PyChannel_methods[] = {
PyTypeObject PyChannelType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Channel", /*tp_name*/
+ "irssi.Channel", /*tp_name*/
sizeof(PyChannel), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyChannel_dealloc, /*tp_dealloc*/
diff --git a/src/objects/chatnet-object.c b/src/objects/chatnet-object.c
index c22f0cb..2cbbb70 100644
--- a/src/objects/chatnet-object.c
+++ b/src/objects/chatnet-object.c
@@ -105,7 +105,7 @@ static PyMethodDef PyChatnet_methods[] = {
PyTypeObject PyChatnetType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Chatnet", /*tp_name*/
+ "irssi.Chatnet", /*tp_name*/
sizeof(PyChatnet), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyChatnet_dealloc, /*tp_dealloc*/
diff --git a/src/objects/command-object.c b/src/objects/command-object.c
index ad60012..0d4c3b1 100644
--- a/src/objects/command-object.c
+++ b/src/objects/command-object.c
@@ -75,7 +75,7 @@ static PyMethodDef PyCommand_methods[] = {
PyTypeObject PyCommandType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Command", /*tp_name*/
+ "irssi.Command", /*tp_name*/
sizeof(PyCommand), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyCommand_dealloc, /*tp_dealloc*/
diff --git a/src/objects/connect-object.c b/src/objects/connect-object.c
index 8ef9a29..dceaa23 100644
--- a/src/objects/connect-object.c
+++ b/src/objects/connect-object.c
@@ -114,7 +114,7 @@ static PyGetSetDef PyConnect_getseters[] = {
PyTypeObject PyConnectType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Connect", /*tp_name*/
+ "irssi.Connect", /*tp_name*/
sizeof(PyConnect), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyConnect_dealloc, /*tp_dealloc*/
diff --git a/src/objects/dcc-chat-object.c b/src/objects/dcc-chat-object.c
index 5cfe796..0a6e0d0 100644
--- a/src/objects/dcc-chat-object.c
+++ b/src/objects/dcc-chat-object.c
@@ -78,7 +78,7 @@ static PyMethodDef PyDccChat_methods[] = {
PyTypeObject PyDccChatType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "DccChat", /*tp_name*/
+ "irssi.DccChat", /*tp_name*/
sizeof(PyDccChat), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
diff --git a/src/objects/dcc-get-object.c b/src/objects/dcc-get-object.c
index fa7c13a..959af05 100644
--- a/src/objects/dcc-get-object.c
+++ b/src/objects/dcc-get-object.c
@@ -79,7 +79,7 @@ static PyMethodDef PyDccGet_methods[] = {
PyTypeObject PyDccGetType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "DccGet", /*tp_name*/
+ "irssi.DccGet", /*tp_name*/
sizeof(PyDccGet), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
diff --git a/src/objects/dcc-object.c b/src/objects/dcc-object.c
index 95a3a4a..4499d7b 100644
--- a/src/objects/dcc-object.c
+++ b/src/objects/dcc-object.c
@@ -250,7 +250,7 @@ static PyMethodDef PyDcc_methods[] = {
PyTypeObject PyDccType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Dcc", /*tp_name*/
+ "irssi.Dcc", /*tp_name*/
sizeof(PyDcc), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyDcc_dealloc, /*tp_dealloc*/
diff --git a/src/objects/dcc-send-object.c b/src/objects/dcc-send-object.c
index 643f741..528b0a9 100644
--- a/src/objects/dcc-send-object.c
+++ b/src/objects/dcc-send-object.c
@@ -79,7 +79,7 @@ static PyMethodDef PyDccSend_methods[] = {
PyTypeObject PyDccSendType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "DccSend", /*tp_name*/
+ "irssi.DccSend", /*tp_name*/
sizeof(PyDccSend), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
diff --git a/src/objects/ignore-object.c b/src/objects/ignore-object.c
index 979c9b1..89e5128 100644
--- a/src/objects/ignore-object.c
+++ b/src/objects/ignore-object.c
@@ -214,7 +214,7 @@ static PyMethodDef PyIgnore_methods[] = {
PyTypeObject PyIgnoreType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Ignore", /*tp_name*/
+ "irssi.Ignore", /*tp_name*/
sizeof(PyIgnore), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyIgnore_dealloc, /*tp_dealloc*/
diff --git a/src/objects/irc-channel-object.c b/src/objects/irc-channel-object.c
index 5e9531d..63e4956 100644
--- a/src/objects/irc-channel-object.c
+++ b/src/objects/irc-channel-object.c
@@ -112,7 +112,7 @@ static PyMethodDef PyIrcChannel_methods[] = {
PyTypeObject PyIrcChannelType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "IrcChannel", /*tp_name*/
+ "irssi.IrcChannel", /*tp_name*/
sizeof(PyIrcChannel), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
diff --git a/src/objects/irc-connect-object.c b/src/objects/irc-connect-object.c
index 5068dea..9edc5ae 100644
--- a/src/objects/irc-connect-object.c
+++ b/src/objects/irc-connect-object.c
@@ -28,7 +28,7 @@ static PyGetSetDef PyIrcConnect_getseters[] = {
PyTypeObject PyIrcConnectType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "IrcConnect", /*tp_name*/
+ "irssi.IrcConnect", /*tp_name*/
sizeof(PyIrcConnect), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
diff --git a/src/objects/irc-server-object.c b/src/objects/irc-server-object.c
index 4e9a28e..7ad9383 100644
--- a/src/objects/irc-server-object.c
+++ b/src/objects/irc-server-object.c
@@ -433,7 +433,7 @@ static PyMethodDef PyIrcServer_methods[] = {
PyTypeObject PyIrcServerType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "IrcServer", /*tp_name*/
+ "irssi.IrcServer", /*tp_name*/
sizeof(PyIrcServer), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
diff --git a/src/objects/log-object.c b/src/objects/log-object.c
index b18f826..537c8c1 100644
--- a/src/objects/log-object.c
+++ b/src/objects/log-object.c
@@ -407,7 +407,7 @@ static PyMethodDef PyLog_methods[] = {
PyTypeObject PyLogType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Log", /*tp_name*/
+ "irssi.Log", /*tp_name*/
sizeof(PyLog), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyLog_dealloc, /*tp_dealloc*/
diff --git a/src/objects/logitem-object.c b/src/objects/logitem-object.c
index 4dc2275..7e1b24b 100644
--- a/src/objects/logitem-object.c
+++ b/src/objects/logitem-object.c
@@ -70,7 +70,7 @@ static PyMethodDef PyLogitem_methods[] = {
PyTypeObject PyLogitemType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Logitem", /*tp_name*/
+ "irssi.Logitem", /*tp_name*/
sizeof(PyLogitem), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyLogitem_dealloc, /*tp_dealloc*/
diff --git a/src/objects/main-window-object.c b/src/objects/main-window-object.c
index 6541f2b..d091fd0 100644
--- a/src/objects/main-window-object.c
+++ b/src/objects/main-window-object.c
@@ -120,7 +120,7 @@ static PyMethodDef PyMainWindow_methods[] = {
PyTypeObject PyMainWindowType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "MainWindow", /*tp_name*/
+ "irssi.MainWindow", /*tp_name*/
sizeof(PyMainWindow), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyMainWindow_dealloc, /*tp_dealloc*/
diff --git a/src/objects/netsplit-channel-object.c b/src/objects/netsplit-channel-object.c
index 3e2639b..4947127 100644
--- a/src/objects/netsplit-channel-object.c
+++ b/src/objects/netsplit-channel-object.c
@@ -90,7 +90,7 @@ static PyMethodDef PyNetsplitChannel_methods[] = {
PyTypeObject PyNetsplitChannelType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "NetsplitChannel", /*tp_name*/
+ "irssi.NetsplitChannel", /*tp_name*/
sizeof(PyNetsplitChannel), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyNetsplitChannel_dealloc, /*tp_dealloc*/
diff --git a/src/objects/netsplit-object.c b/src/objects/netsplit-object.c
index d64bd97..d9cc64d 100644
--- a/src/objects/netsplit-object.c
+++ b/src/objects/netsplit-object.c
@@ -112,7 +112,7 @@ static PyMethodDef PyNetsplit_methods[] = {
PyTypeObject PyNetsplitType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Netsplit", /*tp_name*/
+ "irssi.Netsplit", /*tp_name*/
sizeof(PyNetsplit), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyNetsplit_dealloc, /*tp_dealloc*/
diff --git a/src/objects/netsplit-server-object.c b/src/objects/netsplit-server-object.c
index 7208ae1..8b46197 100644
--- a/src/objects/netsplit-server-object.c
+++ b/src/objects/netsplit-server-object.c
@@ -87,7 +87,7 @@ static PyMethodDef PyNetsplitServer_methods[] = {
PyTypeObject PyNetsplitServerType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "NetsplitServer", /*tp_name*/
+ "irssi.NetsplitServer", /*tp_name*/
sizeof(PyNetsplitServer), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyNetsplitServer_dealloc, /*tp_dealloc*/
diff --git a/src/objects/nick-object.c b/src/objects/nick-object.c
index 79f3a85..af5feab 100644
--- a/src/objects/nick-object.c
+++ b/src/objects/nick-object.c
@@ -160,7 +160,7 @@ static PyMethodDef PyNick_methods[] = {
PyTypeObject PyNickType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Nick", /*tp_name*/
+ "irssi.Nick", /*tp_name*/
sizeof(PyNick), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyNick_dealloc, /*tp_dealloc*/
diff --git a/src/objects/notifylist-object.c b/src/objects/notifylist-object.c
index 3366d0f..f6deb2d 100644
--- a/src/objects/notifylist-object.c
+++ b/src/objects/notifylist-object.c
@@ -151,7 +151,7 @@ static PyMethodDef PyNotifylist_methods[] = {
PyTypeObject PyNotifylistType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Notifylist", /*tp_name*/
+ "irssi.Notifylist", /*tp_name*/
sizeof(PyNotifylist), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyNotifylist_dealloc, /*tp_dealloc*/
diff --git a/src/objects/process-object.c b/src/objects/process-object.c
index 43c0fd7..08f423d 100644
--- a/src/objects/process-object.c
+++ b/src/objects/process-object.c
@@ -152,7 +152,7 @@ static PyMethodDef PyProcess_methods[] = {
PyTypeObject PyProcessType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Process", /*tp_name*/
+ "irssi.Process", /*tp_name*/
sizeof(PyProcess), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyProcess_dealloc, /*tp_dealloc*/
diff --git a/src/objects/pyscript-object.c b/src/objects/pyscript-object.c
index ae4770e..f51b696 100644
--- a/src/objects/pyscript-object.c
+++ b/src/objects/pyscript-object.c
@@ -614,7 +614,7 @@ static PyMemberDef PyScript_members[] = {
PyTypeObject PyScriptType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Script", /*tp_name*/
+ "irssi.Script", /*tp_name*/
sizeof(PyScript), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyScript_dealloc, /*tp_dealloc*/
diff --git a/src/objects/query-object.c b/src/objects/query-object.c
index 47badd5..b470e58 100644
--- a/src/objects/query-object.c
+++ b/src/objects/query-object.c
@@ -101,7 +101,7 @@ static PyMethodDef PyQuery_methods[] = {
PyTypeObject PyQueryType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Query", /*tp_name*/
+ "irssi.Query", /*tp_name*/
sizeof(PyQuery), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyQuery_dealloc, /*tp_dealloc*/
diff --git a/src/objects/rawlog-object.c b/src/objects/rawlog-object.c
index 340d60a..39915e6 100644
--- a/src/objects/rawlog-object.c
+++ b/src/objects/rawlog-object.c
@@ -255,7 +255,7 @@ static PyMethodDef PyRawlog_methods[] = {
PyTypeObject PyRawlogType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Rawlog", /*tp_name*/
+ "irssi.Rawlog", /*tp_name*/
sizeof(PyRawlog), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyRawlog_dealloc, /*tp_dealloc*/
diff --git a/src/objects/reconnect-object.c b/src/objects/reconnect-object.c
index 6483242..29e2e46 100644
--- a/src/objects/reconnect-object.c
+++ b/src/objects/reconnect-object.c
@@ -75,7 +75,7 @@ static PyMethodDef PyReconnect_methods[] = {
PyTypeObject PyReconnectType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Reconnect", /*tp_name*/
+ "irssi.Reconnect", /*tp_name*/
sizeof(PyReconnect), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyReconnect_dealloc, /*tp_dealloc*/
diff --git a/src/objects/server-object.c b/src/objects/server-object.c
index 31415b8..0276739 100644
--- a/src/objects/server-object.c
+++ b/src/objects/server-object.c
@@ -708,7 +708,7 @@ static PyMethodDef PyServer_methods[] = {
PyTypeObject PyServerType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Server", /*tp_name*/
+ "irssi.Server", /*tp_name*/
sizeof(PyServer), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyServer_dealloc, /*tp_dealloc*/
diff --git a/src/objects/statusbar-item-object.c b/src/objects/statusbar-item-object.c
index f6768af..4d80e26 100644
--- a/src/objects/statusbar-item-object.c
+++ b/src/objects/statusbar-item-object.c
@@ -171,7 +171,7 @@ static PyMethodDef PyStatusbarItem_methods[] = {
PyTypeObject PyStatusbarItemType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "StatusbarItem", /*tp_name*/
+ "irssi.StatusbarItem", /*tp_name*/
sizeof(PyStatusbarItem), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyStatusbarItem_dealloc, /*tp_dealloc*/
diff --git a/src/objects/textdest-object.c b/src/objects/textdest-object.c
index 2ad6523..e645abb 100644
--- a/src/objects/textdest-object.c
+++ b/src/objects/textdest-object.c
@@ -187,7 +187,7 @@ static PyMethodDef PyTextDest_methods[] = {
PyTypeObject PyTextDestType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "TextDest", /*tp_name*/
+ "irssi.TextDest", /*tp_name*/
sizeof(PyTextDest), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyTextDest_dealloc, /*tp_dealloc*/
diff --git a/src/objects/theme-object.c b/src/objects/theme-object.c
index 0f12217..d3937ee 100644
--- a/src/objects/theme-object.c
+++ b/src/objects/theme-object.c
@@ -126,7 +126,7 @@ static PyMethodDef PyTheme_methods[] = {
PyTypeObject PyThemeType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Theme", /*tp_name*/
+ "irssi.Theme", /*tp_name*/
sizeof(PyTheme), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyTheme_dealloc, /*tp_dealloc*/
diff --git a/src/objects/window-item-object.c b/src/objects/window-item-object.c
index 2f18f7d..45ed733 100644
--- a/src/objects/window-item-object.c
+++ b/src/objects/window-item-object.c
@@ -251,7 +251,7 @@ static PyMethodDef PyWindowItem_methods[] = {
PyTypeObject PyWindowItemType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "WindowItem", /*tp_name*/
+ "irssi.WindowItem", /*tp_name*/
sizeof(PyWindowItem), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
diff --git a/src/objects/window-object.c b/src/objects/window-object.c
index d5aa475..b17a5d7 100644
--- a/src/objects/window-object.c
+++ b/src/objects/window-object.c
@@ -608,7 +608,7 @@ static PyMethodDef PyWindow_methods[] = {
PyTypeObject PyWindowType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
- "Window", /*tp_name*/
+ "irssi.Window", /*tp_name*/
sizeof(PyWindow), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)PyWindow_dealloc, /*tp_dealloc*/
diff --git a/src/pyloader.c b/src/pyloader.c
index 9c878a4..2ce1bef 100644
--- a/src/pyloader.c
+++ b/src/pyloader.c
@@ -232,8 +232,11 @@ PyObject *pyloader_find_script_obj(void)
for (frame = PyEval_GetFrame(); frame != NULL; frame = frame->f_back)
{
+ PyObject *script;
+
g_return_val_if_fail(frame->f_globals != NULL, NULL);
- PyObject *script = PyDict_GetItemString(frame->f_globals, "_script");
+ script = PyDict_GetItemString(frame->f_globals, "_script");
+
if (script && pyscript_check(script))
{
/*