Author: ArcRiley
Date: 2009-01-18 02:34:57 -0500 (Sun, 18 Jan 2009)
New Revision: 1490

Added:
   trunk/concordance/src/sockets/Socket.c
   trunk/concordance/src/sockets/Socket.h
Modified:
   trunk/concordance/src/sockets/__init__.h
Log:
Some more work on concordance.sockets


Added: trunk/concordance/src/sockets/Socket.c
===================================================================
--- trunk/concordance/src/sockets/Socket.c                              (rev 0)
+++ trunk/concordance/src/sockets/Socket.c      2009-01-18 07:34:57 UTC (rev 
1490)
@@ -0,0 +1,60 @@
+/*
+# Concordance XMPP Service Framework
+#
+# Copyright (C) 2009 Copyleft Games Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program 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 Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+*/
+
+#include "Socket.h"
+
+                                                                          /*\
+cdef class Socket :                                                       \*/
+  static char socketsSocket_Doc[] = "Test";
+
+  static PyObject*
+  socketsSocket_new(PyTypeObject* type, PyObject* args, PyObject* kwds) { /*\
+    cdef :                                                                \*/
+      socketsSocket_Object* self;
+
+    /* allocate self */
+    self = (socketsSocket_Object*) type->tp_alloc(type, 0);
+
+    /* start with closed socket */
+    self->sock = -1;
+
+    /* grab context from _core */
+    self->cntx = NULL;
+
+    return (PyObject*) self;
+  }
+
+  static int
+  socketsSocket_init(PyObject* s, PyObject* args, PyObject* kwds) {       /*\
+    cdef :                                                                \*/
+      socketsSocket_Object*      self = (socketsSocket_Object*) s;
+    
+    return 0;
+  }
+
+
+  static void
+  socketsSocket_dealloc(socketsSocket_Object* self) {
+    if (self->sock > -1)
+      close(self->sock);
+    PyObject_Del(self);
+  }
+


Property changes on: trunk/concordance/src/sockets/Socket.c
___________________________________________________________________
Added: svn:keywords
   + Id

Added: trunk/concordance/src/sockets/Socket.h
===================================================================
--- trunk/concordance/src/sockets/Socket.h                              (rev 0)
+++ trunk/concordance/src/sockets/Socket.h      2009-01-18 07:34:57 UTC (rev 
1490)
@@ -0,0 +1,27 @@
+/*
+# Concordance XMPP Service Framework
+#
+# Copyright (C) 2009 Copyleft Games Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program 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 Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+*/
+
+#ifndef SOCKETS_SOCKET_H
+#define SOCKETS_SOCKET_H
+
+#include "__init__.h"
+
+#endif


Property changes on: trunk/concordance/src/sockets/Socket.h
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: trunk/concordance/src/sockets/__init__.h
===================================================================
--- trunk/concordance/src/sockets/__init__.h    2009-01-18 06:52:23 UTC (rev 
1489)
+++ trunk/concordance/src/sockets/__init__.h    2009-01-18 07:34:57 UTC (rev 
1490)
@@ -30,10 +30,11 @@
 
 typedef struct {
   PyObject_HEAD
-  const gchar* addr;
-  gushort      port;
-  int          sock;
-  GIOChannel*  chan;
+  GMainContext*         cntx;                    /* context from _core */
+  const gchar*          addr;
+  gushort               port;
+  int                   sock;
+  GIOChannel*           chan;
 } socketsSocket_Object;
 
 
@@ -42,10 +43,11 @@
 
 typedef struct {
   PyObject_HEAD
-  const gchar* addr;
-  gushort      port;
-  int          sock;
-  GIOChannel*  chan;
+  GMainContext*         cntx;                    /* context from _core */
+  const gchar*          addr;
+  gushort               port;
+  int                   sock;
+  GIOChannel*           chan;
 } socketsClient_Object;
 
 

_______________________________________________
PySoy-SVN mailing list
PySoy-SVN@pysoy.org
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to