Compare commits

..

No commits in common. "2d3a9c96ce6976ff3fd8f0c421036b7aa655fb37" and "561d3a681d264404ed7c43dc9556d81f04938a4e" have entirely different histories.

7 changed files with 17 additions and 41 deletions

View file

@ -1,6 +1,7 @@
.POSIX: .POSIX:
.SUFFIXES: .SUFFIXES:
CC = cc
VERSION = 1.0 VERSION = 1.0
SERVER = zmr SERVER = zmr
CLIENT = zen CLIENT = zen
@ -10,24 +11,24 @@ PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1 MANDIR = $(PREFIX)/share/man/man1
LDFLAGS != pkg-config --libs libsodium libnotify ncurses sqlite3 # Flags
INCFLAGS != pkg-config --cflags libsodium libnotify ncurses sqlite3 LDFLAGS = $(shell pkg-config --libs libsodium libnotify ncurses sqlite3)
CFLAGS = -Os -mtune=native -march=native -pipe -s -std=c99 -Wno-pointer-sign -pedantic -Wall -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 $(INCFLAGS) -lpthread -lluft -L. CFLAGS = -O3 -mtune=native -march=native -pipe -s -std=c99 -Wno-pointer-sign -pedantic -Wall -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 $(shell pkg-config --cflags libsodium libnotify ncurses sqlite3) -lpthread
SERVERSRC != find src/zmr -name "*.c" SERVERSRC = src/zmr/*.c
CLIENTSRC != find src/zen -name "*.c" CLIENTSRC = src/zen/*.c
LIBSRC != find src/lib -name "*.c" LIBSRC = src/lib/*.c
INCLUDE = include INCLUDE = -Iinclude/
all: $(SERVER) $(CLIENT) all: $(SERVER) $(CLIENT)
$(SERVER): $(SERVERSRC) $(LIBSRC) $(SERVER): $(SERVERSRC) $(LIBSRC)
mkdir -p bin mkdir -p bin
$(CC) $(SERVERSRC) $(LIBSRC) -I$(INCLUDE) -I. -o bin/$@ $(CFLAGS) $(LDFLAGS) $(CC) $(SERVERSRC) $(LIBSRC) $(INCLUDE) -o bin/$@ $(CFLAGS) $(LDFLAGS)
$(CLIENT): $(CLIENTSRC) $(LIBSRC) $(CLIENT): $(CLIENTSRC) $(LIBSRC)
mkdir -p bin mkdir -p bin
$(CC) $(CLIENTSRC) $(LIBSRC) -I$(INCLUDE) -I. -o bin/$@ $(CFLAGS) $(LDFLAGS) $(CC) $(CLIENTSRC) $(LIBSRC) $(INCLUDE) -o bin/$@ $(CFLAGS) $(LDFLAGS)
dist: dist:
mkdir -p $(TARGET)-$(VERSION) mkdir -p $(TARGET)-$(VERSION)
@ -47,11 +48,11 @@ install: $(TARGET)
chmod 644 $(DESTDIR)$(MANDIR)/$(MANPAGE) chmod 644 $(DESTDIR)$(MANDIR)/$(MANPAGE)
uninstall: uninstall:
rm $(DESTDIR)$(BINDIR)/$(SERVER) $(RM) $(DESTDIR)$(BINDIR)/$(SERVER)
rm $(DESTDIR)$(BINDIR)/$(CLIENT) $(RM) $(DESTDIR)$(BINDIR)/$(CLIENT)
rm $(DESTDIR)$(MANDIR)/$(MANPAGE) $(RM) $(DESTDIR)$(MANDIR)/$(MANPAGE)
clean: clean:
rm $(SERVER) $(CLIENT) $(RM) $(SERVER) $(CLIENT)
.PHONY: all dist install uninstall clean .PHONY: all dist install uninstall clean

View file

@ -4,10 +4,8 @@
#define MAX_CLIENTS_PER_THREAD 1024 #define MAX_CLIENTS_PER_THREAD 1024
/* Client */ /* Client */
#define DOMAIN "zsm.night0721.xyz" #define DOMAIN "127.0.0.1"
#define USERNAME "night" /* #define USERNAME "night" */
#define USE_LUFT
/* UI */ /* UI */
#define PANEL_HEIGHT 1 #define PANEL_HEIGHT 1

View file

@ -2,14 +2,7 @@
#define NOTIFICATION_H #define NOTIFICATION_H
#include <stdint.h> #include <stdint.h>
#include "config.h"
#ifdef USE_LUFT
#include "luft.h"
#else
#include <libnotify/notify.h> #include <libnotify/notify.h>
#endif
void send_notification(uint8_t *author, uint8_t *content); void send_notification(uint8_t *author, uint8_t *content);

6
luft.h
View file

@ -1,6 +0,0 @@
#ifndef LUFT_H_
#define LUFT_H_
void render_notification(char **texts, int num_of_lines);
#endif

View file

@ -1,15 +1,8 @@
#include "util.h" #include "util.h"
#include "zen/notification.h" #include "zen/notification.h"
#include "config.h"
void send_notification(uint8_t *author, uint8_t *content) void send_notification(uint8_t *author, uint8_t *content)
{ {
#ifdef USE_LUFT
char *texts[3];
texts[0] = author;
texts[1] = content;
render_notification(texts, 2);
#else
NotifyNotification *notification = notify_notification_new((char *) author, NotifyNotification *notification = notify_notification_new((char *) author,
(char *) content, "dialog-information"); (char *) content, "dialog-information");
if (notification == NULL) { if (notification == NULL) {
@ -19,5 +12,4 @@ void send_notification(uint8_t *author, uint8_t *content)
write_log(LOG_ERROR, "Cannot show notifcation"); write_log(LOG_ERROR, "Cannot show notifcation");
} }
g_object_unref(G_OBJECT(notification)); g_object_unref(G_OBJECT(notification));
#endif
} }

View file

@ -142,11 +142,9 @@ int main()
} }
/* Init libnotify with app name */ /* Init libnotify with app name */
#ifndef USE_LUFT
if (notify_init("zen") < 0) { if (notify_init("zen") < 0) {
error(1, "Error initializing libnotify"); error(1, "Error initializing libnotify");
} }
#endif
int sockfd = socket(AF_INET, SOCK_STREAM, 0); int sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) { if (sockfd < 0) {

0
zsm.1
View file