From: Fredrik Tolf Date: Sat, 21 Jul 2007 03:51:02 +0000 (+0200) Subject: Merge branch 'dolcon-split' X-Git-Tag: 1.0~106 X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=d05758f6eda21695e6215d60d28b9747d0b8aaa3;hp=4b9af9b0c7159f8dce5eb326211e6e099b3b34d6;p=doldaconnect.git Merge branch 'dolcon-split' Conflicts: po/sv.po --- diff --git a/ChangeLog b/ChangeLog index cccfac3..b6749d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Version 0.5: + + * Ported the Gaim plugin to Pidgin + Version 0.4: * Added a GUI configurator (called `dolconf') diff --git a/README b/README index 842b79a..4c1c2dd 100644 --- a/README +++ b/README @@ -42,7 +42,7 @@ tree: client program. * A GNOME panel applet for showing the status of current downloads in progress. - * A Gaim chat plugin for chatting in hubs and writing private + * A Gaim/Pidgin chat plugin for chatting in hubs and writing private messages (only for Gaim 2.0.0 and above). * A command-line automatic downloader written in Scheme. * A chat logger written in Scheme. @@ -50,9 +50,9 @@ tree: The GNOME applet and Gaim plugin are somewhat experimental. Both work fairly well, but they do require special care during installation, -since neither GNOME nor Gaim usually look for applets/plugins in the -directories where Dolda Connect gets installed by default. See the -files doc/INSTALL.applet and doc/INSTALL.gaim for further details. +since neither GNOME nor Gaim/Pidgin usually look for applets/plugins +in the directories where Dolda Connect gets installed by default. See +the files doc/INSTALL.applet and doc/INSTALL.gaim for further details. Installation @@ -74,5 +74,5 @@ through the e-mail address . His homepage is -This document was last updated 2007-05-02, reflecting release 0.4 of +This document was last updated 2007-07-18, reflecting release 0.5 of Dolda Connect. diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..714a850 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,59 @@ +AC_DEFUN([DOLDA_AC_GROUP], +[AC_MSG_NOTICE([ -- $1 -- ])]) + +m4_defun([_DOLDA_PKG_LOOP],[dnl +if test -z "$[]$1"; then + $2 +fi +ifelse(m4_eval([$# > 2]), 1, [_DOLDA_PKG_LOOP($1, m4_shift(m4_shift($@)))]) +]) + +# DOLDA_PKG(VARIABLE-NAME, COMMANDS...) +# +# Evaluate COMMANDS in sequence as long as ${VARIABLE-NAME} is empty + +AC_DEFUN([DOLDA_PKG],[dnl +$1="" +_DOLDA_PKG_LOOP($1, m4_shift($@)) +if test "$[]$1" != no; then $1=yes; fi +]) + +# DOLDA_CHECK_HEADER(FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND, +# [EXTRA-CFLAGS]) +# +# Augmented version of AC_CHECK_HEADER that overrides CPPFLAGS + +AC_DEFUN([DOLDA_CHECK_HEADER],[dnl +cpp_bak="$CPPFLAGS" +ifelse([$4], , , [CPPFLAGS="$CPPFLAGS $4"]) +AC_CHECK_HEADER($1, $2, $3) +CPPFLAGS="$cpp_bak" +]) + +# DOLDA_ENABLE(NAME, HELP, DEFAULT, DEPS) +# +# DEPS is a space-separated listing of required variables that must be +# `yes' + +AC_DEFUN([DOLDA_ENABLE],[dnl +AC_ARG_ENABLE([$1], [$2]) +if test "[$enable_][$1]" = yes; then + for var in [$4]; do + if test "${!var}" != yes; then + AC_MSG_ERROR([*** cannot enable $1 without $var]) + fi + done +else + ifelse([$3], yes, [dnl + [enable_][$1]=yes + for var in [$4]; do + if test "${!var}" != yes; then + [enable_][$1]=no + break + fi + done +], [dnl + [enable_][$1]=no +]) +fi +]) diff --git a/clients/gaim/.gitignore b/clients/gaim/.gitignore index 0e832af..1d2647b 100644 --- a/clients/gaim/.gitignore +++ b/clients/gaim/.gitignore @@ -1 +1,3 @@ /gstat +/gaim-dolcon.c +/purple-dolcon.c diff --git a/clients/gaim/Makefile.am b/clients/gaim/Makefile.am index f5f19b8..092aa1f 100644 --- a/clients/gaim/Makefile.am +++ b/clients/gaim/Makefile.am @@ -1,11 +1,28 @@ -plugindir = $(libdir)/gaim +gaimdir = $(libdir)/gaim +purpledir = $(libdir)/purple-2 if CLI_GAIM -plugin_LTLIBRARIES = libdolcon-gaim.la +gaim_LTLIBRARIES = libdolcon-gaim.la +endif +if CLI_PIDGIN +purple_LTLIBRARIES = libdolcon-purple.la endif libdolcon_gaim_la_SOURCES = gaim-dolcon.c +libdolcon_purple_la_SOURCES = purple-dolcon.c + +BUILT_SOURCES = gaim-dolcon.c purple-dolcon.c + +EXTRA_DIST = mksrc gp-dolcon.c + +gaim-dolcon.c purple-dolcon.c: gp-dolcon.c + target="$@"; \ + basename="$${target%-dolcon.c}"; \ + ./mksrc "$$basename" <$< >$@ -libdolcon_gaim_la_LDFLAGS=-module -avoid-version $(shell pkg-config --libs gaim glib) +libdolcon_gaim_la_LDFLAGS=-module -avoid-version @GAIM_LIBS@ libdolcon_gaim_la_LIBADD=$(top_srcdir)/lib/libdcui.la -libdolcon_gaim_la_CPPFLAGS=$(shell pkg-config --cflags gaim glib) -DGAIM_PLUGINS +libdolcon_gaim_la_CPPFLAGS=@GAIM_CFLAGS@ -DGAIM_PLUGINS +libdolcon_purple_la_LDFLAGS=-module -avoid-version @PURPLE_LIBS@ +libdolcon_purple_la_LIBADD=$(top_srcdir)/lib/libdcui.la +libdolcon_purple_la_CPPFLAGS=@PURPLE_CFLAGS@ -DPURPLE_PLUGINS diff --git a/clients/gaim/install b/clients/gaim/ginstall similarity index 100% rename from clients/gaim/install rename to clients/gaim/ginstall diff --git a/clients/gaim/gaim-dolcon.c b/clients/gaim/gp-dolcon.c similarity index 64% rename from clients/gaim/gaim-dolcon.c rename to clients/gaim/gp-dolcon.c index f220ca0..451dcc5 100644 --- a/clients/gaim/gaim-dolcon.c +++ b/clients/gaim/gp-dolcon.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -35,23 +34,23 @@ struct conndata { int fd; int readhdl, writehdl; - GaimConnection *gc; - GaimRoomlist *roomlist; + G/PCConnection *gc; + G/PCRoomlist *roomlist; }; static struct conndata *inuse = NULL; -static GaimPlugin *me; +static G/PCPlugin *me; -static void dcfdcb(struct conndata *data, int fd, GaimInputCondition condition); +static void dcfdcb(struct conndata *data, int fd, G/PCInputCondition condition); static void updatewrite(struct conndata *data) { if(dc_wantwrite()) { if(data->writehdl == -1) - data->writehdl = gaim_input_add(data->fd, GAIM_INPUT_WRITE, (void (*)(void *, int, GaimInputCondition))dcfdcb, data); + data->writehdl = G/P_input_add(data->fd, G/PU_INPUT_WRITE, (void (*)(void *, int, G/PCInputCondition))dcfdcb, data); } else { if(data->writehdl != -1) { - gaim_input_remove(data->writehdl); + G/P_input_remove(data->writehdl); data->writehdl = -1; } } @@ -62,11 +61,11 @@ static void disconnected(struct conndata *data) if(inuse == data) inuse = NULL; if(data->readhdl != -1) { - gaim_input_remove(data->readhdl); + G/P_input_remove(data->readhdl); data->readhdl = -1; } if(data->writehdl != -1) { - gaim_input_remove(data->writehdl); + G/P_input_remove(data->writehdl); data->writehdl = -1; } data->fd = -1; @@ -90,22 +89,22 @@ static int loginconv(int type, wchar_t *text, char **resp, struct conndata *data } } -static gboolean gi_chatjoincb(GaimConversation *conv, const char *user, GaimConvChatBuddyFlags flags, void *uudata) +static gboolean gi_chatjoincb(G/PCConversation *conv, const char *user, G/PCConvChatBuddyFlags flags, void *uudata) { - GaimConnection *c; + G/PCConnection *c; - if((c = gaim_conversation_get_gc(conv)) == NULL) + if((c = G/P_conversation_get_gc(conv)) == NULL) return(FALSE); if(c->prpl == me) return(TRUE); return(FALSE); } -static gboolean gi_chatleavecb(GaimConversation *conv, const char *user, const char *reason, void *uudata) +static gboolean gi_chatleavecb(G/PCConversation *conv, const char *user, const char *reason, void *uudata) { - GaimConnection *c; + G/PCConnection *c; - if((c = gaim_conversation_get_gc(conv)) == NULL) + if((c = G/P_conversation_get_gc(conv)) == NULL) return(FALSE); if(c->prpl == me) return(TRUE); @@ -114,11 +113,11 @@ static gboolean gi_chatleavecb(GaimConversation *conv, const char *user, const c static void regsigs(void) { - static GaimPlugin *regged = NULL; + static G/PCPlugin *regged = NULL; if(regged != me) { - gaim_signal_connect(gaim_conversations_get_handle(), "chat-buddy-joining", me, GAIM_CALLBACK(gi_chatjoincb), NULL); - gaim_signal_connect(gaim_conversations_get_handle(), "chat-buddy-leaving", me, GAIM_CALLBACK(gi_chatleavecb), NULL); + G/P_signal_connect(G/P_conversations_get_handle(), "chat-buddy-joining", me, G/PU_CALLBACK(gi_chatjoincb), NULL); + G/P_signal_connect(G/P_conversations_get_handle(), "chat-buddy-leaving", me, G/PU_CALLBACK(gi_chatleavecb), NULL); regged = me; } } @@ -126,13 +125,13 @@ static void regsigs(void) static void newpeercb(struct dc_fnetpeer *peer) { struct conndata *data; - GaimConversation *conv; + G/PCConversation *conv; char *buf; data = peer->fn->udata; - if((conv = gaim_find_chat(data->gc, peer->fn->id)) != NULL) { + if((conv = G/P_find_chat(data->gc, peer->fn->id)) != NULL) { buf = sprintf2("%s", icswcstombs(peer->nick, "UTF-8", NULL)); - gaim_conv_chat_add_user(GAIM_CONV_CHAT(conv), buf, NULL, GAIM_CBFLAGS_NONE, TRUE); + G/P_conv_chat_add_user(G/PU_CONV_CHAT(conv), buf, NULL, G/PU_CBFLAGS_NONE, TRUE); free(buf); } } @@ -140,13 +139,13 @@ static void newpeercb(struct dc_fnetpeer *peer) static void delpeercb(struct dc_fnetpeer *peer) { struct conndata *data; - GaimConversation *conv; + G/PCConversation *conv; char *buf; data = peer->fn->udata; - if((conv = gaim_find_chat(data->gc, peer->fn->id)) != NULL) { + if((conv = G/P_find_chat(data->gc, peer->fn->id)) != NULL) { buf = sprintf2("%s", icswcstombs(peer->nick, "UTF-8", NULL)); - gaim_conv_chat_remove_user(GAIM_CONV_CHAT(conv), buf, NULL); + G/P_conv_chat_remove_user(G/PU_CONV_CHAT(conv), buf, NULL); free(buf); } } @@ -178,25 +177,25 @@ static void logincb(int err, wchar_t *reason, struct conndata *data) if(err != DC_LOGIN_ERR_SUCCESS) { dc_disconnect(); disconnected(data); - gaim_connection_error(data->gc, "Invalid login"); + G/P_connection_error(data->gc, "Invalid login"); return; } - gaim_connection_set_state(data->gc, GAIM_CONNECTED); + G/P_connection_set_state(data->gc, G/PU_CONNECTED); dc_queuecmd(NULL, NULL, L"notify", L"fn:chat", L"on", L"fn:act", L"on", L"fn:peer", L"on", NULL); dc_getfnlistasync((void (*)(int, void *))getfnlistcb, data); } -static void dcfdcb(struct conndata *data, int fd, GaimInputCondition condition) +static void dcfdcb(struct conndata *data, int fd, G/PCInputCondition condition) { struct dc_response *resp; struct dc_intresp *ires; struct dc_fnetnode *fn; - GaimConversation *conv; + G/PCConversation *conv; char *peer, *msg; - if(((condition & GAIM_INPUT_READ) && dc_handleread()) || ((condition & GAIM_INPUT_WRITE) && dc_handlewrite())) { + if(((condition & G/PU_INPUT_READ) && dc_handleread()) || ((condition & G/PU_INPUT_WRITE) && dc_handlewrite())) { disconnected(data); - gaim_connection_error(data->gc, "Server has disconnected"); + G/P_connection_error(data->gc, "Server has disconnected"); return; } while((resp = dc_getresp()) != NULL) { @@ -204,15 +203,15 @@ static void dcfdcb(struct conndata *data, int fd, GaimInputCondition condition) if(resp->code != 201) { dc_disconnect(); disconnected(data); - gaim_connection_error(data->gc, "Server refused connection"); + G/P_connection_error(data->gc, "Server refused connection"); return; } else if(dc_checkprotocol(resp, DC_LATEST)) { dc_disconnect(); disconnected(data); - gaim_connection_error(data->gc, "Server protocol revision mismatch"); + G/P_connection_error(data->gc, "Server protocol revision mismatch"); return; } else { - gaim_connection_update_progress(data->gc, "Authenticating", 2, 3); + G/P_connection_update_progress(data->gc, "Authenticating", 2, 3); dc_loginasync(NULL, 1, (int (*)(int, wchar_t *, char **, void *))loginconv, (void (*)(int, wchar_t *, void *))logincb, data); } } else if(!wcscmp(resp->cmdname, L".notify")) { @@ -226,18 +225,18 @@ static void dcfdcb(struct conndata *data, int fd, GaimInputCondition condition) if(ires->argv[1].val.num) { /* XXX: Handle different rooms */ - if((conv = gaim_find_chat(data->gc, fn->id)) != NULL) + if((conv = G/P_find_chat(data->gc, fn->id)) != NULL) { peer = icwcstombs(ires->argv[3].val.str, "UTF-8"); msg = g_markup_escape_text(icswcstombs(ires->argv[4].val.str, "UTF-8", NULL), -1); - serv_got_chat_in(data->gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), peer, 0, msg, time(NULL)); + serv_got_chat_in(data->gc, G/P_conv_chat_get_id(G/PU_CONV_CHAT(conv)), peer, 0, msg, time(NULL)); g_free(msg); free(peer); } } else { peer = sprintf2("%i:%s", fn->id, icswcstombs(ires->argv[3].val.str, "UTF-8", NULL)); msg = g_markup_escape_text(icswcstombs(ires->argv[4].val.str, "UTF-8", NULL), -1); - if(!gaim_account_get_bool(data->gc->account, "represspm", FALSE) || (gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, peer, data->gc->account) != NULL)) + if(!G/P_account_get_bool(data->gc->account, "represspm", FALSE) || (G/P_find_conversation_with_account(G/PU_CONV_TYPE_IM, peer, data->gc->account) != NULL)) serv_got_im(data->gc, peer, msg, 0, time(NULL)); g_free(msg); free(peer); @@ -272,7 +271,7 @@ static void dcfdcb(struct conndata *data, int fd, GaimInputCondition condition) updatewrite(data); } -static int gi_sendchat(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags) +static int gi_sendchat(G/PCConnection *gc, int id, const char *what, G/PCMessageFlags flags) { struct conndata *data; struct dc_fnetnode *fn; @@ -290,7 +289,7 @@ static int gi_sendchat(GaimConnection *gc, int id, const char *what, GaimMessage return(0); } -static int gi_sendim(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags) +static int gi_sendim(G/PCConnection *gc, const char *who, const char *what, G/PCMessageFlags flags) { struct conndata *data; struct dc_fnetnode *fn; @@ -331,34 +330,34 @@ static int gi_sendim(GaimConnection *gc, const char *who, const char *what, Gaim return(1); } -static const char *gi_listicon(GaimAccount *a, GaimBuddy *b) +static const char *gi_listicon(G/PCAccount *a, G/PCBuddy *b) { return("dolcon"); } -static char *gi_statustext(GaimBuddy *b) +static char *gi_statustext(G/PCBuddy *b) { - GaimPresence *p; + G/PCPresence *p; - p = gaim_buddy_get_presence(b); - if (gaim_presence_is_online(p) && !gaim_presence_is_available(p)) + p = G/P_buddy_get_presence(b); + if (G/P_presence_is_online(p) && !G/P_presence_is_available(p)) return(g_strdup("Away")); return(NULL); } -static void gi_tiptext(GaimBuddy *b, GaimNotifyUserInfo *inf, gboolean full) +static void gi_tiptext(G/PCBuddy *b, G/PCNotifyUserInfo *inf, gboolean full) { /* Nothing for now */ } -static GList *gi_statustypes(GaimAccount *act) +static GList *gi_statustypes(G/PCAccount *act) { GList *ret; ret = NULL; - ret = g_list_append(ret, gaim_status_type_new(GAIM_STATUS_AVAILABLE, "avail", NULL, TRUE)); - ret = g_list_append(ret, gaim_status_type_new(GAIM_STATUS_AWAY, "away", NULL, TRUE)); /* Coming up in ADC */ - ret = g_list_append(ret, gaim_status_type_new(GAIM_STATUS_OFFLINE, "offline", NULL, TRUE)); + ret = g_list_append(ret, G/P_status_type_new(G/PU_STATUS_AVAILABLE, "avail", NULL, TRUE)); + ret = g_list_append(ret, G/P_status_type_new(G/PU_STATUS_AWAY, "away", NULL, TRUE)); /* Coming up in ADC */ + ret = g_list_append(ret, G/P_status_type_new(G/PU_STATUS_OFFLINE, "offline", NULL, TRUE)); return(ret); } @@ -376,42 +375,42 @@ static struct conndata *newconndata(void) static void freeconndata(struct conndata *data) { if(data->roomlist != NULL) - gaim_roomlist_unref(data->roomlist); + G/P_roomlist_unref(data->roomlist); if(inuse == data) inuse = NULL; if(data->readhdl != -1) - gaim_input_remove(data->readhdl); + G/P_input_remove(data->readhdl); if(data->writehdl != -1) - gaim_input_remove(data->writehdl); + G/P_input_remove(data->writehdl); if(data->fd >= 0) dc_disconnect(); free(data); } -static void gi_login(GaimAccount *act) +static void gi_login(G/PCAccount *act) { - GaimConnection *gc; + G/PCConnection *gc; struct conndata *data; - gc = gaim_account_get_connection(act); + gc = G/P_account_get_connection(act); gc->proto_data = data = newconndata(); data->gc = gc; if(inuse != NULL) { - gaim_connection_error(gc, "Dolda Connect library already in use"); + G/P_connection_error(gc, "Dolda Connect library already in use"); return; } - gaim_connection_update_progress(gc, "Connecting", 1, 3); - if((data->fd = dc_connect((char *)gaim_account_get_string(act, "server", "localhost"))) < 0) + G/P_connection_update_progress(gc, "Connecting", 1, 3); + if((data->fd = dc_connect((char *)G/P_account_get_string(act, "server", "localhost"))) < 0) { - gaim_connection_error(gc, "Could not connect to server"); + G/P_connection_error(gc, "Could not connect to server"); return; } - data->readhdl = gaim_input_add(data->fd, GAIM_INPUT_READ, (void (*)(void *, int, GaimInputCondition))dcfdcb, data); + data->readhdl = G/P_input_add(data->fd, G/PU_INPUT_READ, (void (*)(void *, int, G/PCInputCondition))dcfdcb, data); updatewrite(data); inuse = data; } -static void gi_close(GaimConnection *gc) +static void gi_close(G/PCConnection *gc) { struct conndata *data; @@ -419,57 +418,57 @@ static void gi_close(GaimConnection *gc) freeconndata(data); } -static GaimRoomlist *gi_getlist(GaimConnection *gc) +static G/PCRoomlist *gi_getlist(G/PCConnection *gc) { struct conndata *data; GList *fields; - GaimRoomlist *rl; - GaimRoomlistField *f; - GaimRoomlistRoom *r; + G/PCRoomlist *rl; + G/PCRoomlistField *f; + G/PCRoomlistRoom *r; struct dc_fnetnode *fn; data = gc->proto_data; if(data->roomlist != NULL) - gaim_roomlist_unref(data->roomlist); - data->roomlist = rl = gaim_roomlist_new(gaim_connection_get_account(gc)); + G/P_roomlist_unref(data->roomlist); + data->roomlist = rl = G/P_roomlist_new(G/P_connection_get_account(gc)); fields = NULL; - f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_INT, "", "id", TRUE); + f = G/P_roomlist_field_new(G/PU_ROOMLIST_FIELD_INT, "", "id", TRUE); fields = g_list_append(fields, f); - f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_INT, "Users", "users", FALSE); + f = G/P_roomlist_field_new(G/PU_ROOMLIST_FIELD_INT, "Users", "users", FALSE); fields = g_list_append(fields, f); - gaim_roomlist_set_fields(rl, fields); + G/P_roomlist_set_fields(rl, fields); for(fn = dc_fnetnodes; fn != NULL; fn = fn->next) { if(fn->state != DC_FNN_STATE_EST) continue; - r = gaim_roomlist_room_new(GAIM_ROOMLIST_ROOMTYPE_ROOM, icswcstombs(fn->name, "UTF-8", NULL), NULL); - gaim_roomlist_room_add_field(rl, r, GINT_TO_POINTER(fn->id)); - gaim_roomlist_room_add_field(rl, r, GINT_TO_POINTER(fn->numusers)); - gaim_roomlist_room_add(rl, r); + r = G/P_roomlist_room_new(G/PU_ROOMLIST_ROOMTYPE_ROOM, icswcstombs(fn->name, "UTF-8", NULL), NULL); + G/P_roomlist_room_add_field(rl, r, GINT_TO_POINTER(fn->id)); + G/P_roomlist_room_add_field(rl, r, GINT_TO_POINTER(fn->numusers)); + G/P_roomlist_room_add(rl, r); } - gaim_roomlist_set_in_progress(rl, FALSE); + G/P_roomlist_set_in_progress(rl, FALSE); return(rl); } -static void gi_cancelgetlist(GaimRoomlist *rl) +static void gi_cancelgetlist(G/PCRoomlist *rl) { - GaimConnection *gc; + G/PCConnection *gc; struct conndata *data; - if((gc = gaim_account_get_connection(rl->account)) == NULL) + if((gc = G/P_account_get_connection(rl->account)) == NULL) return; data = gc->proto_data; - gaim_roomlist_set_in_progress(rl, FALSE); + G/P_roomlist_set_in_progress(rl, FALSE); if(data->roomlist == rl) { data->roomlist = NULL; - gaim_roomlist_unref(rl); + G/P_roomlist_unref(rl); } } -static void gi_joinchat(GaimConnection *gc, GHashTable *chatdata) +static void gi_joinchat(G/PCConnection *gc, GHashTable *chatdata) { struct conndata *data; struct dc_fnetnode *fn; - GaimConversation *conv; + G/PCConversation *conv; struct dc_fnetpeer *peer; char *buf; GList *ul, *fl, *c; @@ -478,7 +477,7 @@ static void gi_joinchat(GaimConnection *gc, GHashTable *chatdata) data = gc->proto_data; if((fn = dc_findfnetnode(GPOINTER_TO_INT(g_hash_table_lookup(chatdata, "id")))) == NULL) return; - if(gaim_find_chat(gc, fn->id) != NULL) + if(G/P_find_chat(gc, fn->id) != NULL) return; conv = serv_got_joined_chat(data->gc, fn->id, icswcstombs(fn->name, "UTF-8", NULL)); ul = fl = NULL; @@ -487,19 +486,19 @@ static void gi_joinchat(GaimConnection *gc, GHashTable *chatdata) ul = g_list_append(ul, buf); fl = g_list_append(fl, GINT_TO_POINTER(0)); } - gaim_conv_chat_add_users(GAIM_CONV_CHAT(conv), ul, NULL, fl, FALSE); + G/P_conv_chat_add_users(G/PU_CONV_CHAT(conv), ul, NULL, fl, FALSE); for(c = ul; c != NULL; c = c->next) free(c->data); g_list_free(ul); g_list_free(fl); } -static char *gi_cbname(GaimConnection *gc, int id, const char *who) +static char *gi_cbname(G/PCConnection *gc, int id, const char *who) { return(g_strdup_printf("%i:%s", id, who)); } -static GaimPluginProtocolInfo protinfo = { +static G/PCPluginProtocolInfo protinfo = { .options = OPT_PROTO_PASSWORD_OPTIONAL, .icon_spec = NO_BUDDY_ICONS, .list_icon = gi_listicon, @@ -516,32 +515,32 @@ static GaimPluginProtocolInfo protinfo = { .get_cb_real_name = gi_cbname, }; -static GaimPluginInfo info = { - .magic = GAIM_PLUGIN_MAGIC, - .major_version = GAIM_MAJOR_VERSION, - .minor_version = GAIM_MINOR_VERSION, - .type = GAIM_PLUGIN_PROTOCOL, - .priority = GAIM_PRIORITY_DEFAULT, +static G/PCPluginInfo info = { + .magic = G/PU_PLUGIN_MAGIC, + .major_version = G/PU_MAJOR_VERSION, + .minor_version = G/PU_MINOR_VERSION, + .type = G/PU_PLUGIN_PROTOCOL, + .priority = G/PU_PRIORITY_DEFAULT, .id = "prpl-dolcon", .name = "Dolda Connect", .version = VERSION, .summary = "Dolda Connect chat plugin", - .description = "Allows Gaim to be used as a chat user interface for the Dolda Connect daemon", + .description = "Allows G/PC to be used as a chat user interface for the Dolda Connect daemon", .author = "Fredrik Tolf ", .homepage = "http://www.dolda2000.com/~fredrik/doldaconnect/", .extra_info = &protinfo }; -static void init(GaimPlugin *pl) +static void init(G/PCPlugin *pl) { - GaimAccountOption *opt; + G/PCAccountOption *opt; dc_init(); - opt = gaim_account_option_string_new("Server", "server", ""); + opt = G/P_account_option_string_new("Server", "server", ""); protinfo.protocol_options = g_list_append(protinfo.protocol_options, opt); - opt = gaim_account_option_bool_new("Do not pop up private messages automatically", "represspm", FALSE); + opt = G/P_account_option_bool_new("Do not pop up private messages automatically", "represspm", FALSE); protinfo.protocol_options = g_list_append(protinfo.protocol_options, opt); me = pl; } -GAIM_INIT_PLUGIN(dolcon, init, info); +G/PU_INIT_PLUGIN(dolcon, init, info); diff --git a/clients/gaim/mksrc b/clients/gaim/mksrc new file mode 100755 index 0000000..fc986cd --- /dev/null +++ b/clients/gaim/mksrc @@ -0,0 +1,10 @@ +#!/usr/bin/perl -w + +defined ($bn = $ARGV[0]) || die "no basename given"; + +while() { + s,G/PC,\u$bn,g; + s,G/PU,\U$bn\E,g; + s,G/P,$bn,g; + print; +} diff --git a/clients/gaim/pinstall b/clients/gaim/pinstall new file mode 100755 index 0000000..bfb3957 --- /dev/null +++ b/clients/gaim/pinstall @@ -0,0 +1,5 @@ +#!/bin/sh +make install DESTDIR=$PWD/inst +rm -f $HOME/.purple/plugins/libdolcon-purple.so +cp inst/usr/local/lib/purple-2/libdolcon-purple.so $HOME/.purple/plugins +rm -rf inst diff --git a/clients/gnome-trans-applet/Makefile.am b/clients/gnome-trans-applet/Makefile.am index cf46b3f..3b24d8d 100644 --- a/clients/gnome-trans-applet/Makefile.am +++ b/clients/gnome-trans-applet/Makefile.am @@ -10,9 +10,9 @@ dolcon_trans_applet_SOURCES= dolcon-trans-applet.c \ conduit.h localedir=$(datadir)/locale -dolcon_trans_applet_LDFLAGS=$(shell pkg-config --libs libpanelapplet-2.0) +dolcon_trans_applet_LDFLAGS=@PANELAPPLET_LIBS@ dolcon_trans_applet_LDADD=$(top_srcdir)/lib/libdcui.la -dolcon_trans_applet_CPPFLAGS=$(shell pkg-config --cflags libpanelapplet-2.0) -DLOCALEDIR=\"$(localedir)\" +dolcon_trans_applet_CPPFLAGS=@PANELAPPLET_CFLAGS@ -DLOCALEDIR=\"$(localedir)\" BUILT_SOURCES=Dolcon_Transferapplet_Factory.server diff --git a/clients/gtk2/Makefile.am b/clients/gtk2/Makefile.am index 3dd77a3..50efcd7 100644 --- a/clients/gtk2/Makefile.am +++ b/clients/gtk2/Makefile.am @@ -18,7 +18,7 @@ BUILT_SOURCES= mainwnd.gtk inpdialog.gtk pref.gtk reslist.gtk main.c: mainwnd.gtk inpdialog.gtk pref.gtk reslist.gtk localedir=$(datadir)/locale -dolcon_LDFLAGS= @GTK2_LDADD@ @LIBXML_LDADD@ +dolcon_LDFLAGS= @GTK2_LIBS@ @LIBXML_LIBS@ dolcon_LDADD=$(top_srcdir)/lib/libdcui.la dolcon_CPPFLAGS=@GTK2_CFLAGS@ @LIBXML_CFLAGS@ \ -DLOCALEDIR=\"$(localedir)\" diff --git a/config/util/Makefile.am b/config/util/Makefile.am index 732cdc2..6f84a4e 100644 --- a/config/util/Makefile.am +++ b/config/util/Makefile.am @@ -17,7 +17,7 @@ baseconv_LDADD=$(top_srcdir)/common/libcommon.a dolconf.c: dolconf-assistant.desc dolconf-wnd.desc localedir=$(datadir)/locale -dolconf_LDFLAGS= @GTK2_LDADD@ +dolconf_LDFLAGS= @GTK2_LIBS@ dolconf_CPPFLAGS= @GTK2_CFLAGS@ \ -DLOCALEDIR=\"$(localedir)\" dolconf_LDADD= $(top_srcdir)/common/libcommon.a $(top_srcdir)/lib/libdcui.la diff --git a/configure.in b/configure.in index 087f0cf..6e4d737 100644 --- a/configure.in +++ b/configure.in @@ -2,19 +2,27 @@ AC_INIT(daemon/main.c) AM_INIT_AUTOMAKE([doldaconnect], [0.5]) AM_CONFIG_HEADER(config.h) +DOLDA_AC_GROUP([Checking build chain]) + AC_PROG_CC AC_PROG_CC_C_O AM_PROG_CC_C_O AC_PROG_INSTALL +DOLDA_AC_GROUP([Configuring gettext]) + AM_GNU_GETTEXT_VERSION(0.12.1) AM_GNU_GETTEXT([external]) +DOLDA_AC_GROUP([Configuring libtool]) + # Temporary hack to make libtool not check for g++ or g77 m4_defun([_LT_AC_LANG_CXX_CONFIG], true) m4_defun([_LT_AC_LANG_F77_CONFIG], true) AC_PROG_LIBTOOL +DOLDA_AC_GROUP([Checking required libraries]) + AC_CHECK_LIB(pam, pam_start, , AC_MSG_ERROR([*** must have PAM])) AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** must have zlib])) AC_CHECK_LIB(bz2, BZ2_bzWriteOpen, , AC_MSG_ERROR([*** must have bzlib])) @@ -23,143 +31,99 @@ AC_CHECK_LIB(gdbm, gdbm_open, , AC_MSG_ERROR([*** must have gdbm])) extlibs= experimental=no -AC_CHECK_PROG([PKG_CONFIG], pkg-config, yes, no) +DOLDA_AC_GROUP([Checking optional libraries]) # Gtk 2.0 check AC_ARG_WITH(gtk2, [ --with-gtk2 Enable GTK2 support]) -if test "$with_gtk2" = no; then - HAS_GTK2=no -fi -if test "$HAS_GTK2" != no; then - if test "$PKG_CONFIG" = yes; then - AC_MSG_CHECKING([for GTK2 package information]) - if pkg-config --modversion gtk+-2.0 >/dev/null 2>&1; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - HAS_GTK2=no - fi - GTK2_LDADD="`pkg-config --libs gtk+-2.0`" - GTK2_CFLAGS="`pkg-config --cflags gtk+-2.0`" - if test "$HAS_GTK2" != no; then - AC_CHECK_LIB(gtk-x11-2.0, gtk_init, [HAS_GTK2=yes], [HAS_GTK2=no], "$GTK2_LDADD") - fi - if test "$HAS_GTK2" = yes; then - cpp_bak="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $GTK2_CFLAGS" - AC_CHECK_HEADER(gtk/gtk.h, [], [HAS_GTK2=no]) - CPPFLAGS="$cpp_bak" - fi - else - HAS_GTK2=no - fi -fi +DOLDA_PKG([HAS_GTK2], [test "$with_gtk2" = no && HAS_GTK2=no], + [PKG_CHECK_MODULES(GTK2, gtk+-2.0, [], [HAS_GTK2=no])], + [AC_CHECK_LIB(gtk-x11-2.0, gtk_init, [:], [HAS_GTK2=no], $GTK2_LIBS)], + [DOLDA_CHECK_HEADER(gtk/gtk.h, [], [HAS_GTK2=no], $GTK2_CFLAGS)]) if test "$with_gtk2" = yes -a "$HAS_GTK2" = no; then AC_MSG_ERROR([*** cannot find GTK2 on this system]) fi -AC_SUBST([GTK2_LDADD GTK2_CFLAGS]) # libxml2 check -AC_MSG_CHECKING([for libxml2 package information]) -if test "$PKG_CONFIG" = yes; then - if pkg-config --modversion libxml-2.0 >/dev/null 2>&1; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - HAS_LIBXML=no - fi - LIBXML_LDADD="`pkg-config --libs libxml-2.0`" - LIBXML_CFLAGS="`pkg-config --cflags libxml-2.0`" - if test "$HAS_LIBXML" != no; then - AC_CHECK_LIB(xml2, xmlReadFile, [HAS_LIBXML=yes], [HAS_LIBXML=no], "$LIBXML_LDADD") - fi -else - AC_MSG_RESULT(no) - HAS_LIBXML=no +AC_ARG_WITH(libxml2, [ --with-libxml2 Enable libxml2 support]) +DOLDA_PKG([HAS_LIBXML], [test "$with_libxml2" = no && HAS_LIBXML=no], + [PKG_CHECK_MODULES(LIBXML, libxml-2.0, [], [HAS_LIBXML=no])], + [AC_CHECK_LIB(xml2, xmlReadFile, [:], [HAS_LIBXML=no], $LIBXML_LIBS)], + [DOLDA_CHECK_HEADER(libxml/parser.h, [], [HAS_LIBXML=no], $LIBXML_CFLAGS)]) +if test "$with_libxml" = yes -a "$HAS_LIBXML" = no; then + AC_MSG_ERROR([*** cannot find libxml2 on this system]) fi -AC_SUBST([LIBXML_LDADD LIBXML_CFLAGS]) # libnotify check -AC_MSG_CHECKING([for libnotify package information]) -if test "$PKG_CONFIG" = yes; then - if pkg-config --modversion libnotify >/dev/null 2>&1; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - HAS_LIBNOTIFY=no - fi -else - AC_MSG_RESULT(no) - HAS_LIBNOTIFY=no -fi -if test "$HAS_LIBNOTIFY" != no; then - AC_CHECK_LIB(notify, notify_init, [HAS_LIBNOTIFY=yes], [HAS_LIBNOTIFY=no], `pkg-config --libs libnotify`) +AC_ARG_WITH(libnotify, [ --with-libnotify Enable libnotify support]) +DOLDA_PKG([HAS_LIBNOTIFY], [test "$with_libnotify" = no && HAS_LIBNOTIFY=no], + [PKG_CHECK_MODULES(LIBNOTIFY, libnotify, [], [HAS_LIBNOTIFY=no])], + [AC_CHECK_LIB(notify, notify_init, [:], [HAS_LIBNOTIFY=no], $LIBNOTIFY_LIBS)]) +if test "$with_libnotify" = yes -a "$HAS_LIBNOTIFY" = no; then + AC_MSG_ERROR([*** cannot find libnotify on this system]) fi +# libpanelapplet check +DOLDA_PKG([HAS_LIBPANELAPPLET], [PKG_CHECK_MODULES(PANELAPPLET, libpanelapplet-2.0, [], [HAS_LIBPANELAPPLET=no])]) + +# Gaim/Pidgin check +DOLDA_PKG([HAS_LIBGAIM], [PKG_CHECK_MODULES(GAIM, gaim, [], [HAS_LIBGAIM=no])], + [DOLDA_CHECK_HEADER(plugin.h, [], [HAS_LIBGAIM=no], $GAIM_CFLAGS)]) +DOLDA_PKG([HAS_LIBPURPLE], [PKG_CHECK_MODULES(PURPLE, purple, [], [HAS_LIBPURPLE=no])], + [DOLDA_CHECK_HEADER(plugin.h, [], [HAS_LIBPURPLE=no], $PURPLE_CFLAGS)]) + # Gtk GUI check -gtk2ui_msg=No -AC_ARG_ENABLE(gtk2ui, [ --enable-gtk2ui Enable the GTK2 user interface]) -if test "$enable_gtk2ui" = yes; then - if test "$HAS_GTK2" = no; then - AC_MSG_ERROR([*** cannot build the GTK2 UI without a GTK2 library]) - fi - if test "$HAS_LIBXML" = no; then - AC_MSG_ERROR([*** the GTK2 UI needs libxml2]) - fi -fi -if test "$enable_gtk2ui" != no -a "$HAS_GTK2" = yes -a "$HAS_LIBXML" = yes; then - gtk2ui_msg=Yes -fi -AM_CONDITIONAL(CLI_GTK2, test "$gtk2ui_msg" = Yes) +DOLDA_ENABLE(gtk2ui, [ --enable-gtk2ui Enable the GTK2 user interface], yes, + [HAS_GTK2 HAS_LIBXML]) +AM_CONDITIONAL(CLI_GTK2, test "$enable_gtk2ui" = yes) # Dolconf check -dolconf_msg=No -AC_ARG_ENABLE(dolconf, [ --enable-dolconf Build the configuration helper]) -if test "$enable_dolconf" = yes -a "$HAS_GTK2" = no; then - AC_MSG_ERROR([*** cannot build dolconf without GTK2]) -fi -if test "$enable_dolconf" != no -a "$HAS_GTK2" = yes; then - dolconf_msg=Yes -fi -AM_CONDITIONAL(DOLCONF, test "$dolconf_msg" = Yes) +DOLDA_ENABLE(dolconf, [ --enable-dolconf Build the configuration helper], yes, + [HAS_GTK2]) +AM_CONDITIONAL(DOLCONF, test "$enable_dolconf" = yes) # Gtk progress bar check -gtk2pbar_msg=No AH_TEMPLATE(ENABLE_GTK2PBAR, [define to compile GTK2 progress bars (experimental)]) -AC_ARG_ENABLE(gtk2pbar, [ --enable-gtk2pbar Enable GTK2 progress bars (experimental)]) +DOLDA_ENABLE(gtk2pbar, [ --enable-gtk2pbar Enable GTK2 progress bars (experimental)], no, + [HAS_GTK2 enable_gtk2ui]) if test "$enable_gtk2pbar" = yes; then - if test "$HAS_GTK2" = no; then - AC_MSG_ERROR([*** cannot build GTK2 progress bars without GTK2]) - fi experimental=yes - gtk2pbar_msg=Yes AC_DEFINE(ENABLE_GTK2PBAR) fi # Gnome applet check -gnometrapplet_msg=No -AC_ARG_ENABLE(gnomeapplet, [ --enable-gnomeapplet Enable GNOME transfer applet (experimental)]) +DOLDA_ENABLE(gnomeapplet, [ --enable-gnomeapplet Enable GNOME transfer applet (experimental)], no, + [HAS_LIBPANELAPPLET]) if test "$enable_gnomeapplet" = yes; then experimental=yes - gnometrapplet_msg=Yes fi -AM_CONDITIONAL(CLI_GNOMEAPPLET, test "$gnometrapplet_msg" = Yes) +AM_CONDITIONAL(CLI_GNOMEAPPLET, test "$enable_gnomeapplet" = yes) # Gaim plugin check -gaimplugin_msg=No -AC_ARG_ENABLE(gaimplugin, [ --enable-gaimplugin Enable GNOME transfer applet (experimental)]) +gaimplugin_msg= +DOLDA_ENABLE(gaimplugin, [ --enable-gaimplugin Enable Gaim chat plugin (experimental)], no, + [HAS_LIBGAIM]) if test "$enable_gaimplugin" = yes; then experimental=yes - gaimplugin_msg=Yes + gaimplugin_msg="Gaim $gaimplugin_msg" +fi +AM_CONDITIONAL(CLI_GAIM, test "$enable_gaimplugin" = yes) +DOLDA_ENABLE(pidginplugin, [ --enable-pidginplugin Enable Pidgin chat plugin (experimental)], no, + [HAS_LIBPURPLE]) +if test "$enable_pidginplugin" = yes; then + experimental=yes + gaimplugin_msg="Pidgin $gaimplugin_msg" +fi +AM_CONDITIONAL(CLI_PIDGIN, test "$enable_pidginplugin" = yes) +if test -z "$gaimplugin_msg"; then + gaimplugin_msg=none fi -AM_CONDITIONAL(CLI_GAIM, test "$gaimplugin_msg" = Yes) # Guile check (XXX: Shouldn't have to be enabled manually) -guile_msg=No +guile_msg=no if test "$with_guile" = yes; then GUILE_FLAGS extlibs="$extlibs guile" - guile_msg=Yes + guile_msg=yes fi # Check whether to install baseconv @@ -167,41 +131,30 @@ AC_ARG_ENABLE(baseconv, [ --enable-baseconv Install the baseconv utility] AM_CONDITIONAL(BASECONV, test "$enable_baseconv" = yes) # Kerberos check -krb_msg=No -AH_TEMPLATE(HAVE_KRB5, [define to compile support for Kerberos 5 (not GSS-API) authentication]) +krb_msg=no +AH_TEMPLATE(HAVE_KRB5, [define to compile support for Kerberos 5 (not GSSAPI) authentication]) AC_ARG_WITH(krb5, [ --with-krb5[=PATH] Enable Kerberos 5 (not GSSAPI) authentication]) -if test "$with_krb5" != no; then - cpp_bak="$CPPFLAGS" - ld_bak="$LDFLAGS" - if test "$with_krb5" != yes; then - CPPFLAGS="$CPPFLAGS -I${with_krb5}/include" - LDFLAGS="$LDFLAGS -L${with_krb5}/lib" - fi - AC_CHECK_LIB(krb5, krb5_init_context, [HAS_KRB5=yes], [HAS_KRB5=no]) - if test "$HAS_KRB5" = yes; then - AC_CHECK_HEADER(com_err.h, [HAS_COMERR=yes], [HAS_COMERR=no]) - if test "$HAS_COMERR" = no; then - AC_CHECK_HEADER(et/com_err.h, [HAS_COMERR=yes; CPPFLAGS="$CPPFLAGS -I/usr/include/et"], []) - fi - fi - if test "$HAS_COMERR" = no; then - HAS_KRB5=no - fi - if test "$HAS_KRB5" = no; then - CPPFLAGS="$cpp_bak" - LDFLAGS="$ld_bak" - fi -fi -KRB5_LDADD= -if test -n "$with_krb5" -a "$with_krb5" != no -a "$HAS_KRB5" != yes; then - AC_MSG_ERROR([*** cannot find Kerberos 5 on this system - try passing --with-krb5=/path/to/kerberos]) +AC_CHECK_PROG(KRBCONF, krb5-config, yes, no) +DOLDA_PKG([HAS_COMERR], [AC_CHECK_HEADER(com_err.h, [COMERR_CFLAGS=""; HAS_COMERR=yes], [])], + [AC_CHECK_HEADER(et/com_err.h, [COMERR_CFLAGS="-I/usr/include/et"; HAS_COMERR=yes], [])], + [HAS_COMERR=no]) +DOLDA_PKG([HAS_KRB5], [test "$with_krb5" = no && HAS_KRB5=no], + [test "$KRBCONF" != yes && HAS_KRB5=no], + [test "$HAS_COMERR" = no && HAS_KRB5=no], + [KRB5_LIBS="`krb5-config --libs krb5`" + KRB5_CFLAGS="`krb5-config --cflags krb5` $COMERR_CFLAGS"] + [AC_CHECK_LIB(krb5, krb5_init_context, [:], [HAS_KRB5=no], $KRB5_LIBS)], + [DOLDA_CHECK_HEADER(krb5.h, [], [HAS_KRB5=no], $KRB5_CFLAGS)]) +if test -n "$with_krb5" -a "$with_krb5" != no -a "$HAS_KRB5" = no; then + AC_MSG_ERROR([*** cannot find Kerberos 5 on this system]) fi if test "$with_krb5" != no -a "$HAS_KRB5" = yes; then AC_DEFINE(HAVE_KRB5) - KRB5_LDADD=-lkrb5 - krb_msg=Yes + krb_msg=yes fi -AC_SUBST([KRB5_LDADD]) +AC_SUBST([KRB5_LIBS KRB5_CFLAGS]) + +DOLDA_AC_GROUP([Checking operating system features]) # Misc. functions checks AC_CHECK_FUNC(vswprintf, , AC_MSG_ERROR([*** must have vswprintf])) @@ -236,6 +189,8 @@ else AC_MSG_RESULT(none) fi +DOLDA_AC_GROUP([Checking standard headers]) + AC_HEADER_STDC AC_HEADER_DIRENT AC_HEADER_SYS_WAIT @@ -247,6 +202,8 @@ AC_TYPE_SIGNAL CPPFLAGS="-I\$(top_srcdir)/include $CPPFLAGS" +DOLDA_AC_GROUP([Writing output]) + AC_SUBST([extlibs]) AC_OUTPUT([ Makefile @@ -279,11 +236,11 @@ echo echo "Dolda Connect has been configured with the following settings:" echo echo " Kerberos 5 support: $krb_msg" -echo " GTK2 user interface: $gtk2ui_msg" -echo " GTK2 progress bars: $gtk2pbar_msg" -echo " Dolconf configurator: $dolconf_msg" +echo " GTK2 user interface: $enable_gtk2ui" +echo " GTK2 progress bars: $enable_gtk2pbar" +echo " Dolconf configurator: $enable_dolconf" echo " Guile extension library: $guile_msg" -echo " GNOME transfer applet: $gnometrapplet_msg" +echo " GNOME transfer applet: $enable_gnomeapplet" echo " Gaim chat plugin: $gaimplugin_msg" echo diff --git a/daemon/Makefile.am b/daemon/Makefile.am index e4f0ea2..0f240d7 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -24,8 +24,7 @@ doldacond_SOURCES= main.c \ conf.c \ conf.h -AM_CPPFLAGS=-I$(top_srcdir)/include -DDAEMON - EXTRA_DIST=emacs-local doldacond_LDADD=$(top_srcdir)/common/libcommon.a \ - @KRB5_LDADD@ -lbz2 -lz + @KRB5_LIBS@ -lbz2 -lz +doldacond_CPPFLAGS=-I$(top_srcdir)/include -DDAEMON @KRB5_CFLAGS@ diff --git a/daemon/fnet-dc.c b/daemon/fnet-dc.c index b7cccb1..90ae9d6 100644 --- a/daemon/fnet-dc.c +++ b/daemon/fnet-dc.c @@ -108,6 +108,7 @@ struct dchub char *charset; char *nativename; char *nativenick; + char **supports; }; struct dcexppeer @@ -243,6 +244,24 @@ static int isdchash(struct hash *hash) return(1); } +/* + * Uncomment when used! + +static int hubsupports(struct dchub *hub, char *cap) +{ + char **p; + + if(hub->supports == NULL) + return(0); + for(p = hub->supports; *p != NULL; p++) + { + if(!strcasecmp(*p, cap)) + return(1); + } + return(0); +} +*/ + static int supports(struct dcpeer *peer, char *cap) { char **p; @@ -1479,6 +1498,36 @@ static void cmd_logedin(struct socket *sk, struct fnetnode *fn, char *cmd, char hubhandleaction(sk, fn, cmd, args); } +static void cmd_hubsupports(struct socket *sk, struct fnetnode *fn, char *cmd, char *args) +{ + struct dchub *hub; + int i; + char *p, *p2; + char **arr; + size_t arrsize, arrdata; + + hub = fn->data; + if(hub->supports != NULL) + { + for(i = 0; hub->supports[i] != NULL; i++) + free(hub->supports[i]); + free(hub->supports); + } + arr = NULL; + arrsize = arrdata = 0; + p = args; + do + { + if((p2 = strchr(p, ' ')) != NULL) + *(p2++) = 0; + if(*p == 0) + continue; + addtobuf(arr, sstrdup(p)); + } while((p = p2) != NULL); + addtobuf(arr, NULL); + hub->supports = arr; +} + static void cmd_mynick(struct socket *sk, struct dcpeer *peer, char *cmd, char *args) { struct dcexppeer *expect; @@ -2572,6 +2621,7 @@ static struct command hubcmds[] = {"$UserCommand", cc(cmd_usercommand)}, {"$GetPass", cc(cmd_getpass)}, {"$LogedIn", cc(cmd_logedin)}, /* sic */ + {"$Supports", cc(cmd_hubsupports)}, {NULL, NULL} }; @@ -3085,6 +3135,7 @@ static void hubconnect(struct fnetnode *fn) static void hubdestroy(struct fnetnode *fn) { + int i; struct dchub *hub; struct qcommand *qcmd; @@ -3100,6 +3151,12 @@ static void hubdestroy(struct fnetnode *fn) return; while((qcmd = ulqcmd(&hub->queue)) != NULL) freeqcmd(qcmd); + if(hub->supports != NULL) + { + for(i = 0; hub->supports[i] != NULL; i++) + free(hub->supports[i]); + free(hub->supports); + } if(hub->nativename != NULL) free(hub->nativename); if(hub->nativenick != NULL) @@ -3546,6 +3603,78 @@ static int shareupdate(unsigned long long uusharesize, void *data) return(0); } +static char *quotestr(char *str) +{ + unsigned char *buf; + unsigned char *p; + size_t bufsize, bufdata; + wchar_t *wbuf; + static char *enc = NULL; + size_t encsize, encdata; + + buf = NULL; + bufsize = bufdata = 0; + for(p = (unsigned char *)str; *p; p++) + { + if(*p == '\b') + bufcat(buf, "\\b", 2); + else if(*p == '\t') + bufcat(buf, "\\t", 2); + else if(*p == '\n') + bufcat(buf, "\\n", 2); + else if(*p == '\r') + bufcat(buf, "\\r", 2); + else if(*p == '\\') + bufcat(buf, "\\\\", 2); + else if(*p >= 32) + addtobuf(buf, *p); + else + bprintf(buf, "\\x%02x", *p); + } + addtobuf(buf, 0); + if(enc != NULL) + free(enc); + enc = NULL; + if((wbuf = icmbstowcs((char *)buf, DCCHARSET)) != NULL) + { + enc = icwcstombs(wbuf, NULL); + free(wbuf); + } + if(enc == NULL) + { + encsize = encdata = 0; + for(p = buf; *p; p++) { + if(*p < 128) + addtobuf(enc, *p); + else + bprintf(buf, "\\x%x", *p); + } + } + free(buf); + return(enc); +} + +static void logunimpl(char *list, char *cmd, char *args) +{ + FILE *log; + + if((log = fopen("/tmp/dc-unimpl", "a")) == NULL) + { + flog(LOG_WARNING, "could not open unimpl log: %s", strerror(errno)); + return; + } + fputs(list, log); + fputc('\t', log); + fputs(quotestr(cmd), log); + if(args != NULL) + { + fputc('\t', log); + fputs(quotestr(args), log); + } + fputc('\n', log); + fclose(log); +} + static void dispatchcommand(struct qcommand *qcmd, struct command *cmdlist, struct socket *sk, void *data) { char *p; @@ -3559,11 +3688,16 @@ static void dispatchcommand(struct qcommand *qcmd, struct command *cmdlist, stru break; } if(cmd->handler != NULL) + { cmd->handler(sk, data, qcmd->string, p); -/* - else - flog(LOG_DEBUG, "Unimplemented DC command: %s \"%s\"", qcmd->string, p?p:"noargs"); -*/ + } else if(confgetint("dc", "logunimpl")) { + if(cmdlist == hubcmds) + logunimpl("hub", qcmd->string, p); + else if(cmdlist == peercmds) + logunimpl("peer", qcmd->string, p); + else + logunimpl("other?!", qcmd->string, p); + } } static int run(void) @@ -3735,6 +3869,10 @@ static struct configvar myvars[] = * hub owners, though. Note that DC++ emulation can also be turned * on or off for individual hubs, overriding this setting. */ {CONF_VAR_BOOL, "dcppemu", {.num = 0}}, + /** Use for debugging. If set to true, doldacond will log all + * unknown commands it receives, and their arguments, to + * /tmp/dc-unimpl. */ + {CONF_VAR_BOOL, "logunimpl", {.num = 0}}, {CONF_VAR_END} }; diff --git a/doc/INSTALL b/doc/INSTALL index f24afdc..00f66f9 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -54,6 +54,8 @@ use of command-line parameters: * --enable-gnomeapplet selects the GNOME panel applet for compilation. * --enable-gaimplugin selects the Gaim chat plugin for compilation. + * --enable-pidginplugin selects the Pidgin chat plugin for + compilation. Gtk2 and Kerberos V support are detected automatically by the configure script. Make sure to check the output at the end so that all @@ -69,8 +71,8 @@ configuration file. On most Linux distributions, the file pam.d-doldacond in the contrib directory can be installed as /etc/pam.d/doldacond and work perfectly. -The GNOME applet and GAIM plugin are marked as experimental not so -much because there is anything wrong with them, but because it is +The GNOME applet and GAIM/Pidgin plugin are marked as experimental not +so much because there is anything wrong with them, but because it is tricky to install them. Please see the seperate `INSTALL.applet' and `INSTALL.gaim' files for instructions. @@ -180,5 +182,5 @@ allow you in if not all TTH hashes are calculated. -This document was last updated 2007-04-11, reflecting release 0.3 of +This document was last updated 2007-07-18, reflecting release 0.5 of Dolda Connect. diff --git a/doc/INSTALL.gaim b/doc/INSTALL.gaim index 9e52b7c..12bc1ce 100644 --- a/doc/INSTALL.gaim +++ b/doc/INSTALL.gaim @@ -27,7 +27,17 @@ $HOME/.gaim/plugins. For example, you can run the following command, which will work for most cases: ln -s /usr/local/lib/gaim/libdolcon-gaim.so $HOME/.gaim/plugins + About Pidgin +Because of AOL, Gaim had to switch name to Pidgin in 2007, which has +some effects on the above discussion. As of Dolda Connect 0.5, it is +possible to compile the plugin for Pidgin as well as for Gaim. Most +things still apply as they are, but some care must be taken. If you +decide to install the plugin in your home directory, the relevant +directory is now called $HOME/.purple/plugins. Also, the name of the +plugin is called libdolcon-purple.so, instead of libdolcon-gaim.so. -This document was last updated 2007-05-02, reflecting release 0.4 of + + +This document was last updated 2007-07-18, reflecting release 0.5 of Dolda Connect. diff --git a/doc/TODO b/doc/TODO index b549e03..eb34b90 100644 --- a/doc/TODO +++ b/doc/TODO @@ -7,6 +7,7 @@ User-visible features: Protocol-visible features: * Implement full support for TTHL + * Implement some encryption for the UI channel (probably TLS) Enhancements: * Implement native HTTP library instead of calling out to wget in diff --git a/include/utils.h b/include/utils.h index 8cb40dd..d09f172 100644 --- a/include/utils.h +++ b/include/utils.h @@ -120,6 +120,13 @@ do { \ memcpy((d) + (d ## data), (s), sizeof(*(d)) * __bufcat_size__); \ (d ## data) += __bufcat_size__; \ } while (0) +#define bprintf(b, fmt...) \ + do { \ + char *__bprintf_dest__; \ + __bprintf_dest__ = sprintf2(fmt); \ + bufcat(b, __bprintf_dest__, strlen(__bprintf_dest__)); \ + free(__bprintf_dest__); \ + } while(0) #define freeparr(parr) _freeparr((void **)(parr)) #define parrlen(parr) _parrlen((void **)(parr)) diff --git a/lib/Makefile.am b/lib/Makefile.am index 7e507c3..01c8cfa 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -6,8 +6,9 @@ DIST_SUBDIRS=guile lib_LTLIBRARIES = libdcui.la libdcui_la_SOURCES = uilib.c uimisc.c -libdcui_la_LIBADD = @KRB5_LDADD@ $(top_srcdir)/common/libcommon.a +libdcui_la_LIBADD = @KRB5_LIBS@ $(top_srcdir)/common/libcommon.a libdcui_la_LDFLAGS = -version-info 2:0:1 +libdcui_la_CPPFLAGS = @KRB5_CFLAGS@ BUILT_SOURCES = initcmds.h