summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Hornecker2009-12-21 16:07:36 +0100
committerPatrick Hornecker2009-12-21 16:07:36 +0100
commit3cefadd098bb72a087406ecc09c1c04f1dca0ab5 (patch)
treebbec3ea006ac2abc6bdf52f00ca2b970f27274d9
parentfew changes (diff)
downloadfriendfinder-3cefadd098bb72a087406ecc09c1c04f1dca0ab5.tar.gz
friendfinder-3cefadd098bb72a087406ecc09c1c04f1dca0ab5.tar.xz
friendfinder-3cefadd098bb72a087406ecc09c1c04f1dca0ab5.zip
file locations reorderd, map in gui...build problems on local machine
-rw-r--r--friendfinder/Makefile9
-rw-r--r--friendfinder/Makefile.CE26
-rw-r--r--friendfinder/Makefile.inc46
-rw-r--r--friendfinder/Makefile~10
-rw-r--r--friendfinder/data/maps/fr_map.eetbin0 -> 7100184 bytes
-rw-r--r--friendfinder/e_smart_map.c486
-rw-r--r--friendfinder/e_smart_map.h18
-rw-r--r--friendfinder/e_smart_tile.c296
-rw-r--r--friendfinder/e_smart_tile.h31
-rw-r--r--friendfinder/gui.c474
-rw-r--r--friendfinder/gui.h28
-rw-r--r--friendfinder/handler.c91
-rw-r--r--friendfinder/handler.h10
-rw-r--r--friendfinder/map/.map_reader.c.swpbin0 -> 12288 bytes
-rw-r--r--friendfinder/map/controls.c146
-rw-r--r--friendfinder/map/e_smart_tile.h31
-rw-r--r--friendfinder/map/map_reader.c141
-rw-r--r--friendfinder/map/object.c176
-rw-r--r--friendfinder/map/overlay.c257
-rw-r--r--friendfinder/map/smart_map_priv.h166
-rw-r--r--friendfinder/msg_sender.0
-rw-r--r--friendfinder/msg_sender.c257
-rw-r--r--friendfinder/msg_sender.h22
-rw-r--r--friendfinder/msg_sender.obin0 -> 19608 bytes
-rw-r--r--friendfinder/receiver.c128
-rw-r--r--friendfinder/receiver.h13
-rw-r--r--friendfinder/receiver.obin0 -> 13048 bytes
-rw-r--r--friendfinder/render/line.c394
-rw-r--r--friendfinder/render/line.h39
-rw-r--r--friendfinder/sender.c168
-rw-r--r--friendfinder/sender.h13
-rw-r--r--friendfinder/sender.obin0 -> 15104 bytes
-rw-r--r--friendfinder/util/projection.c96
-rw-r--r--friendfinder/util/projection.h11
-rw-r--r--friendfinder/util/sqlite_helper.c205
-rw-r--r--friendfinder/util/sqlite_helper.h17
-rw-r--r--friendfinder/util/sqlite_helper.obin0 -> 13024 bytes
-rw-r--r--friendfinder/vkbd/Makefile6
-rw-r--r--friendfinder/vkbd/VeraBd.ttfbin0 -> 58716 bytes
-rw-r--r--friendfinder/vkbd/arrow_down.pngbin0 -> 1577 bytes
-rw-r--r--friendfinder/vkbd/background.pngbin0 -> 2939 bytes
-rw-r--r--friendfinder/vkbd/backspace.pngbin0 -> 1213 bytes
-rw-r--r--friendfinder/vkbd/bt_basew.pngbin0 -> 1527 bytes
-rw-r--r--friendfinder/vkbd/bt_glow.pngbin0 -> 734 bytes
-rw-r--r--friendfinder/vkbd/ilist_1.pngbin0 -> 1281 bytes
-rw-r--r--friendfinder/vkbd/vkbd-key.edc137
-rw-r--r--friendfinder/vkbd/vkbd-main.edc219
-rw-r--r--friendfinder/vkbd/vkbd-shift.edc97
-rw-r--r--friendfinder/vkbd/vkbd.c260
-rw-r--r--friendfinder/vkbd/vkbd.edc188
-rw-r--r--friendfinder/vkbd/vkbd.edjbin0 -> 88763 bytes
-rw-r--r--friendfinder/vkbd/vkbd.h6
-rw-r--r--msg_sender/Makefile.inc22
-rw-r--r--msg_sender/gui.c171
-rw-r--r--msg_sender/gui.h6
-rw-r--r--msg_sender/handler.c41
-rw-r--r--msg_sender/handler.h4
-rw-r--r--msg_sender/msg_sender.c4
-rw-r--r--msg_sender/msg_sender.h11
59 files changed, 4897 insertions, 80 deletions
diff --git a/friendfinder/Makefile b/friendfinder/Makefile
new file mode 100644
index 0000000..8b00324
--- /dev/null
+++ b/friendfinder/Makefile
@@ -0,0 +1,9 @@
+include Makefile.inc
+
+all: $(OBJECTS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o gui$(SUFFIX)
+
+
+prepare: $(OBJECTS_PREPARE)
+ $(CC) $(CFLAGS) -g $(LDFLAGS) $(OBJECTS_PREPARE) $(LIBS) -lm -o prepare
+
diff --git a/friendfinder/Makefile.CE b/friendfinder/Makefile.CE
new file mode 100644
index 0000000..63f7230
--- /dev/null
+++ b/friendfinder/Makefile.CE
@@ -0,0 +1,26 @@
+include Makefile.inc
+
+#OBJECTS += gps/gps_wince.o
+#OBJECTS += gps/nmea.o
+#OBJECTS += wince/display.o
+#OBJECTS += libircclient.o
+
+#OBJECTS += rc/ueberall.rsc
+
+CC = gcc
+#WINDRES = arm-wince-mingw32ce-windres
+#LDFLAGS = -Wl#,--enable-auto-import
+#SUFFIX = .exe
+
+#CFLAGS += -DWINCE
+#CFLAGS += -DGPS_LOG
+
+
+rc/ueberall.rsc: rc/ueberall.rc
+ $(WINDRES) $? $@
+
+all: $(OBJECTS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -lws2 -o gui$(SUFFIX)
+
+install: all
+ cp gui.exe $(WINCE_PATH)/bin
diff --git a/friendfinder/Makefile.inc b/friendfinder/Makefile.inc
new file mode 100644
index 0000000..5c18f28
--- /dev/null
+++ b/friendfinder/Makefile.inc
@@ -0,0 +1,46 @@
+###########
+# settings
+###########
+
+CFLAGS = -g -Wall -std=c99
+INCLUDES = -I../include -I/usr/local/include
+LIBS = -ledje -lecore -levas -lelementary -lecore_evas -lcrypto -lircclient -lproj
+
+
+###########
+# objects
+###########
+
+OBJECTS = msg_sender.o
+OBJECTS += receiver.o
+OBJECTS += sender.o
+OBJECTS += gui.o
+
+OBJECTS += e_smart_tile.o
+OBJECTS += e_smart_map.o
+
+OBJECTS += render/line.o
+
+OBJECTS += map/map_reader.o
+OBJECTS += map/controls.o
+OBJECTS += map/object.o
+OBJECTS += map/overlay.o
+
+OBJECTS += util/projection.o
+
+OBJECTS += vkbd/vkbd.o
+OBJECTS += handler.o
+
+##################
+# rules
+##################
+
+%.o: %.c
+ $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+
+clean:
+ rm -rf $(OBJECTS) $(OBJECTS_PREPARE) gui$(SUFFIX)
+# $(MAKE) -C themes clean
+# $(MAKE) -C vkbd clean
+
+
diff --git a/friendfinder/Makefile~ b/friendfinder/Makefile~
new file mode 100644
index 0000000..1f27fef
--- /dev/null
+++ b/friendfinder/Makefile~
@@ -0,0 +1,10 @@
+include Makefile.inc
+
+all: $(OBJECTS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o gui$(SUFFIX)
+ $(MAKE) -C themes
+ $(MAKE) -C vkbd
+
+prepare: $(OBJECTS_PREPARE)
+ $(CC) $(CFLAGS) -g $(LDFLAGS) $(OBJECTS_PREPARE) $(LIBS) -lm -o prepare
+
diff --git a/friendfinder/data/maps/fr_map.eet b/friendfinder/data/maps/fr_map.eet
new file mode 100644
index 0000000..f2b4563
--- /dev/null
+++ b/friendfinder/data/maps/fr_map.eet
Binary files differ
diff --git a/friendfinder/e_smart_map.c b/friendfinder/e_smart_map.c
new file mode 100644
index 0000000..dc32412
--- /dev/null
+++ b/friendfinder/e_smart_map.c
@@ -0,0 +1,486 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+#include <Elementary.h>
+
+#include "e_smart_map.h"
+#include "e_smart_tile.h"
+
+#include "render/line.h"
+
+#include "map/smart_map_priv.h"
+
+#include "util/sqlite_helper.h"
+
+static Evas_Smart *get_smart();
+static void _map_object_add(Evas_Object *o);
+static void _map_object_del(Evas_Object *o);
+static void _map_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y);
+static void _map_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h);
+static void _map_object_show(Evas_Object *o);
+static void _map_object_hide(Evas_Object *o);
+static void _map_object_color_set(Evas_Object *o, int r, int g, int b, int a);
+static void _map_object_clip_set(Evas_Object *o, Evas_Object *clip);
+static void _map_object_clip_unset(Evas_Object *o);
+
+#define SMART_MAP_NAME "e_smart_map"
+
+void e_smart_map_set_info(Evas_Object *o, const char *info)
+{
+ struct smart_map *smart;
+
+ smart = evas_object_smart_data_get(o);
+ if(smart->theme == NULL)
+ return;
+
+ edje_object_part_text_set(smart->theme, "position", info);
+}
+
+struct bubble
+{
+ struct overlay_object object;
+ Evas_Object *av;
+ Evas_Object *bb;
+};
+
+static struct bubble *create_text_bubble(struct smart_map *smart, char *info, char *text)
+{
+ struct bubble *bubble;
+
+ bubble = (struct bubble*)malloc(sizeof(struct bubble));
+
+ bubble->object.obj = elm_box_add(smart->win);
+ evas_object_size_hint_weight_set(bubble->object.obj, 1.0, 1.0);
+ evas_object_size_hint_align_set(bubble->object.obj, 0.0, 0.0);
+
+ bubble->av = elm_entry_add(smart->win);
+ elm_entry_entry_set(bubble->av, text);
+ elm_entry_line_wrap_set(bubble->av, 0);
+ evas_object_size_hint_weight_set(bubble->av, 1.0, 1.0);
+ // evas_object_smart_callback_add(av, "anchor,clicked", my_anchorblock_anchor, av);
+
+ bubble->bb = elm_bubble_add(smart->win);
+ elm_bubble_info_set(bubble->bb, info);
+ evas_object_size_hint_min_set(bubble->bb, 150, 150);
+ evas_object_size_hint_max_set(bubble->bb, 300, 300);
+ evas_object_size_hint_weight_set(bubble->bb, 1.0, 1.0);
+ evas_object_size_hint_align_set(bubble->bb, 0.0, 0.0);
+ elm_bubble_content_set(bubble->bb, bubble->av);
+ evas_object_show(bubble->av);
+ elm_anchorblock_hover_end(bubble->av);
+ elm_box_pack_end(bubble->object.obj, bubble->bb);
+
+ // evas_object_resize(bb, 100, 80);
+ // evas_object_move(bb, 120 - 15,160-23);
+ evas_object_show(bubble->bb);
+ bubble->object.ox = -14;
+ bubble->object.oy = -14;
+ bubble->object.sw = 480;
+ bubble->object.sh = 640;
+ fprintf(stderr, "FIXME: %s:%i\n", __FILE__, __LINE__);
+ return bubble;
+}
+
+void e_smart_map_overlay_set_bubble(Evas_Object *o, char *overlay, char *info, char *text, double lat, double lon, int flags)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+
+ struct bubble *bb;
+ struct overlay_item *poi = malloc(sizeof(struct overlay_item));
+ bb = create_text_bubble(smart, info, text);
+
+ poi->obj = &bb->object;
+ poi->lat = lat;
+ poi->lon = lon;
+ poi->level_mask = flags;
+
+ struct map_overlay *ov = overlay_find_by_name(smart, overlay);
+ if(ov == NULL)
+ e_smart_map_add_overlay(o, overlay);
+
+ ov = overlay_find_by_name(smart, overlay);
+ if(ov == NULL)
+ return;
+
+ overlay_add(smart, ov, poi);
+ overlay_change_level(smart, smart->current_level);
+ map_object_update(smart);
+}
+
+void e_smart_map_overlay_hide(Evas_Object *o, char *overlay)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+
+ overlay_hide(smart, overlay);
+}
+
+void e_smart_map_set_pos_px(Evas_Object *o, Evas_Coord x, Evas_Coord y)
+{
+ struct smart_map *smart;
+
+ smart = evas_object_smart_data_get(o);
+ smart->ta.ox = x;
+ smart->ta.oy = y;
+ smart->ta.mode = POSITION_PX;
+ map_object_update(smart);
+}
+
+void e_smart_map_set_pos(Evas_Object *o, double lat, double lon)
+{
+ struct smart_map *smart;
+
+ smart = evas_object_smart_data_get(o);
+ smart->ta.lat = lat;
+ smart->ta.lon = lon;
+ smart->ta.mode = POSITION_WORLD;
+ smart->lat = lat;
+ smart->lon = lon;
+ map_object_update(smart);
+}
+
+void e_smart_map_get_pos(Evas_Object *o, double *lat, double *lon)
+{
+ struct smart_map *smart;
+
+ smart = evas_object_smart_data_get(o);
+ *lat = smart->lat;
+ *lon = smart->lon;
+}
+
+
+void e_smart_map_move(Evas_Object *o, Evas_Coord dx, Evas_Coord dy)
+{
+ struct smart_map *smart;
+
+ smart = evas_object_smart_data_get(o);
+ smart->ta.ox += dx;
+ smart->ta.oy += dy;
+ smart->ta.mode = POSITION_PX;
+ map_object_update(smart);
+}
+
+static inline void
+_polyline_to_map(struct smart_map *smart, struct polyline *pl)
+{
+ int i;
+ int bx, by;
+
+ if(smart->li == NULL)
+ return;
+
+ for(i = 0; i < pl->count; i++)
+ {
+ if(i == 0)
+ {
+
+ latlon_to_map(smart->li,
+ pl->points[i].lat, pl->points[i].lon, &bx, &by);
+ pl->points[i].x = bx;
+ pl->points[i].y = by;
+ }
+ else {
+ int x, y;
+ latlon_to_map(smart->li,
+ pl->points[i].lat, pl->points[i].lon, &x, &y);
+ pl->points[i].x = x;
+ pl->points[i].y = y;
+
+ }
+ // point_dump(&pl->points[i]);
+ }
+}
+
+int e_smart_map_add_path(Evas_Object *o, struct polyline *_pl)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+
+ Evas_Object *poly = e_smart_line_add(smart->evas);
+ _polyline_to_map(smart, _pl);
+ e_smart_line_set(poly, _pl);
+ evas_object_layer_set(poly, 0);
+ evas_object_pass_events_set(poly, 1);
+ evas_object_layer_set(smart->c.ctrl, 5);
+ evas_object_show(poly);
+ eina_array_push(smart->paths, poly);
+ map_object_update(smart);
+ return 0;
+}
+
+int e_smart_map_add_overlay(Evas_Object *o, char *name)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+
+ struct map_overlay *ov = overlay_create(smart, name);
+ if(ov == NULL)
+ return -1;
+
+ return eina_array_push(smart->overlays, ov);
+}
+
+Evas_Object *e_smart_map_add(Evas_Object *win, const char *map_eet)
+{
+ Evas_Object *obj;
+ struct smart_map *smart;
+ Evas *e;
+
+ e = evas_object_evas_get(win);
+ obj = evas_object_smart_add(e, get_smart());
+ if(obj == NULL)
+ return NULL;
+
+ smart = evas_object_smart_data_get(obj);
+ if(smart == NULL)
+ {
+ evas_object_del(obj);
+ return NULL;
+ }
+ smart->mi = map_info_read(map_eet);
+ if(smart->mi == NULL)
+ {
+ printf("map_info read failed\n");
+ evas_object_del(obj);
+ return NULL;
+ }
+
+ smart->evas = e;
+ smart->li = NULL;
+ smart->ta.tiles = NULL;
+ smart->ta.ox = 0;
+ smart->ta.oy = 0;
+ smart->ta.mode = POSITION_PX;
+ smart->drag = 0;
+ smart->theme = NULL;
+ smart->win = win;
+ smart->overlays = eina_array_new(4);
+ smart->paths = eina_array_new(4);
+ controls_init(smart);
+ _set_level(smart, 8);
+ return obj;
+}
+
+int _set_level(struct smart_map *smart, int level)
+{
+ Eina_Array_Iterator iterator;
+ int i;
+ Evas_Object *path;
+
+ smart->li = map_info_get_level(smart->mi, &level);
+ if(smart->li == NULL)
+ return -1;
+
+ smart->current_level = level;
+ smart->ta.lat = smart->lat;
+ smart->ta.lon = smart->lon;
+ smart->ta.mode = POSITION_WORLD;
+
+ EINA_ARRAY_ITER_NEXT(smart->paths, i, path, iterator)
+ {
+ struct polyline *_pl = e_smart_line_get(path);
+ if(_pl == NULL)
+ continue;
+ _polyline_to_map(smart, _pl);
+ e_smart_line_set(path, _pl);
+ evas_object_show(path);
+ }
+
+ overlay_change_level(smart, level);
+ map_object_update(smart);
+ return 0;
+}
+
+int e_smart_map_set_level(Evas_Object *o, int level)
+{
+ struct smart_map *smart;
+
+ smart = evas_object_smart_data_get(o);
+ return _set_level(smart, level);
+}
+
+static void
+zoom_cb(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+ double x, y;
+ int new_level;
+ struct smart_map *smart = (struct smart_map *)data;
+ int max_level = smart->mi->max_level;
+ int min_level = smart->mi->min_level;
+
+ edje_object_part_drag_value_get(smart->theme, "zoom", &x, &y);
+ new_level = max_level - ((max_level - min_level) * y);
+
+ smart->ta.lat = smart->lat;
+ smart->ta.lon = smart->lon;
+ smart->ta.mode = POSITION_WORLD;
+
+ _set_level(smart, new_level);
+}
+
+int e_smart_map_set_theme(Evas_Object *o, const char *theme, const char *group)
+{
+ Evas_Object *edje;
+ struct smart_map *smart;
+
+ smart = evas_object_smart_data_get(o);
+ edje = edje_object_add(evas_object_evas_get(o));
+ if(!edje_object_file_set(edje, theme, group))
+ {
+ printf("failed loading %s/%s\n", theme, group);
+ return -1;
+ }
+
+ // XXX: reset ?
+ smart->theme = edje;
+
+ evas_object_smart_member_add(edje, o);
+ evas_object_move(edje, smart->x, smart->y);
+ evas_object_resize(edje, smart->w, smart->h);
+ evas_object_clip_set(edje, smart->clip);
+ evas_object_show(edje);
+
+ edje_object_signal_callback_add(edje, "drag", "zoom", zoom_cb, smart);
+ edje_object_part_drag_value_set(edje, "zoom", 0.0, 0.5);
+ return 0;
+}
+
+static void _map_object_add(Evas_Object *o)
+{
+ struct smart_map *smart;
+
+ smart = calloc(1, sizeof(struct smart_map));
+ if(smart == NULL)
+ return;
+
+ smart->obj = o;
+ smart->x = 0;
+ smart->y = 0;
+ smart->w = 0;
+ smart->h = 0;
+
+ smart->clip = evas_object_rectangle_add(evas_object_evas_get(o));
+ evas_object_smart_member_add(smart->clip, o);
+ evas_object_color_set(smart->clip, 255, 255, 255, 255);
+
+ evas_object_smart_data_set(o, smart);
+}
+
+static void _map_object_del(Evas_Object *o)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+
+ // XXX
+
+ free(smart);
+}
+
+static void _map_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+ if(!smart)
+ return;
+
+ smart->x = x;
+ smart->y = y;
+ evas_object_move(smart->clip, x, y);
+ evas_object_move(smart->c.ctrl, x, y);
+ if(smart->theme)
+ evas_object_move(smart->theme, x, y);
+ map_object_update(smart);
+}
+
+static void _map_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+ if(!smart)
+ return;
+ smart->w = w;
+ smart->h = h;
+ smart->ta.w = w;
+ smart->ta.h = h;
+ evas_object_resize(smart->clip, w, h);
+ evas_object_resize(smart->c.ctrl, w, h);
+ if(smart->theme)
+ evas_object_resize(smart->theme, w, h);
+ map_object_update(smart);
+}
+
+static void _map_object_show(Evas_Object *o)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+ if(!smart)
+ return;
+ evas_object_show(smart->clip);
+}
+
+static void _map_object_hide(Evas_Object *o)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+ if(!smart)
+ return;
+ evas_object_hide(smart->clip);
+}
+
+static void _map_object_color_set(Evas_Object *o, int r, int g, int b, int a)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+ if(!smart)
+ return;
+ evas_object_color_set(smart->clip, r, g, b, a);
+}
+
+static void _map_object_clip_set(Evas_Object *o, Evas_Object *clip)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+ if(!smart)
+ return;
+ evas_object_clip_set(smart->clip, clip);
+}
+
+static void _map_object_clip_unset(Evas_Object *o)
+{
+ struct smart_map *smart;
+ smart = evas_object_smart_data_get(o);
+ if(!smart)
+ return;
+ evas_object_clip_unset(smart->clip);
+}
+
+static Evas_Smart *get_smart()
+{
+ static Evas_Smart *e_smart_map = NULL;
+
+ if(e_smart_map != NULL)
+ return e_smart_map;
+
+ e_smart_map = evas_smart_new(SMART_MAP_NAME,
+ _map_object_add,
+ _map_object_del,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ _map_object_move,
+ _map_object_resize,
+ _map_object_show,
+ _map_object_hide,
+ _map_object_color_set,
+ _map_object_clip_set,
+ _map_object_clip_unset,
+ NULL);
+ return e_smart_map;
+}
+
diff --git a/friendfinder/e_smart_map.h b/friendfinder/e_smart_map.h
new file mode 100644
index 0000000..6c56785
--- /dev/null
+++ b/friendfinder/e_smart_map.h
@@ -0,0 +1,18 @@
+#ifndef __E_SMART_MAP
+#define __E_SMART_MAP
+
+struct polyline;
+struct overlay;
+struct polyline;
+
+Evas_Object *e_smart_map_add(Evas_Object *e, const char *map_eet);
+int e_smart_map_set_level(Evas_Object *o, int level);
+void e_smart_map_set_pos(Evas_Object *o, double lat, double lon);
+void e_smart_map_set_info(Evas_Object *o, const char *info);
+void e_smart_map_get_pos(Evas_Object *o, double *lat, double *lon);
+int e_smart_map_add_overlay(Evas_Object *map, char *name);
+void e_smart_map_overlay_set_bubble(Evas_Object *o, char *overlay, char *info, char *text, double lat, double lon, int flags);
+void e_smart_map_overlay_hide(Evas_Object *o, char *overlay);
+
+int e_smart_map_add_path(Evas_Object *o, struct polyline *_p);
+#endif
diff --git a/friendfinder/e_smart_tile.c b/friendfinder/e_smart_tile.c
new file mode 100644
index 0000000..0343241
--- /dev/null
+++ b/friendfinder/e_smart_tile.c
@@ -0,0 +1,296 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <Evas.h>
+#include <Eet.h>
+#include "e_smart_tile.h"
+
+static Evas_Smart *get_smart();
+
+static void _tile_object_add(Evas_Object *o);
+static void _tile_object_del(Evas_Object *o);
+static void _tile_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y);
+static void _tile_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h);
+static void _tile_object_show(Evas_Object *o);
+static void _tile_object_hide(Evas_Object *o);
+static void _tile_object_color_set(Evas_Object *o, int r, int g, int b, int a);
+static void _tile_object_clip_set(Evas_Object *o, Evas_Object *clip);
+static void _tile_object_clip_unset(Evas_Object *o);
+
+#define SMART_TILE_NAME "e_smart_tile"
+
+struct smart_tile_data
+{
+ Evas_Object *obj;
+ Evas_Coord x, y, w, h;
+
+ Evas_Object *clip;
+ Evas_Object *img;
+ Evas_Object *bg;
+ int offset_x;
+ int offset_y;
+ int scale;
+ struct osm_data osm;
+};
+
+Evas_Object *e_smart_tile_add(Evas *e)
+{
+ Evas_Object *o;
+ struct smart_tile_data *smart;
+
+ o = evas_object_smart_add(e, get_smart());
+ smart = evas_object_smart_data_get(o);
+ if(smart == NULL)
+ {
+ evas_object_del(o);
+ return NULL;
+ }
+ return o;
+}
+
+struct osm_data *e_smart_tile_unload(Evas_Object *tile)
+{
+ struct smart_tile_data *data;
+ data = evas_object_smart_data_get(tile);
+ evas_object_hide(data->img);
+ evas_object_show(data->bg);
+ return &(data->osm);
+}
+
+struct osm_data *e_smart_tile_needs_update(Evas_Object *tile, int z, int x, int y)
+{
+ struct smart_tile_data *data;
+ data = evas_object_smart_data_get(tile);
+ if(data->osm.x == x && data->osm.y == y && data->osm.z == z)
+ return NULL;
+
+ return &(data->osm);
+}
+
+#define E_LOAD_TRY_AGAIN -1
+#define E_LOAD_ERR -2
+
+int load_subtile(struct smart_tile_data *data, const char *path, int x, int y, int z)
+{
+ char key[512];
+ int err, _x = x, _y = y;
+ int level;
+
+ for(level = --z; level > 1; level--)
+ {
+ int __x, __y;
+
+ data->offset_x += 256 * (_x % 2);
+ data->offset_y += 256 * (_y % 2);
+
+ __x = _x / 2;
+ __y = _y / 2;
+ data->scale = 2;
+
+ snprintf(key, 512, "%i/%i/%i", level, __x, __y);
+ evas_object_image_file_set(data->img, path, key);
+ err = evas_object_image_load_error_get(data->img);
+ if (err == EVAS_LOAD_ERROR_NONE)
+ {
+ // printf("fallback image %i,%i,%i of %i,%i\n\n", level, __x, __y, data->offset_x, data->offset_y);
+ return level;
+ }
+ // printf("loading %s failed\n", key);
+ _x = __x;
+ _y = __y;
+ }
+ return -1;
+}
+
+struct osm_data* e_smart_tile_load(Evas_Object *tile, const char *path, int z, int x, int y)
+{
+ char key[512];
+ struct smart_tile_data *data;
+ int err;
+
+ data = evas_object_smart_data_get(tile);
+ if(data->osm.x == x && data->osm.y == y && data->osm.z == z)
+ return &(data->osm);
+ evas_object_hide(data->bg);
+ evas_object_hide(data->img);//XXX
+
+ data->osm.x = x;
+ data->osm.y = y;
+ data->osm.z = z;
+ data->offset_x = 0;
+ data->offset_y = 0;
+ data->scale = 1;
+ data->x = 0;
+ data->y = 0;
+
+ snprintf(key, 512, "%i/%i/%i", z, x, y);
+ evas_object_image_file_set(data->img, path, key);
+ err = evas_object_image_load_error_get(data->img);
+ if (err != EVAS_LOAD_ERROR_NONE)
+ {
+ // printf("loading %s failed\n", key);
+ if(load_subtile(data, path, x, y, z) < 0)
+ {
+ // evas_object_show(data->bg);
+ printf("loading %s failed\n", key);
+ return NULL;
+ }
+ }
+ evas_object_image_fill_set(data->img, -data->offset_x, -data->offset_y,
+ 256 * data->scale, 256 * data->scale);
+ evas_object_show(data->img);
+ return &(data->osm);
+}
+
+static void _tile_object_add(Evas_Object *o)
+{
+ struct smart_tile_data *smart;
+
+ smart = calloc(1, sizeof(struct smart_tile_data));
+ if (smart == NULL)
+ return;
+
+ smart->obj = o;
+ smart->x = 0;
+ smart->y = 0;
+ smart->w = 0;
+ smart->h = 0;
+ smart->osm.x = -1;
+ smart->osm.y = -1;
+ smart->osm.z = -1;
+ smart->scale = 1;
+ smart->offset_x = 0;
+ smart->offset_y = 0;
+
+ smart->clip = evas_object_rectangle_add(evas_object_evas_get(o));
+ evas_object_smart_member_add(smart->clip, o);
+ evas_object_color_set(smart->clip, 255, 255, 255, 255);
+ evas_object_move(smart->clip, smart->x, smart->y);
+ evas_object_resize(smart->clip, smart->w, smart->h);
+
+ smart->bg = evas_object_rectangle_add(evas_object_evas_get(o));
+ evas_object_smart_member_add(smart->bg, o);
+ evas_object_color_set(smart->bg, 255, 255, 255, 255);
+ evas_object_move(smart->bg, smart->x, smart->y);
+ evas_object_resize(smart->bg, smart->w, smart->h);
+ evas_object_clip_set(smart->bg, smart->clip);
+
+ smart->img = evas_object_image_add(evas_object_evas_get(o));
+ evas_object_image_smooth_scale_set(smart->img, 0);
+ evas_object_smart_member_add(smart->img, o);
+ evas_object_clip_set(smart->img, smart->clip);
+ evas_object_move(smart->img, smart->x, smart->y);
+ evas_object_resize(smart->img, smart->w, smart->h);
+ evas_object_image_smooth_scale_set(smart->img, 1);
+ evas_object_show(smart->img);
+
+ evas_object_smart_data_set(o, smart);
+}
+
+static void _tile_object_del(Evas_Object *o)
+{
+ struct smart_tile_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ if (smart->img)
+ evas_object_del(smart->img);
+
+ evas_object_del(smart->clip);
+ evas_object_del(smart->bg);
+ free(smart);
+}
+
+static void _tile_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y)
+{
+ struct smart_tile_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ smart->x = x;
+ smart->y = y;
+
+ evas_object_move(smart->clip, smart->x, smart->y);
+ evas_object_move(smart->img, smart->x, smart->y);
+// evas_object_move(smart->bg, smart->x, smart->y);
+}
+
+static void _tile_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h)
+{
+ struct smart_tile_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ w *= smart->scale;
+ h *= smart->scale;
+ smart->w = w;
+ smart->h = h;
+ evas_object_resize(smart->clip, smart->w, smart->h);
+ evas_object_resize(smart->img, smart->w, smart->h);
+ evas_object_resize(smart->bg, smart->w, smart->h);
+ evas_object_image_fill_set(smart->img, -smart->offset_x, -smart->offset_y, w, h);
+}
+
+static void _tile_object_show(Evas_Object *o)
+{
+ struct smart_tile_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_show(smart->clip);
+}
+
+static void _tile_object_hide(Evas_Object *o)
+{
+ struct smart_tile_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_hide(smart->clip);
+}
+
+static void _tile_object_color_set(Evas_Object *o, int r, int g, int b, int a)
+{
+ struct smart_tile_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_color_set(smart->clip, r, g, b, a);
+}
+
+static void _tile_object_clip_set(Evas_Object *o, Evas_Object *clip)
+{
+ struct smart_tile_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_clip_set(smart->clip, clip);
+}
+
+static void _tile_object_clip_unset(Evas_Object *o)
+{
+ struct smart_tile_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_clip_unset(smart->clip);
+}
+
+static Evas_Smart *get_smart()
+{
+ static Evas_Smart *e_smart_tile = NULL;
+
+ if(e_smart_tile != NULL)
+ return e_smart_tile;
+
+ e_smart_tile = evas_smart_new(SMART_TILE_NAME,
+ _tile_object_add,
+ _tile_object_del,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ _tile_object_move,
+ _tile_object_resize,
+ _tile_object_show,
+ _tile_object_hide,
+ _tile_object_color_set,
+ _tile_object_clip_set,
+ _tile_object_clip_unset,
+ NULL);
+ return e_smart_tile;
+}
+
diff --git a/friendfinder/e_smart_tile.h b/friendfinder/e_smart_tile.h
new file mode 100644
index 0000000..1a35df3
--- /dev/null
+++ b/friendfinder/e_smart_tile.h
@@ -0,0 +1,31 @@
+#ifndef _E_SMART_TILE
+#define _E_SMART_TILE
+
+
+struct tile_array
+{
+ Evas_Object **tiles;
+ int tw, th;
+ int ox, oy;
+ int mode;
+ double lat, lon;
+ int w, h;
+};
+
+struct osm_data
+{
+ int x, y, z;
+};
+
+static inline char *osm_string(struct osm_data *osm)
+{
+ static char buf[64];
+ snprintf(buf, 64, "%i/%i/%i", osm->z, osm->x, osm->y);
+ return buf;
+}
+
+Evas_Object *e_smart_tile_add(Evas *e);
+struct osm_data *e_smart_tile_load(Evas_Object *tile, const char *path, int z, int x, int y);
+struct osm_data *e_smart_tile_unload(Evas_Object *tile);
+struct osm_data *e_smart_tile_needs_update(Evas_Object *tile, int z, int x, int y);
+#endif
diff --git a/friendfinder/gui.c b/friendfinder/gui.c
new file mode 100644
index 0000000..868b4c1
--- /dev/null
+++ b/friendfinder/gui.c
@@ -0,0 +1,474 @@
+#include <stdlib.h>
+#include <time.h>
+
+#include "Evas.h"
+#include "Ecore.h"
+#include "Ecore_Evas.h"
+#include "Elementary.h"
+
+#include "msg_sender.h"
+#include "gui.h"
+#include "handler.h"
+#include "receiver.h"
+#include "sender.h"
+
+int h = 600;
+int w = 450;
+
+int first = 0;
+int bubble_pos = 100;
+time_t now;
+const char* msg_text;
+char *from, *to, *current_msg, *last_msg;
+
+static Evas_Object *win, *bbx;
+
+
+
+
+static void on_cancel(void *data, Evas_Object *obj, void *event_info)
+{
+ /* cleanly exit */
+ elm_exit();
+}
+
+static void on_chat(void *data, Evas_Object *obj, void *event_info)
+{
+
+ init_window_parts();
+ init_buttons(obj);
+ init_toolbar(obj);
+
+}
+
+static void on_map(void *data, Evas_Object *obj, void *event_info)
+{
+
+ init_map();
+
+}
+
+static void on_options(void *data, Evas_Object *obj, void *event_info)
+{
+
+ init_options();
+
+}
+
+static void on_message(void *data, Evas_Object *obj, void *event_info)
+{
+
+ msg_text = elm_entry_entry_get(obj);
+ elm_entry_context_menu_clear(obj);
+
+}
+
+static void on_send_message(void *data, Evas_Object *bx3, void *event_info)
+{
+
+ printf("on_send_message: %s\n", msg_text);
+ set_txt_msg(msg_text);
+ Evas_Object *bb1, *bb2, *bb3;
+
+ if (msg_text != NULL)
+ {
+
+ if (first == 0)
+ {
+ bb1 = elm_bubble_add(bx3);
+ evas_object_resize(bb1, w, h/7);
+ evas_object_move(bb1, 0, 0);
+ evas_object_show(bb1);
+ set_bubble_text(bb1, from, msg_text);
+
+ first = 1;
+ bubble_pos = bubble_pos + h/6;
+
+ return;
+ }
+ if (first == 1)
+ {
+ bb2 = elm_bubble_add(bx3);
+ evas_object_resize(bb2, w, h/6);
+ evas_object_move(bb2, 0, bubble_pos);
+ evas_object_show(bb2);
+ set_bubble_text(bb2, from, msg_text);
+
+ first = 2;
+ bubble_pos = bubble_pos + h/6;
+
+ return;
+ }
+ // printf("position: %d\n", bubble_pos);
+
+ if (first == 2)
+ {
+ bb3 = elm_bubble_add(bx3);
+ evas_object_resize(bb3, w, h/6);
+ evas_object_move(bb3, 0, bubble_pos);
+ evas_object_show(bb3);
+ set_bubble_text(bb3, from, msg_text);
+
+ first = 0;
+ bubble_pos = 100;
+
+ return;
+ }
+ }
+}
+
+/* if message has been sent, print it in a bubble */
+void show_message(char *current_msg)
+{
+ Evas_Object *bb1, *bb2, *bb3;
+
+ if (current_msg != NULL)
+ {
+ if (first == 0)
+ {
+ bb1 = elm_bubble_add(bbx);
+ evas_object_resize(bb1, w, h/7);
+ evas_object_move(bb1, 0, 0);
+ evas_object_show(bb1);
+ set_bubble_text(bb1, to, current_msg);
+
+ first = 1;
+ bubble_pos = bubble_pos + h/6;
+ }
+ if (first == 1);
+ {
+ bb2 = elm_bubble_add(bbx);
+ evas_object_resize(bb2, w, h/6);
+ evas_object_move(bb2, 0, bubble_pos);
+ evas_object_show(bb2);
+ set_bubble_text(bb2, to, current_msg);
+
+ first = 2;
+ bubble_pos = bubble_pos + h/6;
+ }
+ if (first == 2)
+ {
+ bb3 = elm_bubble_add(bbx);
+ evas_object_resize(bb3, w, h/6);
+ evas_object_move(bb3, 0, bubble_pos);
+ evas_object_show(bb3);
+ set_bubble_text(bb3, to, current_msg);
+
+ first = 0;
+ bubble_pos = bubble_pos + h/6;
+ }
+ }
+}
+
+/* returns the current system time */
+char* get_current_time()
+{
+
+ time_t now;
+ time(&now);
+ char *text = ctime(&now);
+ return text;
+
+}
+
+
+/* sets the username, time-text and the text in the bubble */
+void set_bubble_text(Evas_Object *bb, char *username, char *text)
+{
+
+ Evas_Object *cn;
+
+ /* sets the username */
+ elm_entry_entry_set(bb, username);
+
+ /* get time string and set it */
+ elm_bubble_info_set(bb, get_current_time());
+
+ /* create entry */
+ cn = elm_entry_add(bb);
+ elm_entry_entry_set(cn, text);
+ elm_entry_line_wrap_set(cn, 0);
+ evas_object_size_hint_weight_set(cn, 1.0, 1.0);
+
+ /* create overlay bubble with message string */
+ Evas_Object *inner_bb;
+ inner_bb = elm_bubble_add(bb);
+ elm_bubble_info_set(inner_bb, text);
+ evas_object_resize(bb, w, h/6);
+ evas_object_move(bb, 0, bubble_pos);
+ elm_bubble_content_set(bb, cn);
+ evas_object_show(bb);
+
+}
+
+void init_window_parts()
+{
+
+ Evas_Object *bg, *bx, *bx2, *bx3, *sc, *en;
+
+ /* add a standard bg */
+ bg = elm_bg_add(win);
+ /* not not allow bg to expand. let's limit dialog size to contents */
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ /* add a box object - default is vertical. a box holds children in a row,
+ * either horizontally or vertically. nothing more. */
+ bx = elm_box_add(win);
+ evas_object_resize(bx, w, h*0.85);
+ evas_object_show(bx);
+
+ /* add horizontal box for buttons */
+ bx2 = elm_box_add(win);
+ elm_box_horizontal_set(bx2, 1);
+ elm_box_homogenous_set(bx2, 1);
+ elm_frame_content_set(bx, bx2);
+ evas_object_move(bx2, 0, h*0.93);
+ evas_object_resize(bx2, w, h*0.05);
+ //elm_box_pack_end(bx, bx2);
+ evas_object_show(bx2);
+
+ /* add box for incoming messages */
+ bx3 = elm_box_add(win);
+ evas_object_resize(bx3, w, h*0.15);
+ evas_object_move(bx3, 0, h*0.78);
+ evas_object_show(bx3);
+
+
+ sc = elm_scroller_add(win);
+ evas_object_size_hint_weight_set(sc, 1.0, 1.0);
+ evas_object_size_hint_align_set(sc, -1.0, -1.0);
+ elm_box_pack_end(bx3, sc);
+
+ en = elm_entry_add(win);
+ //if (text) elm_entry_entry_set(en, text);
+ //else elm_entry_entry_set(en, "");
+ evas_object_size_hint_weight_set(en, 1.0, 1.0);
+ evas_object_size_hint_align_set(en, 0.0, 0.0);
+ elm_scroller_content_set(sc, en);
+ evas_object_smart_callback_add(en, "changed", on_message, NULL);
+ evas_object_show(en);
+
+ evas_object_show(sc);
+
+ /* init buttons */
+ bbx = bx2;
+ init_buttons(bx2);
+
+ /* init toolbar */
+ init_toolbar(win);
+}
+
+void init_toolbar()
+{
+
+ Evas_Object *tb, *ic, *bx;
+
+ /* add box for toolbar */
+ bx = elm_box_add(win);
+ evas_object_resize(bx, w, h*0.15);
+ evas_object_move(bx, 0, 0);
+ evas_object_show(bx);
+
+ tb = elm_toolbar_add(win);
+ evas_object_size_hint_weight_set(tb, 1.0, 0.0);
+ evas_object_size_hint_align_set(tb, -1.0, -1.0);
+
+ ic = elm_icon_add(win);
+ elm_icon_standard_set(ic, "chat");
+ elm_toolbar_item_add(tb, ic, "Chat", on_chat, NULL);
+ evas_object_show(ic);
+
+ ic = elm_icon_add(win);
+ elm_icon_standard_set(ic, "edit");
+ elm_toolbar_item_add(tb, ic, "Options", on_options, NULL);
+ evas_object_show(ic);
+
+ ic = elm_icon_add(win);
+ elm_icon_standard_set(ic, "clock");
+ elm_toolbar_item_add(tb, ic, "Map", on_map, NULL);
+ evas_object_show(ic);
+
+// evas_object_show(ic);
+
+ elm_box_pack_end(bx, tb);
+ evas_object_show(tb);
+}
+
+void init_options()
+{
+
+ Evas_Object *bg, *bx, *bx2, *bt;
+
+ /* add a standard bg */
+ bg = elm_bg_add(win);
+ /* not not allow bg to expand. let's limit dialog size to contents */
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ /* set toolbar again */
+ init_toolbar(bg);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, 1.0, 1.0);
+ evas_object_size_hint_align_set(bx, -1.0, -1.0);
+ evas_object_resize(bx, w, h);
+ evas_object_show(bx);
+
+ bx2 = elm_box_add(win);
+ elm_box_horizontal_set(bx2, 1);
+ evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
+ evas_object_size_hint_align_set(bx2, -1.0, -1.0);
+ elm_box_pack_end(bx, bx2);
+ evas_object_show(bx2);
+
+ bt = elm_button_add(win);
+ elm_button_label_set(bt, "Stell mich ein");
+ evas_object_size_hint_weight_set(bt, 1.0, 0.0);
+ evas_object_size_hint_align_set(bt, -1.0, -1.0);
+ elm_box_pack_end(bx2, bt);
+ evas_object_smart_callback_add(bt, "clicked", NULL, NULL);
+ evas_object_show(bt);
+}
+
+void init_map()
+{
+
+ Evas_Object *bg, *bx, *bx2, *bx3, *map, *bt1, *bt2;
+
+ /* add a standard bg */
+ bg = elm_bg_add(win);
+ /* not not allow bg to expand. let's limit dialog size to contents */
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ /* set toolbar again */
+ init_toolbar(bg);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, 1.0, 1.0);
+ evas_object_size_hint_align_set(bx, -1.0, -1.0);
+ evas_object_resize(bx, w, h);
+ evas_object_show(bx);
+
+ bx2 = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
+ evas_object_size_hint_align_set(bx2, -1.0, -1.0);
+ evas_object_resize(bx2, w*1.3, h*0.7);
+ elm_box_pack_end(bx, bx2);
+ evas_object_show(bx2);
+
+ bx3 = elm_box_add(win);
+ elm_box_horizontal_set(bx2, 1);
+ evas_object_size_hint_weight_set(bx3, 1.0, 0.0);
+ evas_object_size_hint_align_set(bx3, -1.0, 0.0);
+ evas_object_resize(bx3, w*0.9, h*0.2);
+ elm_box_pack_end(bx, bx3);
+ evas_object_show(bx3);
+
+ map = e_smart_map_add(win, "data/maps/fr_map.eet");
+ e_smart_map_set_pos(map, 47.996578,7.840171);
+ evas_object_size_hint_min_set(map, w-2*8, h-10*8-40);
+ evas_object_size_hint_max_set(map, w-2*8, h-10*8-40);
+ //evas_object_resize(map, w*0.92, h*0.7);
+ elm_box_pack_end(bx2, map);
+ evas_object_show(map);
+
+ bt1 = elm_button_add(win);
+ elm_button_label_set(bt1, "Show friends");
+ evas_object_size_hint_weight_set(bt1, 1.0, 1.0);
+ evas_object_size_hint_align_set(bt1, -1.0, -1.0);
+ elm_box_pack_end(bx3, bt1);
+ evas_object_smart_callback_add(bt1, "clicked", NULL, NULL);
+ evas_object_show(bt1);
+
+ bt2 = elm_button_add(win);
+ elm_button_label_set(bt2, "Hide friends");
+ evas_object_size_hint_weight_set(bt2, 1.0, 1.0);
+ evas_object_size_hint_align_set(bt2, -1.0, -1.0);
+ elm_box_pack_end(bx3, bt2);
+ evas_object_smart_callback_add(bt2, "clicked", NULL, NULL);
+ evas_object_show(bt2);
+
+}
+
+void init_buttons(Evas_Object *box)
+{
+
+ Evas_Object *bt;
+
+ /* add ok button to box - fill and expand */
+ bt = elm_button_add(win);
+ elm_button_label_set(bt, "Send Message");
+ evas_object_size_hint_weight_set(bt, 1.0, 1.0);
+ evas_object_size_hint_align_set(bt, -1.0, -1.0);
+ //elm_box_pack_end(box, bt);
+ evas_object_show(bt);
+
+ /* and when clicked - run "on_ok" */
+ bbx = box;
+ evas_object_smart_callback_add(bt, "clicked", on_send_message, NULL);
+
+
+ /* add cancel button to box - fill and expand */
+ bt = elm_button_add(win);
+ elm_button_label_set(bt, "Cancel");
+ evas_object_size_hint_weight_set(bt, 1.0, 1.0);
+ evas_object_size_hint_align_set(bt, -1.0, -1.0);
+ elm_box_pack_end(box, bt);
+ evas_object_show(bt);
+
+ /* and when clicked - run "on_cancel" */
+ evas_object_smart_callback_add(bt, "clicked", on_cancel, NULL);
+
+}
+
+void elm_main ()
+{
+
+ /* new window - do the usual and give it a name, title and delete handler */
+ win = elm_win_add(NULL, "Main", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Main");
+ evas_object_smart_callback_add(win, "delete,request", on_cancel, NULL);
+
+ /* resize window */
+ evas_object_resize(win, w, h);
+
+ /* init window parts */
+ init_window_parts();
+
+ /* show the window */
+ evas_object_show(win);
+
+ init_ecore_handler(from, to);
+ /* get going and draw/respond to the user */
+ // elm_run();
+
+ /* standard shutdown */
+ elm_exit();
+
+}
+
+int main (int argc, char **argv)
+{
+ if (argv[1] == NULL && argv[2] == NULL)
+ {
+ printf("no nick and no receiver set");
+ from == NULL;
+ to == NULL;
+ }
+ else
+ {
+ from = argv[1];
+ to = argv[2];
+ }
+
+ elm_init(argc, argv);
+
+ elm_main();
+
+ elm_shutdown();
+
+ return 0;
+
+}
diff --git a/friendfinder/gui.h b/friendfinder/gui.h
new file mode 100644
index 0000000..6c6013f
--- /dev/null
+++ b/friendfinder/gui.h
@@ -0,0 +1,28 @@
+#ifndef __GUI_H_
+#define __GUI_H_
+
+//structs
+//typedef struct _ginfo ginfo;
+#include "Evas.h"
+
+//callback functions
+static void on_cancel(void *data, Evas_Object *obj, void *event_info);
+static void on_send_message(void *data, Evas_Object *obj, void *event_info);
+static void on_message(void *data, Evas_Object *obj, void *event_info);
+static void on_options(void *data, Evas_Object *obj, void *event_info);
+static void on_chat(void *data, Evas_Object *obj, void *event_info);
+static void on_map(void *data, Evas_Object *obj, void *event_info);
+
+
+//other functions
+void set_bubble_text(Evas_Object *bb, char *username, char *text);
+void show_message(current_msg);
+char* get_current_time();
+//init functions
+void init_options();
+void init_window_parts();
+void init_toolbar();
+void init_map();
+void init_buttons(Evas_Object *box);
+void elm_main();
+#endif
diff --git a/friendfinder/handler.c b/friendfinder/handler.c
new file mode 100644
index 0000000..9b74339
--- /dev/null
+++ b/friendfinder/handler.c
@@ -0,0 +1,91 @@
+#include "Ecore.h"
+#include "/usr/local/include/Evas.h"
+#include "/usr/local/include/Ecore_Evas.h"
+#include "/usr/local/include/Elementary.h"
+#include "receiver.h"
+#include "sender.h"
+#include "msg_sender.h"
+
+int is_init = 0;
+double interval = 0.1;
+double current_time, last_call;
+
+
+
+void pause_msg_sender()
+{
+ msg_stop_irc();
+}
+
+void continue_msg_sender()
+{
+ msg_run_irc();
+}
+
+void pause_receiver()
+{
+ receiver_stop_irc();
+}
+
+void continue_receiver()
+{
+ receiver_run_irc();
+}
+
+void pause_sender()
+{
+ sender_stop_irc();
+}
+
+void continue_sender()
+{
+ sender_run_irc();
+}
+
+void exit_all()
+{
+ elm_exit();
+ ecore_shutdown();
+ elm_shutdown();
+}
+
+void continue_gui(void *data)
+{
+ elm_run();
+}
+
+void init_ecore_handler(char *from, char *to)
+{
+ ecore_init();
+
+ if (is_init == 0)
+ {
+ is_init = 1;
+ msg_main_loop(from, to);
+ sender_main(from);
+ receiver_main(from);
+ }
+
+ ecore_idle_exiter_add(continue_msg_sender, NULL);
+
+ ecore_idle_exiter_add(pause_msg_sender, NULL);
+
+ ecore_idle_exiter_add(continue_sender, NULL);
+
+ ecore_idle_exiter_add(pause_sender, NULL);
+
+ ecore_idle_exiter_add(continue_receiver, NULL);
+
+ ecore_idle_exiter_add(pause_receiver, NULL);
+
+ ecore_idle_exiter_add(continue_gui, NULL);
+
+ //ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_all, NULL);
+
+ ecore_main_loop_begin();
+}
+
+void shutdown_ecore_handler()
+{
+ ecore_shutdown();
+}
diff --git a/friendfinder/handler.h b/friendfinder/handler.h
new file mode 100644
index 0000000..583fd14
--- /dev/null
+++ b/friendfinder/handler.h
@@ -0,0 +1,10 @@
+#ifndef __HANDLER_H_
+#define __HANDLER_H_
+
+/* inits all needed parts of ecore for the handlers */
+void init_ecore_handler(char *from, char *to);
+
+/* shutdown all ecore handler parts */
+void shutdown_ecore_handler();
+
+#endif
diff --git a/friendfinder/map/.map_reader.c.swp b/friendfinder/map/.map_reader.c.swp
new file mode 100644
index 0000000..ae96628
--- /dev/null
+++ b/friendfinder/map/.map_reader.c.swp
Binary files differ
diff --git a/friendfinder/map/controls.c b/friendfinder/map/controls.c
new file mode 100644
index 0000000..89eee55
--- /dev/null
+++ b/friendfinder/map/controls.c
@@ -0,0 +1,146 @@
+#include <Elementary.h>
+#include "../vkbd/vkbd.h"
+
+#include "../map/smart_map_priv.h"
+
+static void
+cb_exit(void *data, Evas_Object *obj, void *event_info)
+{
+ elm_exit();
+}
+
+
+static void
+_cb_hide(void *data, Evas_Object *obj, void *event_info)
+{
+ struct smart_map *smart = (struct smart_map *)data;
+
+ overlay_hide(smart, "xxx");
+}
+
+
+static void
+_kbd_show(void *data, Evas_Object *o, void *event_info)
+{
+ struct controls *ctrl = data;
+ vkbd_show(ctrl->vkbd, 240, 320, NULL);
+}
+
+
+
+static void _cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
+{
+ struct smart_map *smart = (struct smart_map *)data;
+ smart->moved = 0;
+ smart->drag = 1;
+}
+
+static void _cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event)
+{
+ struct smart_map *smart = (struct smart_map *)data;
+ Evas_Event_Mouse_Up *ev = event;
+ double lat = 0, lon = 0;
+ int ox, oy;
+
+ smart->drag = 0;
+ if(smart->moved)
+ {
+ smart->moved = 0;
+ return;
+ }
+
+ ox = smart->ta.ox + ev->output.x;
+ oy = smart->ta.oy + ev->output.y;
+ map_to_latlon(smart->li, ox, oy, &lat, &lon);
+
+ char buffer[512];
+ snprintf(buffer, 512, "point: %lf * %lf", lat, lon);
+ edje_object_part_text_set(smart->theme, "position", buffer);
+
+}
+
+static void _cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event)
+{
+ Evas_Event_Mouse_Move *ev = event;
+
+ struct smart_map *smart = (struct smart_map *)data;
+ Evas_Coord dx, dy;
+
+ if(!smart->drag)
+ return;
+
+ smart->moved = 1;
+ dx = ev->cur.canvas.x - ev->prev.canvas.x;
+ dy = ev->cur.canvas.y - ev->prev.canvas.y;
+
+ e_smart_map_move(smart->obj, -dx, -dy);
+}
+
+void init_clickarea(struct smart_map *smart)
+{
+ struct controls *ctrl = &smart->c;
+
+ ctrl->ctrl = evas_object_rectangle_add(smart->evas);
+ evas_object_smart_member_add(ctrl->ctrl, smart->obj);
+ evas_object_color_set(ctrl->ctrl, 0, 0, 0, 0);
+ evas_object_clip_set(ctrl->ctrl, smart->clip);
+ evas_object_repeat_events_set(ctrl->ctrl, 1);
+ evas_object_show(ctrl->ctrl);
+
+ evas_object_event_callback_add(ctrl->ctrl, EVAS_CALLBACK_MOUSE_DOWN,
+ _cb_mouse_down, smart);
+ evas_object_event_callback_add(ctrl->ctrl, EVAS_CALLBACK_MOUSE_UP,
+ _cb_mouse_up, smart);
+ evas_object_event_callback_add(ctrl->ctrl, EVAS_CALLBACK_MOUSE_MOVE,
+ _cb_mouse_move, smart);
+}
+
+int controls_init(struct smart_map *smart)
+{
+ struct controls *ctrl;
+
+ if(!smart || !smart->win)
+ return -1;
+
+ init_clickarea(smart);
+ ctrl = &smart->c;
+ /*
+ ctrl->bx = elm_box_add(smart->win);
+ evas_object_size_hint_weight_set(ctrl->bx, 1.0, 1.0);
+ elm_win_resize_object_add(smart->win, ctrl->bx);
+ evas_object_show(ctrl->bx);
+
+ ctrl->bt = elm_hoversel_add(smart->win);
+ elm_hoversel_hover_parent_set(ctrl->bt, smart->obj);
+ elm_hoversel_label_set(ctrl->bt, "Menu");
+ elm_hoversel_item_add(ctrl->bt, "Item 1", "apps",
+ ELM_ICON_STANDARD, NULL, NULL);
+ elm_hoversel_item_add(ctrl->bt, "Item 2", "arrow_down",
+ ELM_ICON_STANDARD, _cb_hide, smart);
+ elm_hoversel_item_add(ctrl->bt, "Item 3", "home",
+ ELM_ICON_STANDARD, _kbd_show, ctrl);
+ elm_hoversel_item_add(ctrl->bt, "Item 4", "close",
+ ELM_ICON_STANDARD, cb_exit, NULL);
+ evas_object_size_hint_weight_set(ctrl->bt, 1.0, 1.0);
+ evas_object_size_hint_align_set(ctrl->bt, 1.0, 1.0);
+ elm_box_pack_end(ctrl->bx, ctrl->bt);
+ evas_object_show(ctrl->bt);
+ */
+#if 0
+ Evas_Object *bt = elm_button_add(win);
+ elm_button_label_set(bt, "Button");
+ Evas_Object *bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, 1.0, 1.0);
+ elm_win_resize_object_add(win, bx);
+ elm_box_pack_end(bx, bt);
+
+ evas_object_show(bx);
+
+ evas_object_size_hint_align_set(bt, 1.0, -1.0);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+#endif
+ ctrl->vkbd = vkbd_add(smart->evas);
+ return 0;
+}
diff --git a/friendfinder/map/e_smart_tile.h b/friendfinder/map/e_smart_tile.h
new file mode 100644
index 0000000..1a35df3
--- /dev/null
+++ b/friendfinder/map/e_smart_tile.h
@@ -0,0 +1,31 @@
+#ifndef _E_SMART_TILE
+#define _E_SMART_TILE
+
+
+struct tile_array
+{
+ Evas_Object **tiles;
+ int tw, th;
+ int ox, oy;
+ int mode;
+ double lat, lon;
+ int w, h;
+};
+
+struct osm_data
+{
+ int x, y, z;
+};
+
+static inline char *osm_string(struct osm_data *osm)
+{
+ static char buf[64];
+ snprintf(buf, 64, "%i/%i/%i", osm->z, osm->x, osm->y);
+ return buf;
+}
+
+Evas_Object *e_smart_tile_add(Evas *e);
+struct osm_data *e_smart_tile_load(Evas_Object *tile, const char *path, int z, int x, int y);
+struct osm_data *e_smart_tile_unload(Evas_Object *tile);
+struct osm_data *e_smart_tile_needs_update(Evas_Object *tile, int z, int x, int y);
+#endif
diff --git a/friendfinder/map/map_reader.c b/friendfinder/map/map_reader.c
new file mode 100644
index 0000000..fb475fc
--- /dev/null
+++ b/friendfinder/map/map_reader.c
@@ -0,0 +1,141 @@
+#include <string.h>
+#include <Eet.h>
+
+#include "smart_map_priv.h"
+
+#define READ_KEY_INIT char key[512]
+#define LKEY(_le, _mk) snprintf(key, 512, "%i/%s", _le, _mk);
+
+static inline int _read_int_val(Eet_File *eet, char *key, int *intval)
+{
+ int size;
+ char *val;
+ val = eet_read(eet, key, &size);
+ if(val == NULL)
+ {
+ // _warn("reading %s failed\n", key);
+ return -1;
+ }
+ *intval = atoi(val);
+ free(val);
+ return 0;
+}
+
+static inline int _read_double_val(Eet_File *eet, char *key, double *dval)
+{
+ int size;
+ char *val;
+ val = eet_read(eet, key, &size);
+ if(val == NULL)
+ {
+ // _warn("reading %s failed\n", key);
+ return -1;
+ }
+
+ *dval = atof(val);
+ free(val);
+ return 0;
+}
+
+
+struct map_info *map_info_read(const char *path)
+{
+ Eet_File *eet;
+ int size, i;
+ char *val;
+ struct map_info *mi;
+
+ mi = (struct map_info *)calloc(1, sizeof(struct map_info));
+ if(mi == NULL)
+ return NULL;
+
+ eet = eet_open(path, EET_FILE_MODE_READ);
+ if(eet == NULL)
+ return NULL;
+
+ val = eet_read(eet, "min_level", &size);
+ if(val == NULL)
+ return NULL;
+ mi->min_level = atoi(val);
+ free(val);
+
+ val = eet_read(eet, "max_level", &size);
+ if(val == NULL)
+ return NULL;
+ mi->max_level = atoi(val);
+ free(val);
+ mi->level = (struct map_level_info *)
+ calloc(mi->max_level - mi->min_level + 1,
+ sizeof(struct map_level_info));
+ if(mi->level == NULL)
+ {
+ free(mi);
+ return NULL;
+ }
+ mi->tile_size = 256;
+ for(i = mi->min_level; i < mi->max_level + 1; i++)
+ {
+ READ_KEY_INIT;
+ struct map_level_info *li;
+
+ li = &mi->level[i - mi->min_level];
+
+ LKEY(i, "min_x");
+ if(_read_int_val(eet, key, &(li->min_x)))
+ goto failure;
+
+ LKEY(i, "max_x");
+ if(_read_int_val(eet, key, &(li->max_x)))
+ goto failure;
+
+ LKEY(i, "min_y");
+ if(_read_int_val(eet, key, &(li->min_y)))
+ goto failure;
+
+ LKEY(i, "max_y");
+ if(_read_int_val(eet, key, &(li->max_y)))
+ goto failure;
+
+ LKEY(i, "north");
+ if(_read_double_val(eet, key, &(li->north)))
+ goto failure;
+
+ LKEY(i, "west");
+ if(_read_double_val(eet, key, &(li->west)))
+ goto failure;
+
+ LKEY(i, "south");
+ if(_read_double_val(eet, key, &(li->south)))
+ goto failure;
+
+ LKEY(i, "east");
+ if(_read_double_val(eet, key, &(li->east)))
+ goto failure;
+
+ LKEY(i, "dx");
+ if(_read_double_val(eet, key, &(li->dx)))
+ goto failure;
+
+ LKEY(i, "dy");
+ if(_read_double_val(eet, key, &(li->dy)))
+ goto failure;
+
+ LKEY(i, "e0");
+ if(_read_double_val(eet, key, &(li->e0)))
+ goto failure;
+
+ LKEY(i, "n0");
+ if(_read_double_val(eet, key, &(li->n0)))
+ goto failure;
+ }
+ mi->path = strdup(path);
+ eet_close(eet);
+ return mi;
+failure:
+ free(mi->level);
+ free(mi);
+ return NULL;
+}
+
+
+
diff --git a/friendfinder/map/object.c b/friendfinder/map/object.c
new file mode 100644
index 0000000..f4f4c0b
--- /dev/null
+++ b/friendfinder/map/object.c
@@ -0,0 +1,176 @@
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Evas.h>
+#include <Edje.h>
+
+#include "e_smart_tile.h"
+
+#include "smart_map_priv.h"
+
+static void tile_array_add(struct smart_map *smart, int index)
+{
+ smart->ta.tiles[index] = e_smart_tile_add(smart->evas);
+ evas_object_smart_member_add(smart->ta.tiles[index], smart->obj);
+ evas_object_clip_set(smart->ta.tiles[index], smart->clip);
+ evas_object_pass_events_set(smart->ta.tiles[index], 1);
+ evas_object_stack_below(smart->ta.tiles[index], smart->clip);
+}
+
+static int tile_array_resize(struct tile_array *ta, struct smart_map *smart, int tw, int th)
+{
+ int i;
+ if(ta->tiles == NULL)
+ {
+ ta->tiles = calloc(1, tw * th * sizeof(Evas_Object *));
+ if(ta->tiles == NULL)
+ return -1;
+ ta->tw = tw;
+ ta->th = th;
+ for(i = 0; i < tw*th; i++)
+ tile_array_add(smart, i);
+ return 0;
+ }
+
+ int oldsize = smart->ta.tw * smart->ta.th;
+ if(oldsize < tw*th)
+ {
+ ta->tiles = realloc(ta->tiles, tw * th * sizeof(Evas_Object *));
+ if(smart->ta.tiles == NULL)
+ return -1;
+
+ for(i = oldsize; i < tw*th; i++)
+ tile_array_add(smart, i);
+ }
+ else
+ {
+ for(i = tw*th; i < oldsize; i++)
+ {
+ evas_object_del(ta->tiles[i]);
+ evas_object_smart_member_del(ta->tiles[i]);
+ }
+
+ ta->tiles = realloc(ta->tiles,
+ tw * th * sizeof(Evas_Object *));
+ if(ta->tiles == NULL)
+ return -1;
+ }
+ ta->tw = tw;
+ ta->th = th;
+ return 0;
+}
+
+static inline int tile_array_update(struct tile_array *ta, struct map_level_info *li)
+{
+ if(ta->mode == POSITION_WORLD)
+ {
+ if(latlon_to_map(li, ta->lat, ta->lon, &ta->ox, &ta->oy) < 0)
+ return -1;
+ ta->ox -= ta->w/2;
+ ta->oy -= ta->h/2;
+ ta->mode = POSITION_PX;
+ }
+ else
+ {
+ if(map_to_latlon(li, ta->ox + ta->w/2, ta->oy + ta->h/2, &ta->lat, &ta->lon) < 0)
+ return -1;
+ }
+ return 0;
+}
+
+static int fill_tiles(struct smart_map *smart)
+{
+ int tx, ty;
+ int xmin, ymin, xoffset, yoffset;
+ int tile_size = smart->mi->tile_size;
+ struct tile_array *ta = &smart->ta;
+ Eina_Array_Iterator iterator;
+ int i;
+ Evas_Object *path;
+
+ if(smart->li == NULL)
+ return -1;
+
+ tile_array_update(ta, smart->li);
+
+ EINA_ARRAY_ITER_NEXT(smart->paths, i, path, iterator)
+ {
+ evas_object_move(path, ta->ox, ta->oy);
+ evas_object_show(path);
+ }
+
+ xmin = ta->ox / tile_size + smart->li->min_x - 1;
+ ymin = ta->oy / tile_size + smart->li->min_y - 1;
+ xoffset = -ta->ox % tile_size;
+ yoffset = -ta->oy % tile_size;
+ for(ty = 0; ty < ta->th; ty++)
+ {
+ Evas_Coord y0;
+ y0 = (ty - 1) * tile_size;
+ for(tx = 0; tx < ta->tw; tx++)
+ {
+ Evas_Coord x0;
+ struct osm_data *osm;
+ Evas_Object *o;
+
+ x0 = (tx - 1) * tile_size;
+ o = ta->tiles[ty * ta->tw + tx];
+ if(o == NULL)
+ return -1;
+
+ if(xmin + tx < smart->li->min_x || xmin + tx > smart->li->max_x ||
+ ymin + ty < smart->li->min_y || ymin + ty > smart->li->max_y)
+ {
+ osm = e_smart_tile_unload(o);
+ overlay_unload(smart, osm);
+ }
+ else
+ {
+ osm = e_smart_tile_needs_update(o,
+ smart->current_level, xmin + tx, ymin + ty);
+ if(osm != NULL)
+ overlay_unload(smart, osm);
+
+ osm = e_smart_tile_load(o, smart->mi->path,
+ smart->current_level, xmin + tx, ymin + ty);
+ if(osm == NULL)
+ continue;
+ }
+ evas_object_move(o, smart->x + xoffset + x0, smart->y + yoffset + y0);
+ evas_object_resize(o, tile_size, tile_size);
+ evas_object_show(o);
+ overlay_update(smart, osm, smart->x + xoffset + x0, smart->y + yoffset + y0);
+ }
+ }
+ return 0;
+}
+
+int map_object_update(struct smart_map *smart)
+{
+ int tw, th;
+ int ret, ts = smart->mi->tile_size;
+ char buffer[512];
+
+ tw = 2 + (((double)smart->w + ts) / ts);
+ th = 2 + (((double)smart->h + ts) / ts);
+ if(tw != smart->ta.tw || th != smart->ta.th)
+ {
+ if(tile_array_resize(&smart->ta, smart, tw, th) < 0)
+ return -1;
+ }
+ ret = fill_tiles(smart);
+ if(ret < 0)
+ return -1;
+
+ if(smart->theme == NULL)
+ return 0;
+
+ snprintf(buffer, 512, "%lf * %lf", smart->ta.lat, smart->ta.lon);
+ smart->lat = smart->ta.lat;
+ smart->lon = smart->ta.lon;
+ edje_object_part_text_set(smart->theme, "position", buffer);
+ return 0;
+}
diff --git a/friendfinder/map/overlay.c b/friendfinder/map/overlay.c
new file mode 100644
index 0000000..1566040
--- /dev/null
+++ b/friendfinder/map/overlay.c
@@ -0,0 +1,257 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+#include <Elementary.h>
+#include <Eina.h>
+
+#include "e_smart_tile.h"
+
+#include "smart_map_priv.h"
+
+struct map_overlay *overlay_find_by_name(struct smart_map *smart, char *name)
+{
+ int i;
+ struct map_overlay *ov = NULL;
+ Eina_Array_Iterator iterator;
+
+ EINA_ARRAY_ITER_NEXT(smart->overlays, i, ov, iterator)
+ {
+ if(strcmp(ov->name, name) == 0)
+ return ov;
+ }
+ return NULL;
+}
+
+struct map_overlay *overlay_create(struct smart_map *smart, char *name)
+{
+ int i;
+ struct map_overlay *ov = malloc(sizeof(struct map_overlay));
+ if(ov == NULL)
+ return NULL;
+
+ eina_array_init();
+ ov->name = strdup(name);
+ ov->parent = smart;
+ ov->state = OVERLAY_VISIBLE;
+
+ ov->hash = eina_hash_string_superfast_new(NULL);
+ for(i = 0; i < OSM_LEVEL_COUNT; i++)
+ ov->pois[i] = NULL;
+
+ ov->current_level = -1;
+ return ov;
+}
+
+void overlay_add(struct smart_map *smart, struct map_overlay *ov, struct overlay_item *poi)
+{
+ int i;
+ if(ov == NULL)
+ return;
+
+ for(i = 1; i < OSM_LEVEL_COUNT; i++)
+ {
+ unsigned int mask = 1<<i;
+ if(!(poi->level_mask & mask))
+ continue;
+
+ if(ov->pois[i] == NULL)
+ ov->pois[i] = eina_array_new(4);
+
+ eina_array_push(ov->pois[i], poi);
+ }
+}
+
+static void _hash_item(struct smart_map *smart, struct map_overlay *ov, struct overlay_item *poi, int level)
+{
+ int x, y, tx, ty;
+ char buf[64];
+ Eina_Array *items;
+ struct map_level_info *li;
+ li = map_info_get_level(smart->mi, &level);
+
+ if(latlon_to_map(li, poi->lat, poi->lon, &x, &y) < 0)
+ return;
+
+ tx = x / smart->mi->tile_size + li->min_x;
+ ty = y / smart->mi->tile_size + li->min_y;
+ poi->level_data.ox = x % smart->mi->tile_size;
+ poi->level_data.oy = y % smart->mi->tile_size;
+ poi->level_data.visible = 1;
+
+ snprintf(buf, 64, "%i/%i/%i", level, tx, ty);
+ items = eina_hash_find(ov->hash, (const void *)buf);
+ if(items == NULL)
+ {
+ items = eina_array_new(4);
+ eina_array_push(items, poi);
+ eina_hash_add(ov->hash, buf, items);
+ }
+ else
+ {
+ eina_array_push(items, poi);
+ }
+}
+
+static void _overlay_hide(struct smart_map *smart, struct map_overlay *ov, int newstate)
+{
+ Eina_Array_Iterator iterator;
+ int i;
+ struct overlay_item *poi;
+
+ if(ov->state == OVERLAY_HIDDEN)
+ return;
+
+ if(ov->current_level <= 0)
+ return;
+
+ if(ov->pois[ov->current_level] == NULL)
+ return;
+ ov->state = newstate;
+
+ EINA_ARRAY_ITER_NEXT(ov->pois[ov->current_level], i, poi, iterator)
+ {
+ evas_object_hide(poi->obj->obj);
+ }
+}
+
+void overlay_hide(struct smart_map *smart, char *name)
+{
+ struct map_overlay *ov = overlay_find_by_name(smart, name);
+ if(ov == NULL)
+ return;
+
+ _overlay_hide(smart, ov, OVERLAY_HIDDEN);
+}
+
+void overlay_hide_all(struct smart_map *smart)
+{
+ Eina_Array_Iterator iterator;
+ int i;
+ struct map_overlay *ov;
+
+
+ EINA_ARRAY_ITER_NEXT(smart->overlays, i, ov, iterator)
+ {
+ _overlay_hide(smart, ov, OVERLAY_HIDDEN);
+ }
+}
+
+static void _overlay_change_level(struct smart_map *smart, struct map_overlay *ov, int level)
+{
+ Eina_Array_Iterator iterator;
+ int i;
+ struct overlay_item *poi;
+
+ if(level >= OSM_LEVEL_COUNT)
+ {
+ printf("overlay_change_level: level %i not supported\n", level);
+ return;
+ }
+
+ if(ov->current_level > 0 && ov->current_level < OSM_LEVEL_COUNT)
+ _overlay_hide(smart, ov, ov->state);
+
+ eina_hash_free(ov->hash); //XXX
+ ov->hash = eina_hash_string_superfast_new(NULL);
+ ov->current_level = level;
+
+ if(ov->pois[level] == NULL)
+ return;
+
+ EINA_ARRAY_ITER_NEXT(ov->pois[level], i, poi, iterator)
+ {
+ _hash_item(smart, ov, poi, level);
+ }
+}
+
+void overlay_change_level(struct smart_map *smart, int level)
+{
+ Eina_Array_Iterator iterator;
+ int i;
+ struct map_overlay *ov;
+
+ EINA_ARRAY_ITER_NEXT(smart->overlays, i, ov, iterator)
+ {
+ _overlay_change_level(smart, ov, level);
+ }
+}
+
+static inline void
+_overlay_unload(struct smart_map *smart, struct map_overlay *ov, struct osm_data *osm)
+{
+ char buf[64];
+ struct map_level_info *li;
+ Eina_Array *items;
+ Eina_Array_Iterator iterator;
+ unsigned int i;
+ struct overlay_item *oi;
+
+ snprintf(buf, 64, "%i/%i/%i", osm->z, osm->x, osm->y);
+ items = eina_hash_find(ov->hash, (const void *)buf);
+ if(items == NULL)
+ {
+ return;
+ }
+
+ EINA_ARRAY_ITER_NEXT(items, i, oi, iterator)
+ {
+ evas_object_hide(oi->obj->obj);
+ }
+}
+
+void overlay_unload(struct smart_map *smart, struct osm_data *osm)
+{
+ Eina_Array_Iterator iterator;
+ int i;
+ struct map_overlay *ov;
+
+ EINA_ARRAY_ITER_NEXT(smart->overlays, i, ov, iterator)
+ {
+ _overlay_unload(smart, ov, osm);
+ }
+}
+
+static void inline
+_overlay_update(struct smart_map *smart, struct map_overlay *ov, struct osm_data *osm, int xoff, int yoff)
+{
+ char buf[64];
+ Eina_Array *items;
+ Eina_Array_Iterator iterator;
+ unsigned int i;
+ struct overlay_item *oi;
+
+ snprintf(buf, 64, "%i/%i/%i", osm->z, osm->x, osm->y);
+ items = eina_hash_find(ov->hash, (const void *)buf);
+ if(items == NULL)
+ {
+ return;
+ }
+
+ EINA_ARRAY_ITER_NEXT(items, i, oi, iterator)
+ {
+ struct overlay_object *obj = oi->obj;
+ evas_object_move(obj->obj,
+ xoff + oi->level_data.ox + obj->ox,
+ yoff + oi->level_data.oy + obj->oy);
+ evas_object_resize(oi->obj->obj, obj->sw, obj->sh);
+ // if(oi->level_data.visible)
+ evas_object_show(oi->obj->obj);
+ }
+}
+
+void overlay_update(struct smart_map *smart, struct osm_data *osm, int xoff, int yoff)
+{
+ Eina_Array_Iterator iterator;
+ int i;
+ struct map_overlay *ov;
+
+ EINA_ARRAY_ITER_NEXT(smart->overlays, i, ov, iterator)
+ {
+ if(ov->state != OVERLAY_VISIBLE)
+ continue;
+ _overlay_update(smart, ov, osm, xoff, yoff);
+ }
+}
diff --git a/friendfinder/map/smart_map_priv.h b/friendfinder/map/smart_map_priv.h
new file mode 100644
index 0000000..d40e847
--- /dev/null
+++ b/friendfinder/map/smart_map_priv.h
@@ -0,0 +1,166 @@
+#ifndef _SMART_MAP_PRIV_H_
+#define _SMART_MAP_PRIV_H_
+
+struct map_level_info
+{
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+
+ double north, south, west, east;
+ double dx, dy, e0, n0;
+};
+
+struct map_info
+{
+ char *path;
+ struct map_level_info *level;
+ int min_level;
+ int max_level;
+ int tile_size;
+};
+
+#include <Evas.h>
+
+struct smart_map;
+struct controls
+{
+ Evas_Object *bt;
+ Evas_Object *bx;
+ Evas_Object *vkbd;
+ Evas_Object *ctrl;
+};
+
+struct overlay_level_data
+{
+ int ox, oy;
+ int visible:1;
+};
+
+struct overlay_object
+{
+ Evas_Object *obj;
+ int ox;
+ int oy;
+ int sw, sh;
+};
+
+struct overlay_item
+{
+ struct overlay_object *obj;
+ double lat, lon;
+ unsigned int level_mask;
+ struct overlay_level_data level_data;
+};
+
+#define OSM_LEVEL_COUNT 19
+
+#include "e_smart_tile.h"
+struct smart_map
+{
+ Evas_Object *obj;
+ Evas_Object *clip;
+ Evas_Object *theme;
+ Evas_Coord x, y, w, h;
+
+ Evas *evas;
+ Evas_Object *win;
+ struct controls c;
+ Eina_Array *overlays;
+ Eina_Array *paths;
+
+ struct map_info *mi;
+ struct map_level_info *li;
+ int current_level;
+
+ struct tile_array ta;
+ double lat;
+ double lon;
+
+ int moved;
+ int drag;
+};
+
+enum {
+ OVERLAY_HIDDEN,
+ OVERLAY_VISIBLE
+};
+
+struct map_overlay
+{
+ struct smart_map *parent;
+ char *name;
+ Eina_Hash *hash;
+ Eina_Array *pois[OSM_LEVEL_COUNT];
+ int current_level;
+ int state;
+};
+
+enum {
+ POSITION_WORLD,
+ POSITION_PX,
+ NUM_POSITION,
+};
+
+struct map_info *map_info_read(const char *path);
+int map_object_update(struct smart_map *smart);
+int controls_init(struct smart_map *smart);
+
+struct map_overlay *overlay_create(struct smart_map *smart, char *name);
+void overlay_update(struct smart_map *smart, struct osm_data *, int xoff, int yoff);
+void overlay_unload(struct smart_map *smart, struct osm_data *osm);
+void overlay_change_level(struct smart_map *smart, int level);
+void overlay_add(struct smart_map *smart, struct map_overlay *ov, struct overlay_item *poi);
+struct map_overlay *overlay_find_by_name(struct smart_map *smart, char *name);
+void overlay_hide(struct smart_map *smart, char *name);
+void overlay_hide_all(struct smart_map *smart);
+
+static inline struct map_level_info *
+map_info_get_level(struct map_info *map, int* z)
+{
+ if(*z < map->min_level || *z > map->max_level)
+ *z = (map->min_level + map->max_level) / 2 ;
+
+ return &map->level[*z - map->min_level];
+}
+
+#include <limits.h>
+#include "../util/projection.h"
+static inline int
+latlon_to_map(struct map_level_info *level, double lat, double lon, int *x, int *y)
+{
+ if(level == NULL)
+ return -1;
+
+ int e = INT_MAX, n = INT_MAX;
+ double e0 = level->e0;
+ double n0 = level->n0;
+ double dx = level->dx;
+ double dy = level->dy;
+
+ project_latlon(lat, lon, &e, &n, PROJECTION_MERC);
+ *x = (e - e0) / dx;
+ *y = (n0 - n) / dy;
+ return 0;
+}
+
+static inline int
+map_to_latlon(struct map_level_info *level, int x, int y, double *lat, double *lon)
+{
+ int e, n;
+
+ if(level == NULL)
+ return -1;
+
+ double e0 = level->e0;
+ double n0 = level->n0;
+ double dx = level->dx;
+ double dy = level->dy;
+
+ e = e0 + x * dx;
+ n = -(y * dy - n0);
+ project_latlon_inv(e, n, lat, lon, PROJECTION_MERC);
+ return 0;
+}
+#endif
diff --git a/friendfinder/msg_sender. b/friendfinder/msg_sender.
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/friendfinder/msg_sender.
diff --git a/friendfinder/msg_sender.c b/friendfinder/msg_sender.c
new file mode 100644
index 0000000..a770169
--- /dev/null
+++ b/friendfinder/msg_sender.c
@@ -0,0 +1,257 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "libircclient.h"
+#include "openssl/blowfish.h"
+
+#include "msg_sender.h"
+#include "gui.h"
+
+static irc_session_t *session;
+irc_callbacks_t callbacks;
+
+char* nick;
+char* send_to;
+char* received_msg;
+char* msg_to_send;
+
+irc_dcc_t dccid;
+irc_dcc_t buddy_dccid;
+
+BF_KEY key;
+
+int run_session = 0;
+int message_available = 0;
+
+int init_connection(char* server_ip, char* user)
+{
+ printf("initialising connection...\n");
+
+ session = irc_create_session(&callbacks);
+ int con = irc_connect(session, server_ip, 6667, NULL, user, user, user);
+
+ if (irc_is_connected(session) == 1)
+ {
+ printf("connected... \n");
+ return 0;
+
+ }
+
+ if (con != 0)
+ {
+ printf("connection error-code: %i \n", con);
+ return 1;
+ }
+}
+
+void disconnect()
+{
+ printf("disconnected...\n");
+ irc_disconnect(session);
+ irc_destroy_session(session);
+}
+
+void set_txt_msg(char *msg)
+{
+ if (msg != NULL)
+ {
+ printf("input msg_sender: %s \n", msg);
+ send_message(session, msg);
+ }
+}
+
+void dump_message(char *msg)
+{
+ received_msg = msg;
+}
+
+void dcc_recv_callback (irc_session_t * session, irc_dcc_t id, int status, void * ctx, const char * data, unsigned int length)
+{
+
+ if( run_session = 0)
+ {
+ irc_run(session);
+ run_session = 1;
+ }
+
+ switch (status)
+ {
+ case LIBIRC_ERR_CLOSED:
+ printf ("DCC %d: chat closed\n", id);
+ break;
+
+ case 0:
+ if ( data == NULL )
+ {
+ printf ("DCC %d: chat connected\n", id);
+ send_message(session, "im here");
+ }
+ else
+ {
+ char *decrypted_msg = (char*) malloc(sizeof(data));
+
+ BF_ecb_encrypt(data, decrypted_msg, &key, BF_DECRYPT);
+
+ show_message(decrypted_msg);
+ printf("incoming message: %s \n", decrypted_msg);
+ }
+ break;
+
+ default:
+ printf ("DCC %d: error %s\n", id, irc_strerror(status));
+ break;
+ }
+ irc_cmd_quit(session, "dcc_recv_callback: 99");
+}
+
+int i = 0;
+
+void send_message(irc_session_t *session, char *msg)
+{
+// printf("your message %i = test \n", i);
+
+ //char msg[64];
+ if (msg != NULL)
+ {
+ char crypted_msg[64];
+
+ printf("send_message: %s \n", msg);
+
+ BF_ecb_encrypt(msg, crypted_msg, &key, BF_ENCRYPT);
+
+ if ( run_session == 0)
+ {
+ irc_run(session);
+ run_session = 1;
+ }
+
+ irc_dcc_msg(session, buddy_dccid, crypted_msg);
+ //TODO: irc_cmd_quit an richtiger stelle einbauen und ablaufen checken!!!
+ irc_cmd_quit(session, "send_message()");
+ }
+ else return;
+}
+
+void on_join(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
+{
+ printf("on_join()\n");
+
+ char sender_name[90];
+
+ irc_target_get_nick(origin, sender_name, sizeof(sender_name));
+
+ if (strcmp(sender_name, send_to) == 0)
+ {
+ printf("Buddy %s joined the channel \n", send_to);
+
+ if (irc_dcc_chat(session, NULL, send_to, dcc_recv_callback, &dccid) != 0)
+ {
+ printf("ddc_chat_init_error \n");
+ }
+
+ else
+ {
+ printf("dcc_chat_init_success \n");
+ printf("dccid %d \n", dccid);
+
+ char _dccid[2];
+ sprintf(_dccid, "%d", dccid);
+ irc_cmd_msg(session, "#msg", _dccid);
+ }
+ }
+ //irc_cmd_quit(session, "on_join");
+}
+
+void on_connect(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
+{
+ irc_cmd_join(session, "#msg", NULL);
+ irc_cmd_msg(session, "#msg", "connected");
+
+ BF_set_key(&key, 5, "abcde");
+}
+
+void on_channel(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
+{
+ printf("on_channel()\n");
+ if (strcmp(params[1], "connected") != 0)
+ {
+ buddy_dccid = atoi(params[1]);
+ printf("buddy_dccid: %d \n", buddy_dccid);
+ }
+// irc_cmd_quit(session, "continue");
+}
+void on_dcc_req(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
+{
+ printf("on_dcc_req()\n");
+ if(irc_dcc_accept (session, 1, 0, dcc_recv_callback) != 0)
+ {
+ printf("ddc_chat_decline \n");
+ }
+
+ else
+ {
+ printf("dcc_chat_accepted \n");
+ }
+// irc_cmd_quit(session, "continue");
+}
+
+
+void msg_main_loop(char *sender, char *receiver)
+{
+ memset(&callbacks, 0, sizeof(callbacks));
+
+ callbacks.event_connect = on_connect;
+ callbacks.event_join = on_join;
+ callbacks.event_dcc_chat_req = on_dcc_req;
+ callbacks.event_channel = on_channel;
+
+ nick = sender;
+ send_to = receiver;
+
+ if (init_connection("127.0.0.1", sender) == 0)
+ {
+ printf("connection succesfull\n");
+ }
+}
+
+void msg_run_irc()
+{
+ if (run_session == 0)
+ {
+ irc_run(session);
+ run_session = 1;
+ }
+}
+
+void msg_stop_irc()
+{
+ irc_cmd_quit(session, "paused");
+}
+
+/*
+int main (int argc, char **argv)
+{
+ memset(&callbacks, 0, sizeof(callbacks));
+
+ callbacks.event_connect = on_connect;
+ callbacks.event_join = on_join;
+ callbacks.event_dcc_chat_req = on_dcc_req;
+ callbacks.event_channel = on_channel;
+
+ nick = argv[1];
+ send_to = argv[2];
+
+ if (init_connection("127.0.0.1", argv[1]) == 0)
+ {
+ int ses = irc_run(session);
+
+ return 0;
+ }
+
+ else
+ {
+ printf("aborting...\n");
+ return 1;
+ }
+}*/
diff --git a/friendfinder/msg_sender.h b/friendfinder/msg_sender.h
new file mode 100644
index 0000000..de90e3c
--- /dev/null
+++ b/friendfinder/msg_sender.h
@@ -0,0 +1,22 @@
+#ifndef __MSG_SENDER_H_
+#define __MSG_SENDER_H_
+
+/* inits main loop of message sender. callbacks are initialized in this function */
+void msg_main_loop(char *sender, char *receiver);
+
+/* starts infinite loop */
+void msg_run_ircm();
+
+/* stops infinite loop * loop */
+void msg_stop_irc();
+
+/* input for message which has to be sent */
+void set_txt_msg(char *msg);
+
+/* returns received message */
+char* get_txt_msg();
+
+
+
+
+#endif
diff --git a/friendfinder/msg_sender.o b/friendfinder/msg_sender.o
new file mode 100644
index 0000000..c674ef6
--- /dev/null
+++ b/friendfinder/msg_sender.o
Binary files differ
diff --git a/friendfinder/receiver.c b/friendfinder/receiver.c
new file mode 100644
index 0000000..427e88b
--- /dev/null
+++ b/friendfinder/receiver.c
@@ -0,0 +1,128 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <libircclient/libircclient.h>
+
+#include "openssl/blowfish.h"
+
+static irc_session_t *session;
+irc_callbacks_t callbacks;
+int counter = 0;
+char sender_name[100];
+
+int ret;
+
+BF_KEY key;
+
+int init_connection(char* server_ip, char* user)
+{
+ printf("init_connection()\n");
+
+ session = irc_create_session(&callbacks);
+ int con = irc_connect(session, server_ip, 6666, NULL, user, "receiver", "receiver");
+ if (con != 0)
+ {
+ printf("connection error-code: %i \n", con);
+
+ return 0;
+ }
+
+ if (irc_is_connected(session) == 1)
+ {
+ printf("connecting...\n");
+ return 1;
+ }
+}
+
+void disconnect()
+{
+ irc_disconnect(session);
+ irc_destroy_session(session);
+}
+
+char* dump_event (irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
+{
+ char* msg = " ";
+
+ //msg = params[2];
+ //printf("%c: \n",params[2]);
+
+
+ return msg;
+}
+
+void get_position(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
+{
+
+ char *decrypted_lat = (char*) malloc(sizeof(params[1]));
+ char *decrypted_lon = (char*) malloc(sizeof(params[1]));
+
+ irc_target_get_nick(origin, sender_name, sizeof(sender_name));
+
+ if (sender_name != NULL && strcmp(sender_name, "sender") == 1)
+ {
+
+ //first message is the ret param, which is needed for message decryption
+ if (counter == 0)
+ {
+ //BF_set_key(&key, 5, "abcde");
+ }
+
+ //dump_event(session, event, origin, params, count);
+ if (counter % 2 == 0)
+ {
+ BF_ecb_encrypt(params[1], decrypted_lat, &key, BF_DECRYPT);
+ printf("lat %s, origin: %s \n", decrypted_lat, sender_name);
+ }
+
+ if (counter % 2 != 0)
+ {
+ BF_ecb_encrypt(params[1], decrypted_lon, &key, BF_DECRYPT);
+ printf("lon %s , origin: %s \n", decrypted_lon, sender_name);
+ printf("====\n");
+ }
+
+ //send an aknowledge to the sender (=sendername, to differ between multiple sender)
+ if (strcmp(params[1], "128") != 0)
+ {
+ irc_cmd_msg(session, "#test", sender_name);
+ counter++;
+ }
+ else
+ {
+ counter++;
+ }
+ }
+
+}
+
+void on_connect(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
+{
+ BF_set_key(&key, 5, "abcde");
+
+ irc_cmd_join(session, "#test", NULL);
+ irc_cmd_msg(session, "#test", "connected");
+}
+
+void receiver_main(char *user)
+{
+
+ memset(&callbacks, 0, sizeof(callbacks));
+
+ callbacks.event_channel = get_position;
+ callbacks.event_connect = on_connect;
+
+ init_connection("127.0.0.1", user);
+
+}
+
+void receiver_run_irc()
+{
+ irc_run(session);
+}
+
+void receiver_stop_irc()
+{
+ irc_cmd_quit(session, "paused");
+}
diff --git a/friendfinder/receiver.h b/friendfinder/receiver.h
new file mode 100644
index 0000000..c222342
--- /dev/null
+++ b/friendfinder/receiver.h
@@ -0,0 +1,13 @@
+#ifndef __GUI_H_
+#define __GUI_H_
+
+/* calls main for receiver */
+void receiver_main(char *user);
+
+/* start irc session */
+void receiver_run_irc();
+
+/* stop irc session */
+void receiver_stop_irc();
+
+#endif
diff --git a/friendfinder/receiver.o b/friendfinder/receiver.o
new file mode 100644
index 0000000..7b40161
--- /dev/null
+++ b/friendfinder/receiver.o
Binary files differ
diff --git a/friendfinder/render/line.c b/friendfinder/render/line.c
new file mode 100644
index 0000000..5af1ec7
--- /dev/null
+++ b/friendfinder/render/line.c
@@ -0,0 +1,394 @@
+#include <stdio.h>
+
+#include <Evas.h>
+
+#include <math.h>
+#include "render/line.h"
+
+static Evas_Smart *get_smart();
+
+static void _line_object_add(Evas_Object *o);
+static void _line_object_del(Evas_Object *o);
+static void _line_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y);
+static void _line_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h);
+static void _line_object_show(Evas_Object *o);
+static void _line_object_hide(Evas_Object *o);
+static void _line_object_color_set(Evas_Object *o, int r, int g, int b, int a);
+static void _line_object_clip_set(Evas_Object *o, Evas_Object *clip);
+static void _line_object_clip_unset(Evas_Object *o);
+
+#define SMART_LINE_NAME "e_smart_line"
+
+struct polyline *polyline_empty()
+{
+ struct polyline *pl;
+
+ pl = (struct polyline *)malloc(sizeof(struct polyline));
+ if (pl == NULL)
+ return NULL;
+
+ pl->w = 0;
+ pl->a = 255;
+ pl->r = 0;
+ pl->g = 0;
+ pl->b = 0;
+
+ pl->points = NULL;
+ pl->count = 0;
+ pl->mode = 0;
+
+ return pl;
+}
+
+void polyline_delete(struct polyline *pl)
+{
+ free(pl->points);
+ free(pl);
+}
+
+void polyline_set_color(struct polyline *pl, int r, int g, int b, int a)
+{
+ pl->a = a;
+ pl->r = r;
+ pl->g = g;
+ pl->b = b;
+}
+
+void polyline_set_width(struct polyline *pl, int w)
+{
+ pl->w = w;
+}
+
+void polyline_add_point(struct polyline *pl, struct point p)
+{
+ pl->points = realloc(pl->points, (pl->count + 1) * sizeof(struct point));
+ pl->points[pl->count] = p;
+ pl->count++;
+}
+
+struct smart_line
+{
+ Evas_Object *obj;
+ Evas_Coord x, y, w, h;
+
+ Evas_Object *clip;
+ Evas_Object *poly;
+ struct point *points;
+ struct polyline *pl;
+ int pcount;
+};
+
+Evas_Object *e_smart_line_add(Evas *e)
+{
+ Evas_Object *o;
+ struct smart_line *smart;
+
+ o = evas_object_smart_add(e, get_smart());
+ smart = evas_object_smart_data_get(o);
+ if(smart == NULL)
+ {
+ evas_object_del(o);
+ return NULL;
+ }
+ smart->points = NULL;
+ smart->pcount = 0;
+ smart->pl = NULL;
+ return o;
+}
+
+static inline int
+line_cut(struct line l0, struct line l1, struct point *p)
+{
+ Evas_Coord c1, c2, det, a1, a2, b1, b2;
+
+ b1 = l0.p0.x - l0.p1.x; // b1 = x1 - x2
+ a1 = l0.p1.y - l0.p0.y; // a1 = y2 - y1
+ c1 = l0.p1.x * l0.p0.y - l0.p0.x * l0.p1.y; // c = x2*y1 - x1*y2;
+
+ b2 = l1.p0.x - l1.p1.x; // b2 = x3 - x4
+ a2 = l1.p1.y - l1.p0.y; // a2 = y4 - y3
+ c2 = l1.p1.x * l1.p0.y - l1.p0.x * l1.p1.y;
+
+ det = a1 * b2 - a2 * b1;
+ if(det == 0)
+ return -1;
+
+ p->x = (b1*c2 - b2*c1)/det;
+ p->y = (a2*c1 - a1*c2)/det;
+
+ return 0;
+}
+
+static inline struct line
+new_line(struct point p0, struct point p1)
+{
+ struct line l;
+ l.p0 = p0;
+ l.p1 = p1;
+ return l;
+}
+
+static inline void
+wide_line(Evas_Coord w, struct line l, struct line *l0, struct line *l1)
+{
+ Evas_Coord dX, dY, dx, dy;
+ double scale, len, ddx, ddy;
+
+ dX = l.p1.x - l.p0.x;
+ dY = l.p1.y - l.p0.y;
+ len = sqrt(dX * dX + dY * dY);
+ scale = (double)(w) / (2 * len);
+
+ ddx = -scale * (double)dY;
+ ddy = scale * (double)dX;
+ ddx += (ddx > 0) ? 0.5 : -0.5;
+ ddy += (ddy > 0) ? 0.5 : -0.5;
+
+ dx = (Evas_Coord)ddx;
+ dy = (Evas_Coord)ddy;
+
+ l0->p0.x = l.p0.x + dx;
+ l0->p0.y = l.p0.y + dy;
+
+ l1->p0.x = l.p0.x - dx;
+ l1->p0.y = l.p0.y - dy;
+
+ l0->p1.x = l.p1.x + dx;
+ l0->p1.y = l.p1.y + dy;
+
+ l1->p1.x = l.p1.x - dx;
+ l1->p1.y = l.p1.y - dy;
+}
+
+static int _is_line_valid(struct line *l, int w)
+{
+ int dx = abs(l->p1.x - l->p0.x);
+ int dy = abs(l->p1.y - l->p0.y);
+ if(dx < w && dy < w)
+ return 0;
+ return 1;
+}
+
+static void _line_update(struct smart_line *smart, int dx, int dy)
+{
+ int i;
+
+ evas_object_polygon_points_clear(smart->poly);
+ for(i = 0; i < smart->pcount; i++)
+ {
+// printf("p[%i]: %i,%i\n", i, poly[i].x, poly[i].y);
+ evas_object_polygon_point_add(smart->poly, smart->points[i].x - dx, smart->points[i].y - dy);
+ }
+ evas_object_show(smart->poly);
+}
+
+struct polyline *e_smart_line_get(Evas_Object *o)
+{
+ struct smart_line *smart;
+ smart = evas_object_smart_data_get(o);
+ return smart->pl;
+}
+
+void e_smart_line_set(Evas_Object *o, struct polyline *pl)
+{
+ int i;
+ struct smart_line *smart;
+ struct line l0_0 = {{0}};
+ struct line l0_1 = {{0}};
+
+ struct point fwd[pl->count];
+ struct point bwd[pl->count];
+
+ int pcount = 0;
+ struct point last;
+
+ if(pl->count < 1)
+ return;
+ smart = evas_object_smart_data_get(o);
+ last = pl->points[0];
+
+ for(i = 1; i < pl->count; i++)
+ {
+ struct point tmp;
+ struct line l = new_line(last, pl->points[i]);
+ if(!_is_line_valid(&l, pl->w))
+ continue;
+
+ if(pcount == 0)
+ {
+ wide_line(pl->w, l, &l0_0, &l0_1);
+ fwd[pcount] = l0_0.p0;
+ bwd[pcount] = l0_1.p0;
+ last = pl->points[i];
+ pcount++;
+ continue;
+ }
+ if(i >= pl->count - 1)
+ {
+ fwd[pcount] = l0_0.p1;
+ bwd[pcount] = l0_1.p1;
+ pcount++;
+ break;
+ }
+
+ struct line l1_0, l1_1;
+
+ wide_line(pl->w, l, &l1_0, &l1_1);
+
+ if(line_cut(l0_0, l1_0, &tmp) < 0)
+ continue;
+ fwd[pcount] = tmp;
+
+ if(line_cut(l0_1, l1_1, &tmp) < 0)
+ continue;
+
+ bwd[pcount] = tmp;
+ last = pl->points[i];
+ l0_0 = l1_0;
+ l0_1 = l1_1;
+ pcount++;
+ }
+
+ if(smart->points != NULL)
+ free(smart->points);
+ smart->points = (struct point *)malloc(sizeof(struct point) * pcount * 2);
+ smart->pcount = pcount * 2;
+
+ for(i = 0; i < pcount; i++)
+ {
+ smart->points[i] = fwd[i];
+ smart->points[2 * pcount - i - 1] = bwd[i];
+ }
+ evas_object_color_set(smart->poly, pl->r, pl->g, pl->b, pl->a);
+ _line_update(smart, smart->x, smart->y);
+ smart->pl = pl;
+}
+
+static void _line_object_add(Evas_Object *o)
+{
+ struct smart_line *smart;
+
+ smart = calloc(1, sizeof(struct smart_line));
+ if (smart == NULL)
+ return;
+
+ smart->obj = o;
+ smart->x = 0;
+ smart->y = 0;
+ smart->w = 0;
+ smart->h = 0;
+
+ smart->clip = evas_object_rectangle_add(evas_object_evas_get(o));
+ evas_object_smart_member_add(smart->clip, o);
+ evas_object_color_set(smart->clip, 255, 255, 255, 255);
+ evas_object_move(smart->clip, smart->x, smart->y);
+ evas_object_resize(smart->clip, smart->w, smart->h);
+
+ smart->poly = evas_object_polygon_add(evas_object_evas_get(o));
+ evas_object_smart_member_add(smart->poly, o);
+ evas_object_color_set(smart->poly, 255, 255, 255, 255);
+ evas_object_move(smart->poly, smart->x, smart->y);
+ evas_object_resize(smart->poly, smart->w, smart->h);
+ evas_object_show(smart->poly);
+
+ evas_object_smart_data_set(o, smart);
+}
+
+static void _line_object_del(Evas_Object *o)
+{
+ struct smart_line *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_del(smart->clip);
+ evas_object_del(smart->poly);
+
+ free(smart);
+}
+
+static void _line_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y)
+{
+ struct smart_line *smart;
+ smart = evas_object_smart_data_get(o);
+
+ smart->x = x;
+ smart->y = y;
+
+ _line_update(smart, smart->x, smart->y);
+}
+
+static void _line_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h)
+{
+ struct smart_line *smart;
+ smart = evas_object_smart_data_get(o);
+
+ smart->w = w;
+ smart->h = h;
+ evas_object_resize(smart->clip, smart->w, smart->h);
+ evas_object_resize(smart->poly, smart->w, smart->h);
+}
+
+static void _line_object_show(Evas_Object *o)
+{
+ struct smart_line *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_show(smart->clip);
+}
+
+static void _line_object_hide(Evas_Object *o)
+{
+ struct smart_line *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_hide(smart->clip);
+}
+
+static void _line_object_color_set(Evas_Object *o, int r, int g, int b, int a)
+{
+ struct smart_line *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_color_set(smart->poly, r, g, b, a);
+}
+
+static void _line_object_clip_set(Evas_Object *o, Evas_Object *clip)
+{
+ struct smart_line *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_clip_set(smart->clip, clip);
+}
+
+static void _line_object_clip_unset(Evas_Object *o)
+{
+ struct smart_line *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_clip_unset(smart->clip);
+}
+
+static Evas_Smart *get_smart()
+{
+ static Evas_Smart *e_smart_line = NULL;
+
+ if(e_smart_line != NULL)
+ return e_smart_line;
+
+ e_smart_line = evas_smart_new(SMART_LINE_NAME,
+ _line_object_add,
+ _line_object_del,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ _line_object_move,
+ _line_object_resize,
+ _line_object_show,
+ _line_object_hide,
+ _line_object_color_set,
+ _line_object_clip_set,
+ _line_object_clip_unset,
+ NULL);
+ return e_smart_line;
+}
diff --git a/friendfinder/render/line.h b/friendfinder/render/line.h
new file mode 100644
index 0000000..7f3ef09
--- /dev/null
+++ b/friendfinder/render/line.h
@@ -0,0 +1,39 @@
+#ifndef __LINE_H
+#define __LINE_H
+
+struct point
+{
+ Evas_Coord x, y;
+ double lat, lon;
+};
+
+static inline void point_dump(struct point *p)
+{
+ printf("%lf,%lf -> %i,%i\n", p->lat, p->lon, p->x, p->y);
+}
+
+struct line
+{
+ struct point p0;
+ struct point p1;
+};
+
+struct polyline
+{
+ struct point *points;
+ int count;
+ unsigned char a, r, g, b, w;
+ int mode;
+};
+
+Evas_Object *e_smart_line_add(Evas *e);
+void e_smart_line_set(Evas_Object *o, struct polyline *pl);
+struct polyline *e_smart_line_get(Evas_Object *o);
+
+void polyline_add_point(struct polyline *pl, struct point p);
+void polyline_set_width(struct polyline *pl, int w);
+void polyline_set_color(struct polyline *pl, int r, int g, int b, int a);
+void polyline_delete(struct polyline *pl);
+struct polyline *polyline_empty();
+
+#endif
diff --git a/friendfinder/sender.c b/friendfinder/sender.c
new file mode 100644
index 0000000..cef8aeb
--- /dev/null
+++ b/friendfinder/sender.c
@@ -0,0 +1,168 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+
+#include "libircclient.h"
+#include "openssl/blowfish.h"
+
+static irc_session_t *session;
+irc_callbacks_t callbacks;
+int msg_count = 0;
+int ack_count = 0;
+int resend = 0;
+char* nick;
+
+int first_send = 0;
+int run_session = 0;
+
+BF_KEY key;
+
+int init_connection(char* server_ip, char* user)
+{
+ printf("initialising connection...\n");
+
+ session = irc_create_session(&callbacks);
+ int con = irc_connect(session, server_ip, 6667, NULL, user, user, user);
+
+ if (irc_is_connected(session) == 1)
+ {
+ printf("connected... \n");
+ return 0;
+
+ }
+
+ if (con != 0)
+ {
+ printf("connection error-code: %i \n", con);
+ return 1;
+ }
+}
+
+void disconnect()
+{
+ printf("disconnected...\n");
+ irc_disconnect(session);
+ irc_destroy_session(session);
+}
+
+//create random position between two y coordinates. bb_y_left < bb_y_right, bb_y_left = 0!
+int random_position_y(int bb_y_right)
+{
+ return rand() % bb_y_right;
+}
+
+//create random position between two x coordinates. bb_x_lower < bb_x_upper, bb_x_lower = 0!
+int random_position_x(int bb_x_upper)
+{
+ return rand() % bb_x_upper;
+}
+
+void send_position(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
+{
+
+ unsigned char crypted_lat[64];
+ unsigned char crypted_lon[64];
+
+ if (first_send == 0)
+ {
+ BF_set_key(&key, 5, "abcde");
+
+ irc_cmd_join(session, "#test", NULL);
+ }
+
+ for(int i = 0; i < 2; i++)
+ {
+ int lat = random_position_x(1000);
+ printf("lat position %i \n", lat);
+ int lon = random_position_y(1000);
+ printf("lon position %i \n", lon);
+
+ unsigned char lat_char[8];
+ sprintf(lat_char, "%i", lat);
+
+ unsigned char lon_char[8];
+ sprintf(lon_char, "%i", lon);
+
+ BF_ecb_encrypt(lat_char, crypted_lat, &key, BF_ENCRYPT);
+ BF_ecb_encrypt(lon_char, crypted_lon, &key, BF_ENCRYPT);
+
+ BF_ecb_encrypt(crypted_lat, lat_char, &key, BF_DECRYPT);
+ printf("self-test: %s \n", lat_char);
+
+ int _x = irc_cmd_msg(session, "#test", crypted_lat);
+ int _y = irc_cmd_msg(session, "#test", crypted_lon);
+
+ //increase counter variable, which counts number of send positions!
+ msg_count = msg_count + 2;
+
+ if (_x == 0 && _y == 0)
+ {
+ printf("send succesfull %i %i \n", lat, lon);
+ }
+
+ if (_y != 0)
+ {
+ printf("error code due sending: %i \n", _y);
+ }
+
+ if (_x != 0)
+ {
+ printf("error code due sending: %i \n", _x);
+ }
+
+ first_send = 1;
+ }
+
+ if(resend == 1)
+ {
+ get_aknowledge(session, event, origin, params, count);
+ resend = 0;
+ ack_count = 0;
+ }
+}
+
+void get_aknowledge(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
+{
+ if(strcmp(params[1], nick) == 0)
+ {
+ //use count variable, to count number of aknowledged positions! second number has to be twice as big, as the number of
+ //for-runs in send_position
+ if (ack_count <= 3 && msg_count > 0)
+ {
+ ack_count++;
+ msg_count--;
+ }
+
+ if (ack_count == 4 && msg_count == 0)
+ {
+ resend = 1;
+ send_position(session, event, origin, params, count);
+ }
+ }
+}
+
+void sender_main(char *nick)
+{
+ memset(&callbacks, 0, sizeof(callbacks));
+
+ callbacks.event_connect = send_position;
+ callbacks.event_channel = get_aknowledge;
+
+
+ init_connection("127.0.0.1", nick);
+}
+
+void sender_run_irc()
+{
+ if (run_session == 0)
+ {
+ irc_run(session);
+ run_session = 1;
+ }
+}
+
+void sender_stop_irc()
+{
+ irc_cmd_quit(session, "paused");
+}
diff --git a/friendfinder/sender.h b/friendfinder/sender.h
new file mode 100644
index 0000000..78c9f67
--- /dev/null
+++ b/friendfinder/sender.h
@@ -0,0 +1,13 @@
+#ifndef __SENDER_H_
+#define __SENDER_H_
+
+/* inits sender */
+void sender_main(char *nick);
+
+/* starts irc session */
+void sender_run_irc();
+
+/* stops irc session */
+void sender_stop_irc();
+
+#endif
diff --git a/friendfinder/sender.o b/friendfinder/sender.o
new file mode 100644
index 0000000..92c80b1
--- /dev/null
+++ b/friendfinder/sender.o
Binary files differ
diff --git a/friendfinder/util/projection.c b/friendfinder/util/projection.c
new file mode 100644
index 0000000..d61a168
--- /dev/null
+++ b/friendfinder/util/projection.c
@@ -0,0 +1,96 @@
+#include <proj_api.h>
+#include "projection.h"
+
+struct projection
+{
+ int type;
+ projPJ pj;
+ int argc;
+ char *argv[];
+
+};
+
+static struct projection merc = {
+ PROJECTION_MERC,
+ NULL,
+ 6,
+ {
+ "proj=merc",
+ "datum=WGS84",
+ "k=1.0",
+ "units=m",
+ "over",
+ "no_defs"}
+};
+
+static struct projection utm = {
+ PROJECTION_UTM,
+ NULL,
+ 3,
+ {
+ "proj=utm",
+ "datum=WGS84",
+ "zone=32"
+ }
+};
+
+static struct projection *p;
+
+static inline int
+projection_init(int type)
+{
+ //XXX pj_free()
+ switch(type)
+ {
+ case PROJECTION_UTM:
+ p = &utm;
+ break;
+ case PROJECTION_MERC:
+ p = &merc;
+ break;
+ default:
+ p = NULL;
+ return -1;
+ }
+
+ if(p->pj != NULL)
+ return 0;
+
+ p->pj = pj_init(p->argc, p->argv);
+ if(p->pj == NULL)
+ {
+ p = NULL;
+ return -1;
+ }
+ return 0;
+}
+
+int
+project_latlon(double lat, double lon, int *e, int *n, int type)
+{
+ projUV point;
+ if(projection_init(type))
+ return -1;
+
+ point.u = lon * DEG_TO_RAD;
+ point.v = lat * DEG_TO_RAD;
+ point = pj_fwd(point, p->pj);
+ *e = point.u;
+ *n = point.v;
+ return 0;
+}
+
+int
+project_latlon_inv(int e, int n, double *lat, double *lon, int type)
+{
+ projUV point;
+ if(projection_init(type))
+ return -1;
+
+ point.u = e;
+ point.v = n;
+ point = pj_inv(point, p->pj);
+ *lon = point.u / DEG_TO_RAD;
+ *lat = point.v / DEG_TO_RAD;
+ return 0;
+}
diff --git a/friendfinder/util/projection.h b/friendfinder/util/projection.h
new file mode 100644
index 0000000..d1509ac
--- /dev/null
+++ b/friendfinder/util/projection.h
@@ -0,0 +1,11 @@
+#ifndef _PROJECTION_H
+#define _PROJECTION_H
+enum
+{
+ PROJECTION_UTM,
+ PROJECTION_MERC
+};
+
+int project_latlon(double lat, double lon, int *e, int *n, int type);
+int project_latlon_inv(int e, int n, double *lat, double *lon, int type);
+#endif
diff --git a/friendfinder/util/sqlite_helper.c b/friendfinder/util/sqlite_helper.c
new file mode 100644
index 0000000..528d2f0
--- /dev/null
+++ b/friendfinder/util/sqlite_helper.c
@@ -0,0 +1,205 @@
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "util/sqlite_helper.h"
+
+#ifdef WINCE
+#include <Evil.h>
+#endif
+
+
+int sql_result_step(struct sql_result *r)
+{
+ int ret;
+ if(r->stmt == NULL)
+ return -1;
+
+ ret = sqlite3_step(r->stmt);
+ if(ret != SQLITE_ROW)
+ {
+ sqlite3_finalize(r->stmt);
+ r->stmt = NULL;
+ return -1;
+ }
+ return 0;
+}
+
+void sql_result_destroy(struct sql_result *res)
+{
+ sqlite3_finalize(res->stmt);
+ free(res);
+}
+
+static struct sql_result *
+sql_result_create(sqlite3 *db, sqlite3_stmt *stmt)
+{
+ struct sql_result *result = malloc(sizeof(struct sql_result));
+ result->stmt = stmt;
+ result->columnCount = sqlite3_column_count(stmt);
+
+ /*
+ result->cols = (char **)malloc(result->columnCount * sizeof(char *));
+ result->columnTypes = (int *)malloc(result->columnCount * sizeof(int));
+ for(i = 0; i < result->columnCount; i++)
+ {
+ result->cols[i] = (char *)sqlite3_column_name(stmt, i);
+ result->columnTypes[i] = sqlite3_column_type(stmt, i);
+ }
+ */
+ return result;
+}
+
+static struct sql_result *_sql_query(sqlite3 *db, char *sql, int *ret)
+{
+ const char *tail;
+ sqlite3_stmt *stmt;
+
+ *ret = sqlite3_prepare_v2(db, sql, -1, &stmt, &tail);
+ *ret = sqlite3_step(stmt);
+ switch(*ret)
+ {
+ case SQLITE_DONE:
+ sqlite3_finalize(stmt);
+ return NULL;
+ case SQLITE_ROW:
+ return sql_result_create(db, stmt);
+ default:
+ printf("sql_query(%i): %s\n%s \n", *ret, sql, sqlite3_errmsg(db));
+ return NULL;
+ }
+}
+
+static int sql_query_smpl(sqlite3 *db, char *sql)
+{
+ int ret;
+ // char *errmsg;
+
+ const char *tail;
+ sqlite3_stmt *stmt;
+
+ ret = sqlite3_prepare_v2(db, sql, -1, &stmt, &tail);
+ if(ret != 0)
+ printf("ret %i\n", ret);
+ ret = sqlite3_step(stmt);
+ switch(ret)
+ {
+ case SQLITE_DONE:
+ sqlite3_finalize(stmt);
+ return sqlite3_last_insert_rowid(db);
+ case SQLITE_ROW:
+ printf("not a simple query %s\nreturned row", sql);
+ return 0;
+ default:
+ sqlite3_finalize(stmt);
+ printf("sql_query(%i): %s\n%s \n", ret, sql, sqlite3_errmsg(db));
+ return -1;
+ }
+
+ /*
+ ret = sqlite3_exec(osm->db, sql, NULL, NULL, &errmsg);
+ if(ret != SQLITE_OK)
+ {
+ printf("osm_query_smpl(%i): %s\n", ret, sql);
+ printf("err mesg %s\n", errmsg);
+ return -1;
+ }
+
+ return 0;
+ */
+}
+
+#ifdef WINCE
+static inline void unix2win_path(char *str)
+{
+ while(*str)
+ {
+ if(*str == '/')
+ *str = '\\';
+ str++;
+ }
+}
+
+char *wince_full_path(char *file)
+{
+ char pwd[100];
+ char dirbuff[512];
+ getcwd(pwd, 100);
+ sprintf(dirbuff, "%s/%s", pwd, file);
+ unix2win_path(dirbuff);
+ return strdup(dirbuff);
+}
+#endif
+
+
+sqlite3 *sql_open(char *filename)
+{
+ sqlite3 *db;
+ char *file;
+#ifdef WINCE
+ file = wince_full_path(filename);
+#else
+ file = filename;
+#endif
+ if(sqlite3_open(file, &db))
+ {
+ fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
+#ifdef WINCE
+ free(file);
+#endif
+ return NULL;
+ }
+#ifdef WINCE
+ free(file);
+#endif
+ return db;
+}
+
+int sql_exec(sqlite3 *db, char *msgfmt, ...)
+{
+ char sql[512];
+ va_list args;
+ int ret;
+
+ va_start(args, msgfmt);
+ ret = vsprintf(sql, msgfmt, args);
+ va_end(args);
+ if(ret < 0)
+ return ret;
+
+ return sql_query_smpl(db, sql);
+}
+
+
+struct sql_result *sql_query(sqlite3 *db, int *error, char *msgfmt, ...)
+{
+ char sql[512];
+ va_list args;
+ int ret;
+ struct sql_result *res;
+
+ va_start(args, msgfmt);
+ ret = vsprintf(sql, msgfmt, args);
+ va_end(args);
+
+ fprintf(stdout, "%s\n", sql);
+
+ if(ret < 0)
+ {
+ if(error)
+ *error = ret;
+ return NULL;
+ }
+
+ res = _sql_query(db, sql, &ret);
+ if(res == NULL)
+ {
+ if(error)
+ *error = ret;
+ return NULL;
+ }
+ return res;
+}
+
diff --git a/friendfinder/util/sqlite_helper.h b/friendfinder/util/sqlite_helper.h
new file mode 100644
index 0000000..99f2ab1
--- /dev/null
+++ b/friendfinder/util/sqlite_helper.h
@@ -0,0 +1,17 @@
+#ifndef ____DB_H_
+#define ____DB_H_
+
+#include <sqlite3.h>
+
+struct sql_result
+{
+ sqlite3_stmt *stmt;
+ int columnCount;
+};
+
+int sql_result_step(struct sql_result *);
+void sql_result_destroy(struct sql_result *res);
+sqlite3 *sql_open(char *filename);
+int sql_exec(sqlite3 *db, char *msgfmt, ...);
+struct sql_result *sql_query(sqlite3 *db, int *error, char *msgfmt, ...);
+#endif
diff --git a/friendfinder/util/sqlite_helper.o b/friendfinder/util/sqlite_helper.o
new file mode 100644
index 0000000..424fc5a
--- /dev/null
+++ b/friendfinder/util/sqlite_helper.o
Binary files differ
diff --git a/friendfinder/vkbd/Makefile b/friendfinder/vkbd/Makefile
new file mode 100644
index 0000000..4b59c8a
--- /dev/null
+++ b/friendfinder/vkbd/Makefile
@@ -0,0 +1,6 @@
+
+all:
+ edje_cc vkbd.edc
+
+clean:
+ rm -rf vkbd.edj
diff --git a/friendfinder/vkbd/VeraBd.ttf b/friendfinder/vkbd/VeraBd.ttf
new file mode 100644
index 0000000..51d6111
--- /dev/null
+++ b/friendfinder/vkbd/VeraBd.ttf
Binary files differ
diff --git a/friendfinder/vkbd/arrow_down.png b/friendfinder/vkbd/arrow_down.png
new file mode 100644
index 0000000..db81aac
--- /dev/null
+++ b/friendfinder/vkbd/arrow_down.png
Binary files differ
diff --git a/friendfinder/vkbd/background.png b/friendfinder/vkbd/background.png
new file mode 100644
index 0000000..1850e67
--- /dev/null
+++ b/friendfinder/vkbd/background.png
Binary files differ
diff --git a/friendfinder/vkbd/backspace.png b/friendfinder/vkbd/backspace.png
new file mode 100644
index 0000000..a0aae47
--- /dev/null
+++ b/friendfinder/vkbd/backspace.png
Binary files differ
diff --git a/friendfinder/vkbd/bt_basew.png b/friendfinder/vkbd/bt_basew.png
new file mode 100644
index 0000000..8d787dd
--- /dev/null
+++ b/friendfinder/vkbd/bt_basew.png
Binary files differ
diff --git a/friendfinder/vkbd/bt_glow.png b/friendfinder/vkbd/bt_glow.png
new file mode 100644
index 0000000..b8ed187
--- /dev/null
+++ b/friendfinder/vkbd/bt_glow.png
Binary files differ
diff --git a/friendfinder/vkbd/ilist_1.png b/friendfinder/vkbd/ilist_1.png
new file mode 100644
index 0000000..40a3238
--- /dev/null
+++ b/friendfinder/vkbd/ilist_1.png
Binary files differ
diff --git a/friendfinder/vkbd/vkbd-key.edc b/friendfinder/vkbd/vkbd-key.edc
new file mode 100644
index 0000000..2eb7d1b
--- /dev/null
+++ b/friendfinder/vkbd/vkbd-key.edc
@@ -0,0 +1,137 @@
+#define _KEY_BG(key_name, x, y, w, h) \
+ part { \
+ name: "key-bg-"key_name; \
+ type: IMAGE; \
+ pointer_mode: NOGRAB; \
+ description { \
+ state: "default" 0.0; \
+ min: w h; \
+ max: w h; \
+ rel1 { \
+ relative: 0.0 0.0; \
+ offset: (x + w/2) (y + h/2); \
+ } \
+ rel2 { \
+ relative: 0.0 0.0; \
+ offset: (x + w/2) (y + h/2); \
+ } \
+ image.normal: "bt_basew.png"; \
+ } \
+ } \
+ part { \
+ name: "key-bg2-"key_name; \
+ type: IMAGE; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ min: (w-2) (h-2); \
+ max: (w-2) (h-2); \
+ rel1 { \
+ relative: 0.0 0.0; \
+ offset: (x + w/2 + 2) (y + h/2 + 2); \
+ } \
+ rel2 { \
+ relative: 0.0 0.0; \
+ offset: (x + w/2 -2) (y + h/2 - 2); \
+ } \
+ image.normal: "bt_glow.png"; \
+ } \
+ }
+
+
+#define _KEY_LABEL(key_text, key_name, lbl_dx, lbl_dy) \
+part { \
+ name: "key-lbl-"key_name; \
+ type: TEXT; \
+ mouse_events: 0; \
+ effect: OUTLINE; \
+ description { \
+ state: "default" 0.0; \
+ color: 0 0 0 255; \
+ color2: 255 255 255 255; \
+ color3: 255 255 255 255; \
+ rel1 { \
+ to: "key-bg-"key_name; \
+ relative: 0.0 0.0; \
+ offset: (2 + lbl_dx) (1 + lbl_dy); \
+ } \
+ rel2 { \
+ to: "key-bg-"key_name; \
+ relative: 1.0 0.0; \
+ offset: -1 30; \
+ } \
+ text { \
+ font: "key"; \
+ size: 15; \
+ text: key_text; \
+ } \
+ } \
+ description { \
+ state: "down" 0.0; \
+ inherit: "default" 0.0; \
+ visible: 0; \
+ } \
+ }
+
+#define KEY_IMG(key_img, key_name, x, y, w, h) \
+ _KEY_BG(key_name, x, y, w, h) \
+ part { \
+ name: "key-img-"key_name; \
+ type: IMAGE; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ min: w h; \
+ max: w h; \
+ rel1 { \
+ relative: 0.0 0.0; \
+ offset: (x + w/2) (y + h/2); \
+ } \
+ rel2 { \
+ relative: 0.0 0.0; \
+ offset: (x + w/2) (y + h/2);\
+ }\
+ image.normal: key_img;\
+ }\
+ }\
+
+
+#define KEY_IMG2(key_img, key_name, x, y, w, h, iw, ih) \
+ _KEY_BG(key_name, x, y, w, h) \
+ part { \
+ name: "key-img-"key_name; \
+ type: IMAGE; \
+ mouse_events: 0; \
+ description { \
+ state: "default" 0.0; \
+ min: iw ih; \
+ max: iw ih; \
+ rel1 { \
+ relative: 0.0 0.0; \
+ offset: (x + w/2) (y+h/2); \
+ } \
+ rel2 { \
+ relative: 0.0 0.0; \
+ offset: (x + w/2) (y+h/2);\
+ }\
+ image.normal: key_img;\
+ }\
+ }\
+
+
+#define SKEY_FULL(key_text, key_name, x, y, w, h, lbl_dx, lbl_dy) \
+ _KEY_BG(key_name, x, y, w, h) \
+ _KEY_LABEL(key_text, key_name, lbl_dx, lbl_dy) \
+
+#define KEY_SIZE 30
+#define KEY_FULL(v, x, y, lbl_dx, lbl_dy) SKEY_FULL(v, v, x, y, KEY_SIZE, KEY_SIZE, lbl_dx, lbl_dy)
+#define SKEY(name, text, x, y) SKEY_FULL(name, text, x, y, KEY_SIZE, KEY_SIZE, 0, 0)
+#define KEY(v, x, y) SKEY(v, v, x, y)
+#define SKEY_WIDE(name, lbl, x, y, w) \
+ _KEY_BG(name, x, y, w, KEY_SIZE) \
+ _KEY_LABEL(lbl, name, 0, 0) \
+
+#define KEY_WIDE(v, x, y, w) SKEY_WIDE(v, v, x, y, w)
+#define KEY_HPOS(index) KEY_SIZE * index
+#define KEY_VPOS(index) KEY_SIZE * index
+
diff --git a/friendfinder/vkbd/vkbd-main.edc b/friendfinder/vkbd/vkbd-main.edc
new file mode 100644
index 0000000..201bc95
--- /dev/null
+++ b/friendfinder/vkbd/vkbd-main.edc
@@ -0,0 +1,219 @@
+#define GROUP_DEFAULTS \
+ description { \
+ state: "default" 0.0; \
+ min: 240 150; \
+ max: 240 150; \
+ fixed: 1 1; \
+ rel1 { \
+ to: "background"; \
+ relative: 0.0 0.0; \
+ offset: 0 50; \
+ }\
+ }\
+ description { \
+ state: "hidden" 0.0; \
+ inherit: "default" 0.0; \
+ visible: 0; \
+ } \
+
+
+group {
+ name: "main";
+
+ min: 240 200;
+ parts {
+
+ part {
+ name: "background";
+ type: IMAGE;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min: 240 240;
+ max: 240 240;
+
+ rel1 {
+ relative: 1.0 1.0;
+ offset: -240 -240;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ image {
+ normal: "ilist_1.png";
+ }
+ }
+ }
+
+
+ part {
+ name: "field_bg";
+ mouse_events: 0;
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 5;
+ rel1 {
+ relative: 0.0 1.0;
+ offset: 4 -240;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: -4 -182;
+ }
+ }
+ }
+
+ part {
+ name: "field";
+ mouse_events: 0;
+ type: TEXTBLOCK;
+ description {
+ state: "default" 0.0;
+ color: 30 30 30 255;
+ rel1 {
+ to: "field_bg";
+ relative: 0 0;
+ offset: 4 4;
+ }
+ rel2 {
+ to: "field_bg";
+ relative: 1 1;
+ offset: -5 -5;
+ }
+ text {
+ text: "";
+ style: "field_style";
+ }
+ }
+ }
+
+ part {
+ name: "alpha";
+ type: GROUP;
+ source: "alpha";
+ mouse_events: 1;
+ repeat_events: 1;
+ GROUP_DEFAULTS
+ }
+
+ part {
+ name: "special-1";
+ type: GROUP;
+ source: "special-1";
+ mouse_events: 1;
+ repeat_events: 1;
+ GROUP_DEFAULTS
+ }
+ part {
+ name: "special-2";
+ type: GROUP;
+ source: "special-2";
+ mouse_events: 1;
+ repeat_events: 1;
+ GROUP_DEFAULTS
+ }
+}
+
+ programs {
+ program {
+ name: "show-alpha";
+ signal: "show-alpha";
+ action: STATE_SET "default" 0.0;
+ target: "alpha";
+ }
+ program {
+ name: "hide-alpha";
+ signal: "hide-alpha";
+ action: STATE_SET "hidden" 0.0;
+ target: "alpha";
+ }
+
+ program {
+ name: "hide-special-1";
+ signal: "hide-special-1";
+ action: STATE_SET "hidden" 0.0;
+ target: "special-1";
+ }
+ program {
+ name: "show-special-1";
+ signal: "show-special-1";
+ action: STATE_SET "default" 0.0;
+ target: "special-1";
+ }
+
+ program {
+ name: "hide-special-2";
+ signal: "hide-special-2";
+ action: STATE_SET "hidden" 0.0;
+ target: "special-2";
+ }
+ program {
+ name: "show-special-2";
+ signal: "show-special-2";
+ action: STATE_SET "default" 0.0;
+ target: "special-2";
+ }
+
+ program {
+ name: "hide-signal";
+ signal: "kbd-hide";
+ action: SIGNAL_EMIT "kbd" "hide";
+ }
+
+ program {
+ name: "toggle-alpha";
+ signal: "toggle-alpha";
+ after: "hide-special-1";
+ after: "hide-special-2";
+ after: "show-alpha";
+ }
+
+ program {
+ name: "toggle-special-1";
+ signal: "toggle-special-1";
+ after: "hide-alpha";
+ after: "hide-special-2";
+ after: "show-special-1";
+ }
+
+ program {
+ name: "toggle-special-2";
+ signal: "toggle-special-2";
+ after: "hide-alpha";
+ after: "hide-special-1";
+ after: "show-special-2";
+ }
+ program {
+ name: ".@123_clicked";
+ signal: "mouse,clicked,1";
+ source: "*:key-bg-.@123";
+ after: "toggle-special-1";
+ }
+ program {
+ name: "ABC_clicked";
+ signal: "mouse,clicked,1";
+ source: "*:key-bg-ABC";
+ after: "toggle-alpha";
+ }
+ program {
+ name: "symb_clicked";
+ signal: "mouse,clicked,1";
+ source: "special-1:key-bg-symb";
+ after: "toggle-special-2";
+ }
+
+ program {
+ name: "hide_clicked";
+ signal: "mouse,clicked,1";
+ source: "*:key-bg-hide";
+ after: "hide-signal";
+ }
+
+ program {
+ name: "init";
+ signal: "show";
+ after: "toggle-alpha";
+ }
+ }
+ }
diff --git a/friendfinder/vkbd/vkbd-shift.edc b/friendfinder/vkbd/vkbd-shift.edc
new file mode 100644
index 0000000..c05f618
--- /dev/null
+++ b/friendfinder/vkbd/vkbd-shift.edc
@@ -0,0 +1,97 @@
+part {
+ name: "key-bg-shift";
+ type: RECT;
+ pointer_mode: NOGRAB;
+ description {
+ state: "default" 0.0;
+ min: 32 32;
+ max: 32 32;
+ rel1 {
+ relative: 0.0 0.0;
+ offset: (44) (THIRD_ROW + 27);
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ offset: (44) (THIRD_ROW + 27);
+ }
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "key-img-shift";
+ type: IMAGE;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min: 87 54;
+ max: 87 54;
+ rel1 {
+ relative: 0.0 0.0;
+ offset: (44) (THIRD_ROW + 27);
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ offset: (44) (THIRD_ROW + 27);
+ }
+ image {
+ normal: "key-special.png";
+ border: 9 9 9 9;
+ }
+ }
+ description {
+ state: "down" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "key-special-selected.png";
+ border: 9 9 9 9;
+ }
+ }
+ }
+ part {
+ name: "key-lbl-shift";
+ type: IMAGE;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ max: 32 32;
+ min: 32 32;
+ rel1 {
+ to: "key-bg-shift";
+ relative: 0.5 0.5;
+ }
+ rel2 {
+ to: "key-bg-shift";
+ relative: 0.5 0.5;
+ }
+ image.normal: "shift.png";
+ }
+ description {
+ state: "down" 0.0;
+ inherit: "default" 0.0;
+ image.normal: "shift-selected.png";
+ }
+ }
+ programs {
+ program {
+ name: "key-down-shift";
+ signal: "mouse,clicked,1";
+ source: "key-bg-shift";
+ action: SIGNAL_EMIT "key_down" "shift";
+ }
+ program {
+ name: "key-down-shift-enter";
+ signal: "press_shift";
+ action: STATE_SET "down" 0.0;
+ transition: LINEAR 0.1;
+ target: "key-img-shift";
+ target: "key-lbl-shift";
+ }
+ program {
+ name: "key-down-shift-revert";
+ signal: "release_shift";
+ action: STATE_SET "default" 0.0;
+ transition: LINEAR 0.1;
+ target: "key-img-shift";
+ target: "key-lbl-shift";
+ }
+ }
diff --git a/friendfinder/vkbd/vkbd.c b/friendfinder/vkbd/vkbd.c
new file mode 100644
index 0000000..de7d093
--- /dev/null
+++ b/friendfinder/vkbd/vkbd.c
@@ -0,0 +1,260 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <Evas.h>
+#include <Edje.h>
+#include <Edje_Edit.h>
+#include "vkbd.h"
+
+static Evas_Smart *get_smart();
+
+static void _kbd_object_add(Evas_Object *o);
+static void _kbd_object_del(Evas_Object *o);
+static void _kbd_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y);
+static void _kbd_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h);
+static void _kbd_object_show(Evas_Object *o);
+static void _kbd_object_hide(Evas_Object *o);
+static void _kbd_object_color_set(Evas_Object *o, int r, int g, int b, int a);
+static void _kbd_object_clip_set(Evas_Object *o, Evas_Object *clip);
+static void _kbd_object_clip_unset(Evas_Object *o);
+
+#define SMART_KBD_NAME "e_smart_kbd"
+#define INPUT_MAX 512
+struct smart_data
+{
+ Evas_Object *obj;
+ Evas_Coord x, y, w, h;
+
+ Evas_Object *clip;
+ Evas_Object *edje;
+ char input[INPUT_MAX];
+ int input_len;
+ void (*kbd_cb)(char *);
+};
+
+
+static void
+mouse_down(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+ int i;
+ const char *key;
+ struct smart_data *smart = (struct smart_data *)data;
+ if(!smart || smart->input_len >= INPUT_MAX - 1)
+ return;
+
+ int len = strlen(source);
+ for(i = len - 2; i >= 0; i--)
+ {
+ if(source[i] == '-')
+ break;
+ }
+ key = source + i+1;
+ if(strlen(key) == 1)
+ {
+ smart->input[smart->input_len++] = key[0];
+ smart->input[smart->input_len] = '\0';
+ }
+ else if (strlen(key) == 2 && (key[0] & 0xff) == 0xc3)
+ {
+ smart->input[smart->input_len++] = key[0];
+ smart->input[smart->input_len++] = key[1];
+ smart->input[smart->input_len] = '\0';
+ }
+ else
+ {
+ int len;
+ char *val = edje_edit_data_value_get (o, key);
+ if(!val)
+ return;
+ len = INPUT_MAX - smart->input_len - 2;
+ len = (strlen(val) > len) ? len : strlen(val);
+ strncat(smart->input + smart->input_len, val, len);
+ smart->input_len += len;
+ }
+ edje_object_part_text_set(o, "field", smart->input);
+}
+
+static void
+kbd_cb(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+ struct smart_data *smart;
+ Evas_Object *kbd = (Evas_Object *)data;
+ if(!kbd)
+ return;
+ smart = evas_object_smart_data_get(kbd);
+ if(strcmp(source, "hide") == 0)
+ {
+ if(smart->kbd_cb)
+ smart->kbd_cb(strdup(smart->input));
+ smart->input[0] = 0;
+ smart->input_len = 0;
+ smart->kbd_cb = NULL;
+ }
+ printf("kbd_cb source: %s, emission %s\n", source, emission);
+ evas_object_hide(kbd);
+}
+
+Evas_Object *vkbd_add(Evas *e)
+{
+ Evas_Object *o;
+ struct smart_data *smart;
+ Evas_Object *kbd;
+
+ o = evas_object_smart_add(e, get_smart());
+ smart = evas_object_smart_data_get(o);
+ if(smart == NULL)
+ {
+ evas_object_del(o);
+ return NULL;
+ }
+
+ kbd = edje_object_add(e);
+ if(!edje_object_file_set(kbd, "vkbd/vkbd.edj", "main"))
+ {
+ printf("failed loading kbd\n");
+ evas_object_del(kbd);
+ evas_object_del(o);
+ return NULL;
+ }
+ evas_object_clip_set(kbd, smart->clip);
+ edje_object_signal_callback_add(kbd, "mouse,down,1", "*key-bg*", mouse_down, smart);
+ edje_object_signal_callback_add(kbd, "kbd", "*", kbd_cb, o);
+ evas_object_show(kbd);
+
+ smart->input[0] = '\0';
+ smart->input_len = 0;
+ smart->kbd_cb = NULL;
+
+ smart->edje = kbd;
+ return o;
+}
+
+void vkbd_show(Evas_Object *o, Evas_Coord w, Evas_Coord h, void (*cb)(char *))
+{
+ struct smart_data *smart;
+ smart = evas_object_smart_data_get(o);
+ smart->kbd_cb = cb;
+ evas_object_resize(o, w, h);
+ evas_object_show(o);
+}
+
+static void _kbd_object_add(Evas_Object *o)
+{
+ struct smart_data *smart;
+
+ smart = calloc(1, sizeof(struct smart_data));
+ if (smart == NULL)
+ return;
+
+ smart->obj = o;
+ smart->x = 0;
+ smart->y = 0;
+ smart->w = 0;
+ smart->h = 0;
+
+ smart->clip = evas_object_rectangle_add(evas_object_evas_get(o));
+ evas_object_smart_member_add(smart->clip, o);
+ evas_object_color_set(smart->clip, 255, 255, 255, 255);
+ evas_object_move(smart->clip, smart->x, smart->y);
+ evas_object_resize(smart->clip, smart->w, smart->h);
+
+ evas_object_smart_data_set(o, smart);
+}
+
+static void _kbd_object_del(Evas_Object *o)
+{
+ struct smart_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_del(smart->clip);
+ evas_object_del(smart->edje);
+ free(smart);
+}
+
+static void _kbd_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y)
+{
+ struct smart_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ smart->x = x;
+ smart->y = y;
+
+ evas_object_move(smart->clip, x, y);
+ evas_object_move(smart->edje, x, y);
+}
+
+static void _kbd_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h)
+{
+ struct smart_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ smart->w = w;
+ smart->h = h;
+ evas_object_resize(smart->clip, w, h);
+ evas_object_resize(smart->edje, w, h);
+}
+
+static void _kbd_object_show(Evas_Object *o)
+{
+ struct smart_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_show(smart->clip);
+}
+
+static void _kbd_object_hide(Evas_Object *o)
+{
+ struct smart_data *smart;
+ smart = evas_object_smart_data_get(o);
+ evas_object_hide(smart->clip);
+}
+
+static void _kbd_object_color_set(Evas_Object *o, int r, int g, int b, int a)
+{
+ struct smart_data *smart;
+ smart = evas_object_smart_data_get(o);
+ evas_object_color_set(smart->clip, r, g, b, a);
+}
+
+static void _kbd_object_clip_set(Evas_Object *o, Evas_Object *clip)
+{
+ struct smart_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_clip_set(smart->clip, clip);
+}
+
+static void _kbd_object_clip_unset(Evas_Object *o)
+{
+ struct smart_data *smart;
+ smart = evas_object_smart_data_get(o);
+
+ evas_object_clip_unset(smart->clip);
+}
+
+static Evas_Smart *get_smart()
+{
+ static Evas_Smart *e_smart_kbd = NULL;
+
+ if(e_smart_kbd != NULL)
+ return e_smart_kbd;
+
+ e_smart_kbd = evas_smart_new(SMART_KBD_NAME,
+ _kbd_object_add,
+ _kbd_object_del,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ _kbd_object_move,
+ _kbd_object_resize,
+ _kbd_object_show,
+ _kbd_object_hide,
+ _kbd_object_color_set,
+ _kbd_object_clip_set,
+ _kbd_object_clip_unset,
+ NULL);
+ return e_smart_kbd;
+}
+
diff --git a/friendfinder/vkbd/vkbd.edc b/friendfinder/vkbd/vkbd.edc
new file mode 100644
index 0000000..bbd6828
--- /dev/null
+++ b/friendfinder/vkbd/vkbd.edc
@@ -0,0 +1,188 @@
+fonts {
+ font: "VeraBd.ttf" "key";
+}
+
+data {
+ item: "dash" "-";
+ item: "slash" "/";
+ item: "colon" ":";
+ item: "semi_colon" ";";
+ item: "open_par" "(";
+ item: "close_par" ")";
+ item: "dot" ".";
+ item: "comma" ",";
+ item: "question" "?";
+ item: "exclamation" "!";
+ item: "back_quote" "`";
+ item: "single_quote" "'";
+ item: "double_quote" "\"";
+ item: "at" "@";
+ item: "dollar" "$";
+ item: "amp" "&amp;";
+ item: "underline" "_";
+ item: "star" "*";
+ item: "hash" "#";
+ item: "enter" "<br>";
+ item: "plus" "+";
+ item: "equal" "=";
+ item: "percent" "%";
+ item: "tilde" "~";
+ item: "circumflex" "^";
+ item: "backslash" "\\";
+ item: "vert_bar" "|";
+ item: "less" "&lt;";
+ item: "greater" "&gt;";
+ item: "open_bracket" "[";
+ item: "close_bracket" "]";
+ item: "open_brace" "}";
+ item: "close_brace" "{";
+ item: "space" " ";
+}
+
+images {
+ image: "background.png" COMP;
+ image: "backspace.png" COMP;
+ image: "bt_basew.png" COMP;
+ image: "bt_glow.png" COMP;
+ image: "ilist_1.png" COMP;
+ image: "arrow_down.png" COMP;
+}
+
+styles {
+ style {
+ name: "field_style";
+ base: "font=key font_size=15 align=left valign=top color=#000 wrap=char";
+ tag: "br" " \n";
+ }
+}
+
+collections {
+#include "vkbd-main.edc"
+#include "vkbd-key.edc"
+
+ group {
+ name: "alpha";
+
+ parts {
+ KEY_FULL("A", KEY_HPOS(0), KEY_VPOS(0), -6, 0)
+ KEY_FULL("B", KEY_HPOS(1), KEY_VPOS(0), -2, 0)
+ KEY_FULL("C", KEY_HPOS(2), KEY_VPOS(0), -4, 0)
+ KEY_FULL("D", KEY_HPOS(3), KEY_VPOS(0), 0, 0)
+ KEY_FULL("E", KEY_HPOS(4), KEY_VPOS(0), 0, 0)
+ KEY_FULL("F", KEY_HPOS(5), KEY_VPOS(0), 0, 0)
+ KEY_FULL("G", KEY_HPOS(6), KEY_VPOS(0), -2, 2)
+ KEY_FULL("H", KEY_HPOS(7), KEY_VPOS(0), 2, 0)
+
+ KEY_FULL("I", KEY_HPOS(0), KEY_VPOS(1), 2, 0)
+ KEY_FULL("J", KEY_HPOS(1), KEY_VPOS(1), -6, 0)
+ KEY_FULL("K", KEY_HPOS(2), KEY_VPOS(1), 0, 0)
+ KEY_FULL("L", KEY_HPOS(3), KEY_VPOS(1), 0, 0)
+ KEY_FULL("M", KEY_HPOS(4), KEY_VPOS(1), 0, 0)
+ KEY_FULL("N", KEY_HPOS(5), KEY_VPOS(1), 2, 0)
+ KEY_FULL("O", KEY_HPOS(6), KEY_VPOS(1), -2, 0)
+ KEY_FULL("P", KEY_HPOS(7), KEY_VPOS(1), 0, 0)
+
+ KEY_FULL("Q", KEY_HPOS(0), KEY_VPOS(2), -2, 0)
+ KEY_FULL("R", KEY_HPOS(1), KEY_VPOS(2), 0, 0)
+ KEY_FULL("S", KEY_HPOS(2), KEY_VPOS(2), 0, 0)
+ KEY_FULL("T", KEY_HPOS(3), KEY_VPOS(2), -4, 0)
+ KEY_FULL("U", KEY_HPOS(4), KEY_VPOS(2), 0, 0)
+ KEY_FULL("V", KEY_HPOS(5), KEY_VPOS(2), -6, 0)
+ KEY_FULL("W", KEY_HPOS(6), KEY_VPOS(2), -5, 0)
+ KEY_FULL("X", KEY_HPOS(7), KEY_VPOS(2), -4, 0)
+
+ KEY_FULL("Y", KEY_HPOS(0), KEY_VPOS(3), -4, 0)
+ KEY_FULL("Z", KEY_HPOS(1), KEY_VPOS(3), -6, 0)
+ KEY_FULL("Ä", KEY_HPOS(2), KEY_VPOS(3), 0, 0)
+ KEY_FULL("Ö", KEY_HPOS(3), KEY_VPOS(3), 0, 0)
+ KEY_FULL("Ü", KEY_HPOS(4), KEY_VPOS(3), 0, 0)
+ KEY_WIDE("enter", KEY_HPOS(5), KEY_VPOS(3), 2*KEY_SIZE)
+ KEY_IMG("backspace.png", "backspace", KEY_HPOS(7), KEY_VPOS(3),
+ KEY_SIZE, KEY_SIZE)
+
+ KEY_WIDE("shift", KEY_HPOS(0), KEY_VPOS(4), 2*KEY_SIZE)
+ KEY_WIDE("space", KEY_HPOS(2), KEY_VPOS(4), 4*KEY_SIZE)
+ KEY_WIDE(".@123", KEY_HPOS(6), KEY_VPOS(4), 2*KEY_SIZE)
+ KEY_IMG2("arrow_down.png", "hide", KEY_HPOS(0), KEY_VPOS(5),
+ 8*KEY_SIZE, 20, 45, 20);
+ }
+ }
+
+#define FIRST_ROW KEY_VPOS(0)
+#define SECOND_ROW KEY_VPOS(1)
+#define THIRD_ROW KEY_VPOS(2)
+
+ group {
+ name: "special-1";
+ parts {
+ KEY("0", KEY_HPOS(0), FIRST_ROW)
+ KEY("1", KEY_HPOS(1), FIRST_ROW)
+ KEY("2", KEY_HPOS(2), FIRST_ROW)
+ KEY("3", KEY_HPOS(3), FIRST_ROW)
+ KEY("4", KEY_HPOS(4), FIRST_ROW)
+ KEY("5", KEY_HPOS(5), FIRST_ROW)
+ KEY("6", KEY_HPOS(6), FIRST_ROW)
+ KEY("7", KEY_HPOS(7), FIRST_ROW)
+
+ KEY("8", KEY_HPOS(0), SECOND_ROW)
+ KEY("9", KEY_HPOS(1), SECOND_ROW)
+ SKEY("-", "dash", KEY_HPOS(2), SECOND_ROW)
+ SKEY("/", "slash", KEY_HPOS(3), SECOND_ROW)
+ SKEY(":", "colon", KEY_HPOS(4), SECOND_ROW)
+ SKEY(";", "semi_colon", KEY_HPOS(5), SECOND_ROW)
+ SKEY("(", "open_par", KEY_HPOS(6), SECOND_ROW)
+ SKEY(")", "close_par", KEY_HPOS(7), SECOND_ROW)
+
+ SKEY(".", "dot", KEY_HPOS(0), THIRD_ROW)
+ SKEY(",", "comma", KEY_HPOS(1), THIRD_ROW)
+ SKEY("?", "question", KEY_HPOS(2), THIRD_ROW)
+ SKEY("!", "exclamation", KEY_HPOS(3), THIRD_ROW)
+ SKEY("`", "back_quote", KEY_HPOS(4), THIRD_ROW)
+ SKEY("'", "single_quote", KEY_HPOS(5), THIRD_ROW)
+ SKEY("\"", "double_quote", KEY_HPOS(6), THIRD_ROW)
+ SKEY("@", "at", KEY_HPOS(7), THIRD_ROW)
+
+ SKEY("$", "dollar", KEY_HPOS(0), KEY_VPOS(3))
+ SKEY("&", "amp", KEY_HPOS(1), KEY_VPOS(3))
+ SKEY("_", "underline", KEY_HPOS(2), KEY_VPOS(3))
+ SKEY("*", "star", KEY_HPOS(3), KEY_VPOS(3))
+ SKEY("#", "hash", KEY_HPOS(4), KEY_VPOS(3))
+ KEY_WIDE("enter", KEY_HPOS(5), KEY_VPOS(3), 2*KEY_SIZE)
+ KEY_IMG("backspace.png", "backspace", KEY_HPOS(7), KEY_VPOS(3), KEY_SIZE, KEY_SIZE)
+
+ KEY_WIDE("ABC", KEY_HPOS(0), KEY_VPOS(4), 2*KEY_SIZE)
+ KEY_WIDE("space", KEY_HPOS(2), KEY_VPOS(4), 4*KEY_SIZE)
+ SKEY_WIDE("symb", "[]{}", KEY_HPOS(6), KEY_VPOS(4), 2*KEY_SIZE)
+
+ KEY_IMG2("arrow_down.png", "hide", KEY_HPOS(0), KEY_VPOS(5),
+ 8*KEY_SIZE, 20, 45, 20);
+ }
+ }
+
+ group {
+ name: "special-2";
+ parts {
+ SKEY("+", "plus", KEY_HPOS(0), FIRST_ROW)
+ SKEY("=", "equal", KEY_HPOS(1), FIRST_ROW)
+ SKEY("%", "percent", KEY_HPOS(2), FIRST_ROW)
+ SKEY("~", "tilde", KEY_HPOS(3), FIRST_ROW)
+ SKEY("^", "circumflex", KEY_HPOS(4), FIRST_ROW)
+ SKEY("\\", "backslash", KEY_HPOS(5), FIRST_ROW)
+ SKEY("|", "vert_bar", KEY_HPOS(6), FIRST_ROW)
+ SKEY("<", "less", KEY_HPOS(7), FIRST_ROW)
+
+ SKEY(">", "greater", KEY_HPOS(0), SECOND_ROW)
+ SKEY("[", "open_bracket", KEY_HPOS(1), SECOND_ROW)
+ SKEY("]", "close_bracket", KEY_HPOS(2), SECOND_ROW)
+ SKEY("{", "open_brace", KEY_HPOS(3), SECOND_ROW)
+ SKEY("}", "close_brace", KEY_HPOS(4), SECOND_ROW)
+
+ KEY_WIDE("enter", KEY_HPOS(5), KEY_VPOS(3), 2*KEY_SIZE)
+ KEY_IMG("backspace.png", "backspace", KEY_HPOS(7), KEY_VPOS(3), KEY_SIZE, KEY_SIZE)
+ KEY_WIDE("ABC", KEY_HPOS(0), KEY_VPOS(4), 2*KEY_SIZE)
+ KEY_WIDE("space", KEY_HPOS(2), KEY_VPOS(4), 4*KEY_SIZE)
+ KEY_WIDE(".@123", KEY_HPOS(6), KEY_VPOS(4), 2*KEY_SIZE)
+
+ }
+ }
+}
diff --git a/friendfinder/vkbd/vkbd.edj b/friendfinder/vkbd/vkbd.edj
new file mode 100644
index 0000000..0ba78e5
--- /dev/null
+++ b/friendfinder/vkbd/vkbd.edj
Binary files differ
diff --git a/friendfinder/vkbd/vkbd.h b/friendfinder/vkbd/vkbd.h
new file mode 100644
index 0000000..7d3cfd3
--- /dev/null
+++ b/friendfinder/vkbd/vkbd.h
@@ -0,0 +1,6 @@
+#ifndef VKBD_H
+#define VKBD_H
+
+Evas_Object *vkbd_add(Evas *e);
+
+#endif
diff --git a/msg_sender/Makefile.inc b/msg_sender/Makefile.inc
index 4b7d74c..5c18f28 100644
--- a/msg_sender/Makefile.inc
+++ b/msg_sender/Makefile.inc
@@ -2,9 +2,9 @@
# settings
###########
-CFLAGS = -g -Wall
-INCLUDES = -I../include
-LIBS = -ledje -lecore -levas -lelementary -lcrypto -lircclient
+CFLAGS = -g -Wall -std=c99
+INCLUDES = -I../include -I/usr/local/include
+LIBS = -ledje -lecore -levas -lelementary -lecore_evas -lcrypto -lircclient -lproj
###########
@@ -12,7 +12,23 @@ LIBS = -ledje -lecore -levas -lelementary -lcrypto -lircclient
###########
OBJECTS = msg_sender.o
+OBJECTS += receiver.o
+OBJECTS += sender.o
OBJECTS += gui.o
+
+OBJECTS += e_smart_tile.o
+OBJECTS += e_smart_map.o
+
+OBJECTS += render/line.o
+
+OBJECTS += map/map_reader.o
+OBJECTS += map/controls.o
+OBJECTS += map/object.o
+OBJECTS += map/overlay.o
+
+OBJECTS += util/projection.o
+
+OBJECTS += vkbd/vkbd.o
OBJECTS += handler.o
##################
diff --git a/msg_sender/gui.c b/msg_sender/gui.c
index 0cd7e2d..868b4c1 100644
--- a/msg_sender/gui.c
+++ b/msg_sender/gui.c
@@ -1,5 +1,6 @@
#include <stdlib.h>
#include <time.h>
+
#include "Evas.h"
#include "Ecore.h"
#include "Ecore_Evas.h"
@@ -8,12 +9,14 @@
#include "msg_sender.h"
#include "gui.h"
#include "handler.h"
+#include "receiver.h"
+#include "sender.h"
int h = 600;
int w = 450;
int first = 0;
-int bubble_pos = 0;
+int bubble_pos = 100;
time_t now;
const char* msg_text;
char *from, *to, *current_msg, *last_msg;
@@ -33,15 +36,15 @@ static void on_chat(void *data, Evas_Object *obj, void *event_info)
{
init_window_parts();
- init_buttons(obj, NULL);
+ init_buttons(obj);
init_toolbar(obj);
}
-static void on_history(void *data, Evas_Object *obj, void *event_info)
+static void on_map(void *data, Evas_Object *obj, void *event_info)
{
- init_history();
+ init_map();
}
@@ -65,42 +68,51 @@ static void on_send_message(void *data, Evas_Object *bx3, void *event_info)
printf("on_send_message: %s\n", msg_text);
set_txt_msg(msg_text);
- Evas_Object *bb;
-
- if (bubble_pos == 0)
- {
- bubble_pos = 100;
- }
+ Evas_Object *bb1, *bb2, *bb3;
if (msg_text != NULL)
{
- /* if its the first bubble */
+
if (first == 0)
{
- bb = elm_bubble_add(bx3);
- evas_object_resize(bb, w, h/7);
- evas_object_move(bb, 0, 0);
- evas_object_show(bb);
- set_bubble_text(bb, from, msg_text);
+ bb1 = elm_bubble_add(bx3);
+ evas_object_resize(bb1, w, h/7);
+ evas_object_move(bb1, 0, 0);
+ evas_object_show(bb1);
+ set_bubble_text(bb1, from, msg_text);
first = 1;
bubble_pos = bubble_pos + h/6;
+
+ return;
}
- else
+ if (first == 1)
{
- bb = elm_bubble_add(bx3);
- evas_object_resize(bb, w, h/6);
- evas_object_move(bb, 0, bubble_pos);
- evas_object_show(bb);
- set_bubble_text(bb, from, msg_text);
+ bb2 = elm_bubble_add(bx3);
+ evas_object_resize(bb2, w, h/6);
+ evas_object_move(bb2, 0, bubble_pos);
+ evas_object_show(bb2);
+ set_bubble_text(bb2, from, msg_text);
+ first = 2;
bubble_pos = bubble_pos + h/6;
+
+ return;
}
- printf("position: %d\n", bubble_pos);
+ // printf("position: %d\n", bubble_pos);
- if (bubble_pos >= 400)
+ if (first == 2)
{
+ bb3 = elm_bubble_add(bx3);
+ evas_object_resize(bb3, w, h/6);
+ evas_object_move(bb3, 0, bubble_pos);
+ evas_object_show(bb3);
+ set_bubble_text(bb3, from, msg_text);
+
+ first = 0;
bubble_pos = 100;
+
+ return;
}
}
}
@@ -108,42 +120,43 @@ static void on_send_message(void *data, Evas_Object *bx3, void *event_info)
/* if message has been sent, print it in a bubble */
void show_message(char *current_msg)
{
- Evas_Object *bb;
-
- if (bubble_pos == 0)
- {
- bubble_pos = 100;
- }
+ Evas_Object *bb1, *bb2, *bb3;
if (current_msg != NULL)
{
if (first == 0)
{
- bb = elm_bubble_add(bbx);
- evas_object_resize(bb, w, h/7);
- evas_object_move(bb, 0, 0);
- evas_object_show(bb);
- set_bubble_text(bb, to, current_msg);
+ bb1 = elm_bubble_add(bbx);
+ evas_object_resize(bb1, w, h/7);
+ evas_object_move(bb1, 0, 0);
+ evas_object_show(bb1);
+ set_bubble_text(bb1, to, current_msg);
first = 1;
bubble_pos = bubble_pos + h/6;
}
- else
+ if (first == 1);
{
- bb = elm_bubble_add(bbx);
- evas_object_resize(bb, w, h/6);
- evas_object_move(bb, 0, bubble_pos);
- evas_object_show(bb);
- set_bubble_text(bb, to, current_msg);
+ bb2 = elm_bubble_add(bbx);
+ evas_object_resize(bb2, w, h/6);
+ evas_object_move(bb2, 0, bubble_pos);
+ evas_object_show(bb2);
+ set_bubble_text(bb2, to, current_msg);
+ first = 2;
bubble_pos = bubble_pos + h/6;
}
- printf("position: %d\n", bubble_pos);
-
- if (bubble_pos >= 400)
+ if (first == 2)
{
- bubble_pos = 100;
- }
+ bb3 = elm_bubble_add(bbx);
+ evas_object_resize(bb3, w, h/6);
+ evas_object_move(bb3, 0, bubble_pos);
+ evas_object_show(bb3);
+ set_bubble_text(bb3, to, current_msg);
+
+ first = 0;
+ bubble_pos = bubble_pos + h/6;
+ }
}
}
@@ -239,7 +252,8 @@ void init_window_parts()
evas_object_show(sc);
/* init buttons */
- init_buttons(bx2, en);
+ bbx = bx2;
+ init_buttons(bx2);
/* init toolbar */
init_toolbar(win);
@@ -272,7 +286,7 @@ void init_toolbar()
ic = elm_icon_add(win);
elm_icon_standard_set(ic, "clock");
- elm_toolbar_item_add(tb, ic, "History", on_history, NULL);
+ elm_toolbar_item_add(tb, ic, "Map", on_map, NULL);
evas_object_show(ic);
// evas_object_show(ic);
@@ -317,10 +331,10 @@ void init_options()
evas_object_show(bt);
}
-void init_history()
+void init_map()
{
- Evas_Object *bg, *bx, *bx2, *bb;
+ Evas_Object *bg, *bx, *bx2, *bx3, *map, *bt1, *bt2;
/* add a standard bg */
bg = elm_bg_add(win);
@@ -338,24 +352,47 @@ void init_history()
evas_object_show(bx);
bx2 = elm_box_add(win);
- elm_box_horizontal_set(bx2, 1);
evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
evas_object_size_hint_align_set(bx2, -1.0, -1.0);
+ evas_object_resize(bx2, w*1.3, h*0.7);
elm_box_pack_end(bx, bx2);
evas_object_show(bx2);
- bb = elm_bubble_add(bx2);
- evas_object_resize(bb, w, h/7);
- evas_object_move(bb, 0, 300);
- evas_object_show(bb);
- set_bubble_text(bb, "testuser", NULL);
-
+ bx3 = elm_box_add(win);
+ elm_box_horizontal_set(bx2, 1);
+ evas_object_size_hint_weight_set(bx3, 1.0, 0.0);
+ evas_object_size_hint_align_set(bx3, -1.0, 0.0);
+ evas_object_resize(bx3, w*0.9, h*0.2);
+ elm_box_pack_end(bx, bx3);
+ evas_object_show(bx3);
+ map = e_smart_map_add(win, "data/maps/fr_map.eet");
+ e_smart_map_set_pos(map, 47.996578,7.840171);
+ evas_object_size_hint_min_set(map, w-2*8, h-10*8-40);
+ evas_object_size_hint_max_set(map, w-2*8, h-10*8-40);
+ //evas_object_resize(map, w*0.92, h*0.7);
+ elm_box_pack_end(bx2, map);
+ evas_object_show(map);
+
+ bt1 = elm_button_add(win);
+ elm_button_label_set(bt1, "Show friends");
+ evas_object_size_hint_weight_set(bt1, 1.0, 1.0);
+ evas_object_size_hint_align_set(bt1, -1.0, -1.0);
+ elm_box_pack_end(bx3, bt1);
+ evas_object_smart_callback_add(bt1, "clicked", NULL, NULL);
+ evas_object_show(bt1);
+
+ bt2 = elm_button_add(win);
+ elm_button_label_set(bt2, "Hide friends");
+ evas_object_size_hint_weight_set(bt2, 1.0, 1.0);
+ evas_object_size_hint_align_set(bt2, -1.0, -1.0);
+ elm_box_pack_end(bx3, bt2);
+ evas_object_smart_callback_add(bt2, "clicked", NULL, NULL);
+ evas_object_show(bt2);
}
-
-void init_buttons(Evas_Object *box, Evas_Object *msg)
+void init_buttons(Evas_Object *box)
{
Evas_Object *bt;
@@ -365,7 +402,7 @@ void init_buttons(Evas_Object *box, Evas_Object *msg)
elm_button_label_set(bt, "Send Message");
evas_object_size_hint_weight_set(bt, 1.0, 1.0);
evas_object_size_hint_align_set(bt, -1.0, -1.0);
- elm_box_pack_end(box, bt);
+ //elm_box_pack_end(box, bt);
evas_object_show(bt);
/* and when clicked - run "on_ok" */
@@ -414,9 +451,17 @@ void elm_main ()
int main (int argc, char **argv)
{
-
- from = argv[1];
- to = argv[2];
+ if (argv[1] == NULL && argv[2] == NULL)
+ {
+ printf("no nick and no receiver set");
+ from == NULL;
+ to == NULL;
+ }
+ else
+ {
+ from = argv[1];
+ to = argv[2];
+ }
elm_init(argc, argv);
diff --git a/msg_sender/gui.h b/msg_sender/gui.h
index 8236c73..6c6013f 100644
--- a/msg_sender/gui.h
+++ b/msg_sender/gui.h
@@ -11,7 +11,7 @@ static void on_send_message(void *data, Evas_Object *obj, void *event_info);
static void on_message(void *data, Evas_Object *obj, void *event_info);
static void on_options(void *data, Evas_Object *obj, void *event_info);
static void on_chat(void *data, Evas_Object *obj, void *event_info);
-static void on_history(void *data, Evas_Object *obj, void *event_info);
+static void on_map(void *data, Evas_Object *obj, void *event_info);
//other functions
@@ -22,7 +22,7 @@ char* get_current_time();
void init_options();
void init_window_parts();
void init_toolbar();
-void init_history();
-void init_buttons(Evas_Object *box, Evas_Object *msg);
+void init_map();
+void init_buttons(Evas_Object *box);
void elm_main();
#endif
diff --git a/msg_sender/handler.c b/msg_sender/handler.c
index 6c15c8e..9b74339 100644
--- a/msg_sender/handler.c
+++ b/msg_sender/handler.c
@@ -1,22 +1,45 @@
#include "Ecore.h"
#include "/usr/local/include/Evas.h"
-#include "/usr/local/include/Ecore.h"
#include "/usr/local/include/Ecore_Evas.h"
#include "/usr/local/include/Elementary.h"
+#include "receiver.h"
+#include "sender.h"
#include "msg_sender.h"
int is_init = 0;
double interval = 0.1;
double current_time, last_call;
+
+
void pause_msg_sender()
{
- stop_irc();
+ msg_stop_irc();
}
void continue_msg_sender()
{
- run_irc();
+ msg_run_irc();
+}
+
+void pause_receiver()
+{
+ receiver_stop_irc();
+}
+
+void continue_receiver()
+{
+ receiver_run_irc();
+}
+
+void pause_sender()
+{
+ sender_stop_irc();
+}
+
+void continue_sender()
+{
+ sender_run_irc();
}
void exit_all()
@@ -39,15 +62,25 @@ void init_ecore_handler(char *from, char *to)
{
is_init = 1;
msg_main_loop(from, to);
+ sender_main(from);
+ receiver_main(from);
}
ecore_idle_exiter_add(continue_msg_sender, NULL);
ecore_idle_exiter_add(pause_msg_sender, NULL);
+ ecore_idle_exiter_add(continue_sender, NULL);
+
+ ecore_idle_exiter_add(pause_sender, NULL);
+
+ ecore_idle_exiter_add(continue_receiver, NULL);
+
+ ecore_idle_exiter_add(pause_receiver, NULL);
+
ecore_idle_exiter_add(continue_gui, NULL);
- ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_all, NULL);
+ //ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_all, NULL);
ecore_main_loop_begin();
}
diff --git a/msg_sender/handler.h b/msg_sender/handler.h
index 6192044..583fd14 100644
--- a/msg_sender/handler.h
+++ b/msg_sender/handler.h
@@ -1,5 +1,5 @@
-#ifndef __SALSA20_H_
-#define __SALSA20_H_
+#ifndef __HANDLER_H_
+#define __HANDLER_H_
/* inits all needed parts of ecore for the handlers */
void init_ecore_handler(char *from, char *to);
diff --git a/msg_sender/msg_sender.c b/msg_sender/msg_sender.c
index b719e13..a770169 100644
--- a/msg_sender/msg_sender.c
+++ b/msg_sender/msg_sender.c
@@ -215,7 +215,7 @@ void msg_main_loop(char *sender, char *receiver)
}
}
-void run_irc()
+void msg_run_irc()
{
if (run_session == 0)
{
@@ -224,7 +224,7 @@ void run_irc()
}
}
-void stop_irc()
+void msg_stop_irc()
{
irc_cmd_quit(session, "paused");
}
diff --git a/msg_sender/msg_sender.h b/msg_sender/msg_sender.h
index 582c6ec..de90e3c 100644
--- a/msg_sender/msg_sender.h
+++ b/msg_sender/msg_sender.h
@@ -1,17 +1,22 @@
-#ifndef _MSG_SENDER_H_
+#ifndef __MSG_SENDER_H_
#define __MSG_SENDER_H_
/* inits main loop of message sender. callbacks are initialized in this function */
void msg_main_loop(char *sender, char *receiver);
/* starts infinite loop */
-void run_irc();
+void msg_run_ircm();
/* stops infinite loop * loop */
-void stop_irc();
+void msg_stop_irc();
/* input for message which has to be sent */
void set_txt_msg(char *msg);
+/* returns received message */
+char* get_txt_msg();
+
+
+
#endif