summaryrefslogtreecommitdiffstats
path: root/objects/connect-object.c
diff options
context:
space:
mode:
authorChristopher Davis <loafier@gmail.com>2006-08-10 02:10:22 +0000
committerChristopher Davis <loafier@gmail.com>2006-08-10 02:10:22 +0000
commitb1b54c58af7cd9419631d7b82b860a7b19097836 (patch)
treebd0a8c8cd93ad473a3d835de14b2481d3c5a5c83 /objects/connect-object.c
parentc0ac6d60c5319a08148d743fd03ba3f66b22dfe0 (diff)
downloadirssi-python-b1b54c58af7cd9419631d7b82b860a7b19097836.tar.gz
irssi-python-b1b54c58af7cd9419631d7b82b860a7b19097836.tar.xz
irssi-python-b1b54c58af7cd9419631d7b82b860a7b19097836.zip
added function headers to documentation of module and all objects.
added MainWindow object git-svn-id: http://svn.irssi.org/repos/irssi-python@4310 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'objects/connect-object.c')
-rw-r--r--objects/connect-object.c129
1 files changed, 70 insertions, 59 deletions
diff --git a/objects/connect-object.c b/objects/connect-object.c
index 2db0e13..8ef9a29 100644
--- a/objects/connect-object.c
+++ b/objects/connect-object.c
@@ -6,18 +6,6 @@
#include "pycore.h"
#include "pyutils.h"
-/* member IDs */
-enum
-{
- M_CONNECT_ADDRESS,
- M_CONNECT_PORT,
- M_CONNECT_CHATNET,
- M_CONNECT_PASSWORD,
- M_CONNECT_WANTED_NICK,
- M_CONNECT_USERNAME,
- M_CONNECT_REALNAME,
-};
-
static void connect_cleanup(SERVER_CONNECT_REC *connect)
{
PyConnect *pyconn = signal_get_user_data();
@@ -40,63 +28,86 @@ static void PyConnect_dealloc(PyConnect *self)
self->ob_type->tp_free((PyObject*)self);
}
-static PyObject *PyConnect_get(PyConnect *self, void *closure)
+/* Getters */
+PyDoc_STRVAR(PyConnect_address_doc,
+ "Address where we connected (irc.blah.org)"
+);
+static PyObject *PyConnect_address_get(PyConnect *self, void *closure)
{
- int member = GPOINTER_TO_INT(closure);
-
RET_NULL_IF_INVALID(self->data);
-
- switch (member)
- {
- case M_CONNECT_ADDRESS:
- RET_AS_STRING_OR_NONE(self->data->address);
- case M_CONNECT_PORT:
- return PyInt_FromLong(self->data->port);
- case M_CONNECT_CHATNET:
- RET_AS_STRING_OR_NONE(self->data->chatnet);
- case M_CONNECT_PASSWORD:
- RET_AS_STRING_OR_NONE(self->data->password);
- case M_CONNECT_WANTED_NICK:
- RET_AS_STRING_OR_NONE(self->data->nick);
- case M_CONNECT_USERNAME:
- RET_AS_STRING_OR_NONE(self->data->username);
- case M_CONNECT_REALNAME:
- RET_AS_STRING_OR_NONE(self->data->realname);
- }
-
- /* This shouldn't be reached... but... */
- return PyErr_Format(PyExc_RuntimeError, "invalid member id, %d", member);
+ RET_AS_STRING_OR_NONE(self->data->address);
}
-static PyGetSetDef PyConnect_getseters[] = {
- {"address", (getter)PyConnect_get, NULL,
- "Address where we connected (irc.blah.org)",
- GINT_TO_POINTER(M_CONNECT_ADDRESS)},
-
- {"port", (getter)PyConnect_get, NULL,
- "Port where we connected",
- GINT_TO_POINTER(M_CONNECT_PORT)},
+PyDoc_STRVAR(PyConnect_port_doc,
+ "Port where we're connected"
+);
+static PyObject *PyConnect_port_get(PyConnect *self, void *closure)
+{
+ RET_NULL_IF_INVALID(self->data);
+ return PyInt_FromLong(self->data->port);
+}
- {"chatnet", (getter)PyConnect_get, NULL,
- "Chat network",
- GINT_TO_POINTER(M_CONNECT_CHATNET)},
+PyDoc_STRVAR(PyConnect_chatnet_doc,
+ "Chat network"
+);
+static PyObject *PyConnect_chatnet_get(PyConnect *self, void *closure)
+{
+ RET_NULL_IF_INVALID(self->data);
+ RET_AS_STRING_OR_NONE(self->data->chatnet);
+}
- {"password", (getter)PyConnect_get, NULL,
- "Password we used in connection.",
- GINT_TO_POINTER(M_CONNECT_PASSWORD)},
+PyDoc_STRVAR(PyConnect_password_doc,
+ "Password we used in connection."
+);
+static PyObject *PyConnect_password_get(PyConnect *self, void *closure)
+{
+ RET_NULL_IF_INVALID(self->data);
+ RET_AS_STRING_OR_NONE(self->data->password);
+}
- {"wanted_nick", (getter)PyConnect_get, NULL,
- "Nick which we would prefer to use",
- GINT_TO_POINTER(M_CONNECT_WANTED_NICK)},
+PyDoc_STRVAR(PyConnect_wanted_nick_doc,
+ "Nick which we would prefer to use"
+);
+static PyObject *PyConnect_wanted_nick_get(PyConnect *self, void *closure)
+{
+ RET_NULL_IF_INVALID(self->data);
+ RET_AS_STRING_OR_NONE(self->data->nick);
+}
- {"username", (getter)PyConnect_get, NULL,
- "User name",
- GINT_TO_POINTER(M_CONNECT_USERNAME)},
+PyDoc_STRVAR(PyConnect_username_doc,
+ "User name"
+);
+static PyObject *PyConnect_username_get(PyConnect *self, void *closure)
+{
+ RET_NULL_IF_INVALID(self->data);
+ RET_AS_STRING_OR_NONE(self->data->username);
+}
- {"realname", (getter)PyConnect_get, NULL,
- "Real name",
- GINT_TO_POINTER(M_CONNECT_REALNAME)},
+PyDoc_STRVAR(PyConnect_realname_doc,
+ "Real name"
+);
+static PyObject *PyConnect_realname_get(PyConnect *self, void *closure)
+{
+ RET_NULL_IF_INVALID(self->data);
+ RET_AS_STRING_OR_NONE(self->data->realname);
+}
+/* Get/Set */
+static PyGetSetDef PyConnect_getseters[] = {
+ {"address", (getter)PyConnect_address_get, NULL,
+ PyConnect_address_doc, NULL},
+ {"port", (getter)PyConnect_port_get, NULL,
+ PyConnect_port_doc, NULL},
+ {"chatnet", (getter)PyConnect_chatnet_get, NULL,
+ PyConnect_chatnet_doc, NULL},
+ {"password", (getter)PyConnect_password_get, NULL,
+ PyConnect_password_doc, NULL},
+ {"wanted_nick", (getter)PyConnect_wanted_nick_get, NULL,
+ PyConnect_wanted_nick_doc, NULL},
+ {"username", (getter)PyConnect_username_get, NULL,
+ PyConnect_username_doc, NULL},
+ {"realname", (getter)PyConnect_realname_get, NULL,
+ PyConnect_realname_doc, NULL},
{NULL}
};