Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 61 lines (47 sloc) 1.564 kB
f430395 @DonKult Use stdbool instead of char.
DonKult authored
1 #include <stdbool.h>
e6a7191 @Cloudef Version 0.1 - Initial Commit
authored
2 #include <dbus/dbus.h>
3
daf912d @Cloudef Use LINE_MAX from <limits.h> in linux
authored
4 #ifdef __linux__
5 #include <limits.h>
6 #endif
7
cde465a @Cloudef change to milliseconds
authored
8 // default message delay in milliseconds
9 #define EXPIRE_DEFAULT 5000
e6a7191 @Cloudef Version 0.1 - Initial Commit
authored
10
11 // multiply requested delay by this
12 // (slow it down since only one line)
081394e @Cloudef Clean up a bit
authored
13 #define EXPIRE_MULT 2
14
15 // default command
db21637 @Cloudef change execution method, better makefile and readme changes
authored
16 #define DEFAULT_CMD "xsetroot -name '[summary] ~ [body]'"
081394e @Cloudef Clean up a bit
authored
17
18 // config dir
19 #define CFG_DIR "cow-notify"
20
21 // config file
22 #define CFG_FIL "config"
e6a7191 @Cloudef Version 0.1 - Initial Commit
authored
23
daf912d @Cloudef Use LINE_MAX from <limits.h> in linux
authored
24 // notification maximum text lengths
25 // might want to increase these, if causes problems.
26 //
27 // thought won't have problems with LINE_MAX
28 #ifdef __linux__
29 #define APP_LEN 256
30 #define SUMMARY_LEN LINE_MAX
31 #define BODY_LEN LINE_MAX
32 #else
33 #define APP_LEN 256
34 #define SUMMARY_LEN 256
35 #define BODY_LEN 256
36 #endif
37
e6a7191 @Cloudef Version 0.1 - Initial Commit
authored
38 typedef struct _notification {
0458436 @Cloudef Fix compiler warnings in str_replace
authored
39 dbus_uint32_t nid;
40 time_t started_at;
41 time_t expires_after;
42 char closed;
43
daf912d @Cloudef Use LINE_MAX from <limits.h> in linux
authored
44 char appname[APP_LEN];
45 char summary[SUMMARY_LEN];
46 char body[BODY_LEN];
0458436 @Cloudef Fix compiler warnings in str_replace
authored
47 struct _notification *next;
e6a7191 @Cloudef Version 0.1 - Initial Commit
authored
48 } notification;
49
50 // initialize notifications
64a6705 @DonKult use message dispatching instead of busy-waiting
DonKult authored
51 DBusConnection* notify_init(bool const debug_enabled);
e6a7191 @Cloudef Version 0.1 - Initial Commit
authored
52
53 // returns the first current notification into status (number of total messages in n)
64a6705 @DonKult use message dispatching instead of busy-waiting
DonKult authored
54 notification* notify_get_message(DBusConnection *dbus, int *n);
55
56 // calls the respective notify handler based on the message received
57 DBusHandlerResult notify_handle(DBusConnection *dbus, DBusMessage *msg, void *user_data);
e6a7191 @Cloudef Version 0.1 - Initial Commit
authored
58
59 // check the dbus for notifications (1=something happened, 0=nothing)
64a6705 @DonKult use message dispatching instead of busy-waiting
DonKult authored
60 bool notify_check(DBusConnection *dbus);
Something went wrong with that request. Please try again.