diff options
Diffstat (limited to '')
-rw-r--r-- | src/purkle/purkle.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/purkle/purkle.c b/src/purkle/purkle.c index 6770ff4..9cafe01 100644 --- a/src/purkle/purkle.c +++ b/src/purkle/purkle.c | |||
@@ -1,4 +1,3 @@ | |||
1 | //#include "LumbrJack.h" | ||
2 | #include "GuiLua.h" | 1 | #include "GuiLua.h" |
3 | #include "Runnr.h" | 2 | #include "Runnr.h" |
4 | #include "SledjHamr.h" | 3 | #include "SledjHamr.h" |
@@ -8,7 +7,6 @@ static const char *ourName = "purkle"; | |||
8 | static int skang, _M; | 7 | static int skang, _M; |
9 | static Widget *entry, *history; | 8 | static Widget *entry, *history; |
10 | static winFang *me; | 9 | static winFang *me; |
11 | static Ecore_Con_Server *server; | ||
12 | 10 | ||
13 | static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world) | 11 | static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world) |
14 | { | 12 | { |
@@ -60,7 +58,16 @@ static int say(lua_State *L) | |||
60 | pull_lua(L, 1, "%channel $name $id $text", &channel, &name, &id, &text); | 58 | pull_lua(L, 1, "%channel $name $id $text", &channel, &name, &id, &text); |
61 | if (id && text) | 59 | if (id && text) |
62 | { | 60 | { |
61 | GuiLua *gl; | ||
62 | Ecore_Con_Server *server = NULL; | ||
63 | |||
63 | snprintf(buf, sizeof(buf), "events.listen(%d, '%s', '%s', '%s')", channel, name, id, text); | 64 | snprintf(buf, sizeof(buf), "events.listen(%d, '%s', '%s', '%s')", channel, name, id, text); |
65 | // We do this rather than caching it, coz the server might change out from under us. | ||
66 | lua_getfield(L, LUA_REGISTRYINDEX, glName); | ||
67 | gl = lua_touserdata(L, -1); | ||
68 | lua_pop(L, 1); | ||
69 | if (gl) | ||
70 | server = gl->server; | ||
64 | if (server) | 71 | if (server) |
65 | sendForth(server, id, buf); | 72 | sendForth(server, id, buf); |
66 | else | 73 | else |
@@ -97,7 +104,6 @@ int luaopen_purkle(lua_State *L) | |||
97 | { | 104 | { |
98 | parent = gl->parent; | 105 | parent = gl->parent; |
99 | world = gl->world; | 106 | world = gl->world; |
100 | server = gl->server; | ||
101 | } | 107 | } |
102 | 108 | ||
103 | if (!me) me = purkleAdd(parent, 500, 420, world); | 109 | if (!me) me = purkleAdd(parent, 500, 420, world); |