diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/extantz/extantz.c | 32 | ||||
-rw-r--r-- | src/purkle/purkle.c | 37 |
2 files changed, 42 insertions, 27 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index a6ffad7..7fce3a3 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -21,8 +21,8 @@ static Eina_Bool _add(void *data, int type, Ecore_Con_Event_Server_Add *ev) | |||
21 | 21 | ||
22 | static Eina_Bool _data(void *data, int type, Ecore_Con_Event_Server_Data *ev) | 22 | static Eina_Bool _data(void *data, int type, Ecore_Con_Event_Server_Data *ev) |
23 | { | 23 | { |
24 | // globals *ourGlobals = data; | 24 | globals *ourGlobals = data; |
25 | // char buf[PATH_MAX]; | 25 | char buf[PATH_MAX]; |
26 | char SID[PATH_MAX]; | 26 | char SID[PATH_MAX]; |
27 | const char *command; | 27 | const char *command; |
28 | char *ext; | 28 | char *ext; |
@@ -39,23 +39,19 @@ static Eina_Bool _data(void *data, int type, Ecore_Con_Event_Server_Data *ev) | |||
39 | ext = index(SID, '.'); | 39 | ext = index(SID, '.'); |
40 | if (ext) | 40 | if (ext) |
41 | { | 41 | { |
42 | ext[0] = '\0'; | 42 | ext[0] = '\0'; |
43 | command = ext + 1; | 43 | command = ext + 1; |
44 | if (0 == strncmp(command, "llOwnerSay(", 11)) | 44 | if ((0 == strncmp(command, "llOwnerSay(", 11)) |
45 | { | 45 | || (0 == strncmp(command, "llWhisper(", 10)) |
46 | PI("Saying to owner from %s - %s", SID, command); | 46 | || (0 == strncmp(command, "llSay(", 6)) |
47 | } | 47 | || (0 == strncmp(command, "llShout(", 8))) |
48 | else if (0 == strncmp(command, "llWhisper(", 10)) | ||
49 | { | ||
50 | PI("Whispering from %s - %s", SID, command); | ||
51 | } | ||
52 | else if (0 == strncmp(command, "llSay(", 6)) | ||
53 | { | ||
54 | PI("Saying from %s - %s", SID, command); | ||
55 | } | ||
56 | else if (0 == strncmp(command, "llShout(", 8)) | ||
57 | { | 48 | { |
58 | PI("Shouting from %s - %s", SID, command); | 49 | int _M; |
50 | |||
51 | sprintf(buf, "%s: %s", SID, command); | ||
52 | lua_getfield(ourGlobals->purkle->L, LUA_REGISTRYINDEX, ourGlobals->purkle->name); | ||
53 | _M = lua_gettop(ourGlobals->purkle->L); | ||
54 | push_lua(ourGlobals->purkle->L, "@ ( $ )", _M, "append", buf, 0); | ||
59 | } | 55 | } |
60 | else if (0 == strncmp(command, "llDialog(", 9)) | 56 | else if (0 == strncmp(command, "llDialog(", 9)) |
61 | { | 57 | { |
diff --git a/src/purkle/purkle.c b/src/purkle/purkle.c index 2ee4964..f86f3f3 100644 --- a/src/purkle/purkle.c +++ b/src/purkle/purkle.c | |||
@@ -4,21 +4,24 @@ | |||
4 | #include "winFang.h" | 4 | #include "winFang.h" |
5 | 5 | ||
6 | 6 | ||
7 | static const char *ourName = "purkle"; | ||
8 | static int skang, _M; | ||
9 | static Widget *entry, *history; | ||
10 | |||
7 | 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) |
8 | { | 12 | { |
9 | winFang *me; | 13 | winFang *me; |
10 | Widget *wid; | ||
11 | 14 | ||
12 | me = winFangAdd(parent, 30, 590, w, h, "chatter box", "purkle", world); | 15 | me = winFangAdd(parent, 30, 590, w, h, "chatter box", "purkle", world); |
13 | 16 | ||
14 | wid = widgetAdd(me, WT_TEXTBOX, "History is shown here", -1, -1, -1, -1); | 17 | history = widgetAdd(me, WT_TEXTBOX, "History is shown here", -1, -1, -1, -1); |
15 | eo_do(wid->obj, | 18 | eo_do(history->obj, |
16 | elm_obj_entry_scrollable_set(EINA_TRUE), | 19 | elm_obj_entry_scrollable_set(EINA_TRUE), |
17 | elm_obj_entry_editable_set(EINA_FALSE) | 20 | elm_obj_entry_editable_set(EINA_FALSE) |
18 | ); | 21 | ); |
19 | 22 | ||
20 | wid = widgetAdd(me, WT_ENTRY, "", -1, -1, -1, -1); | 23 | entry = widgetAdd(me, WT_ENTRY, "", -1, -1, -1, -1); |
21 | eo_do(wid->obj, | 24 | eo_do(entry->obj, |
22 | elm_obj_entry_scrollable_set(EINA_TRUE), | 25 | elm_obj_entry_scrollable_set(EINA_TRUE), |
23 | elm_obj_entry_editable_set(EINA_TRUE) | 26 | elm_obj_entry_editable_set(EINA_TRUE) |
24 | ); | 27 | ); |
@@ -28,8 +31,23 @@ static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world) | |||
28 | return me; | 31 | return me; |
29 | } | 32 | } |
30 | 33 | ||
31 | static const char *ourName = "purkle"; | 34 | static int append(lua_State *L) |
32 | static int skang, _M; | 35 | { |
36 | char *text = NULL; | ||
37 | |||
38 | pull_lua(L, 1, "$", &text); | ||
39 | if (text) | ||
40 | { | ||
41 | eo_do(history->obj, | ||
42 | elm_obj_entry_entry_append("<br/>"), | ||
43 | // TODO - Add a time stamp, and log to a file. | ||
44 | elm_obj_entry_entry_append(text), | ||
45 | // TODO - really need a "scroll to the bottom" here, this cursor down wont work if lines get wrapped onto multiple lines. | ||
46 | elm_obj_entry_cursor_down() | ||
47 | ); | ||
48 | } | ||
49 | return 0; | ||
50 | } | ||
33 | 51 | ||
34 | int luaopen_purkle(lua_State *L) | 52 | int luaopen_purkle(lua_State *L) |
35 | { | 53 | { |
@@ -51,6 +69,8 @@ int luaopen_purkle(lua_State *L) | |||
51 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); | 69 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); |
52 | _M = lua_gettop(L); | 70 | _M = lua_gettop(L); |
53 | 71 | ||
72 | push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, _M, "append", "Append text to the history box.", append, "string", 0); | ||
73 | |||
54 | lua_getfield(L, LUA_REGISTRYINDEX, glName); | 74 | lua_getfield(L, LUA_REGISTRYINDEX, glName); |
55 | gl = lua_touserdata(L, -1); | 75 | gl = lua_touserdata(L, -1); |
56 | lua_pop(L, 1); | 76 | lua_pop(L, 1); |
@@ -60,8 +80,7 @@ int luaopen_purkle(lua_State *L) | |||
60 | world = gl->world; | 80 | world = gl->world; |
61 | } | 81 | } |
62 | 82 | ||
63 | purkleAdd(parent, 200, 400, world); | 83 | purkleAdd(parent, 500, 420, world); |
64 | |||
65 | push_lua(L, "@ ( = )", skang, MODULEEND, _M, 0); | 84 | push_lua(L, "@ ( = )", skang, MODULEEND, _M, 0); |
66 | 85 | ||
67 | // Return _M, the table itself, not the index. | 86 | // Return _M, the table itself, not the index. |