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:
.SUFFIXES:
CC = cc
VERSION = 1.0
SERVER = zmr
CLIENT = zen
@ -10,24 +11,24 @@ PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
LDFLAGS != pkg-config --libs libsodium libnotify ncurses sqlite3
INCFLAGS != pkg-config --cflags 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.
# Flags
LDFLAGS = $(shell pkg-config --libs libsodium libnotify ncurses sqlite3)
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"
CLIENTSRC != find src/zen -name "*.c"
LIBSRC != find src/lib -name "*.c"
INCLUDE = include
SERVERSRC = src/zmr/*.c
CLIENTSRC = src/zen/*.c
LIBSRC = src/lib/*.c
INCLUDE = -Iinclude/
all: $(SERVER) $(CLIENT)
$(SERVER): $(SERVERSRC) $(LIBSRC)
mkdir -p bin
$(CC) $(SERVERSRC) $(LIBSRC) -I$(INCLUDE) -I. -o bin/$@ $(CFLAGS) $(LDFLAGS)
$(CC) $(SERVERSRC) $(LIBSRC) $(INCLUDE) -o bin/$@ $(CFLAGS) $(LDFLAGS)
$(CLIENT): $(CLIENTSRC) $(LIBSRC)
mkdir -p bin
$(CC) $(CLIENTSRC) $(LIBSRC) -I$(INCLUDE) -I. -o bin/$@ $(CFLAGS) $(LDFLAGS)
$(CC) $(CLIENTSRC) $(LIBSRC) $(INCLUDE) -o bin/$@ $(CFLAGS) $(LDFLAGS)
dist:
mkdir -p $(TARGET)-$(VERSION)
@ -47,11 +48,11 @@ install: $(TARGET)
chmod 644 $(DESTDIR)$(MANDIR)/$(MANPAGE)
uninstall:
rm $(DESTDIR)$(BINDIR)/$(SERVER)
rm $(DESTDIR)$(BINDIR)/$(CLIENT)
rm $(DESTDIR)$(MANDIR)/$(MANPAGE)
$(RM) $(DESTDIR)$(BINDIR)/$(SERVER)
$(RM) $(DESTDIR)$(BINDIR)/$(CLIENT)
$(RM) $(DESTDIR)$(MANDIR)/$(MANPAGE)
clean:
rm $(SERVER) $(CLIENT)
$(RM) $(SERVER) $(CLIENT)
.PHONY: all dist install uninstall clean

View file

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

View file

@ -2,14 +2,7 @@
#define NOTIFICATION_H
#include <stdint.h>
#include "config.h"
#ifdef USE_LUFT
#include "luft.h"
#else
#include <libnotify/notify.h>
#endif
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,16 +1,9 @@
#include "util.h"
#include "zen/notification.h"
#include "config.h"
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");
if (notification == NULL) {
write_log(LOG_ERROR, "Cannot create notification");
@ -19,5 +12,4 @@ void send_notification(uint8_t *author, uint8_t *content)
write_log(LOG_ERROR, "Cannot show notifcation");
}
g_object_unref(G_OBJECT(notification));
#endif
}

View file

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

0
zsm.1
View file