9b816604280fb18b6c4054845aaeaeb4ea0ab55b
[auf-poste-client.git] / lucid / auf-thunderbird-hack / auf-thunderbird-hack.c
1 #define _GNU_SOURCE
2 // #include <stdio.h>
3 #include <string.h>
4 #include <dlfcn.h>
5
6 #define GCONFLIB "libgconf-2.so.4"
7
8 char* gconf_client_get_string(void* client, const char* key, void** err)
9 {
10 static char* (*original_gconf_client_get_string)(void*, const char*, void**) = NULL;
11 char *result;
12
13 // printf("entering preloaded gconf...\n");
14 // printf("key=[%s]\n", key ? key : "NULL");
15
16 if (strchr(key, '+')) return NULL;
17
18 if (!original_gconf_client_get_string) {
19 void *handle = dlopen(GCONFLIB, RTLD_LAZY);
20 // printf("handle=[0x%08lx]\n", (long)handle);
21 if (!handle) return NULL;
22 original_gconf_client_get_string = dlsym(handle, "gconf_client_get_string");
23 // printf("original_gconf_client_get_string=[0x%08lx]\n", (long)original_gconf_client_get_string);
24 }
25 result = original_gconf_client_get_string(client, key, err);
26
27 // printf("result=[%s]\n", result ? result : "NULL");
28 // printf("exiting preloaded gconf...\n");
29 return result;
30 }