X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=clients%2Fgaim%2Fgaim-dolcon.c;h=c52feb65d5594db850ca95d09aad25dbfdfba21e;hb=c7f65f51c58011c1fc4ccd65a9924acf2c290c0d;hp=6d2972675e14b1edfc7bf661fbc7b32b51ff9e80;hpb=5e1e52f14fabed501d62d56fecc0b91d972e5673;p=doldaconnect.git diff --git a/clients/gaim/gaim-dolcon.c b/clients/gaim/gaim-dolcon.c index 6d29726..c52feb6 100644 --- a/clients/gaim/gaim-dolcon.c +++ b/clients/gaim/gaim-dolcon.c @@ -40,6 +40,7 @@ struct conndata { }; static struct conndata *inuse = NULL; +static GaimPlugin *me; static void dcfdcb(struct conndata *data, int fd, GaimInputCondition condition); @@ -89,6 +90,28 @@ 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) +{ + GaimConnection *c; + + if((c = gaim_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) +{ + GaimConnection *c; + + if((c = gaim_conversation_get_gc(conv)) == NULL) + return(FALSE); + if(c->prpl == me) + return(TRUE); + return(FALSE); +} + static void newpeercb(struct dc_fnetpeer *peer) { struct conndata *data; @@ -253,7 +276,7 @@ static int gi_sendchat(GaimConnection *gc, int id, const char *what, GaimMessage /* XXX: Handle chat rooms */ if((wwhat = icmbstowcs((char *)what, "UTF-8")) == NULL) return(-errno); - dc_queuecmd(NULL, NULL, L"sendchat", L"%%i", fn->id, L"1", L"", L"%%ls", wwhat, NULL); + dc_queuecmd(NULL, NULL, L"sendchat", L"%i", fn->id, L"1", L"", L"%ls", wwhat, NULL); free(wwhat); updatewrite(data); return(0); @@ -293,7 +316,7 @@ static int gi_sendim(GaimConnection *gc, const char *who, const char *what, Gaim free(wwho); return(-en); } - dc_queuecmd(NULL, NULL, L"sendchat", L"%%i", fn->id, L"0", L"%%ls", peer->nick, L"%%ls", wwhat, NULL); + dc_queuecmd(NULL, NULL, L"sendchat", L"%i", fn->id, L"0", L"%ls", peer->nick, L"%ls", wwhat, NULL); free(wwho); free(wwhat); updatewrite(data); @@ -315,7 +338,7 @@ static char *gi_statustext(GaimBuddy *b) return(NULL); } -static void gi_tiptext(GaimBuddy *b, GString *buf, gboolean full) +static void gi_tiptext(GaimBuddy *b, GaimNotifyUserInfo *inf, gboolean full) { /* Nothing for now */ } @@ -507,10 +530,11 @@ static void init(GaimPlugin *pl) dc_init(); opt = gaim_account_option_string_new("Server", "server", ""); protinfo.protocol_options = g_list_append(protinfo.protocol_options, opt); - opt = gaim_account_option_int_new("Port", "port", -1); - 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); protinfo.protocol_options = g_list_append(protinfo.protocol_options, opt); + gaim_signal_connect(gaim_conversations_get_handle(), "chat-buddy-joining", pl, GAIM_CALLBACK(gi_chatjoincb), NULL); + gaim_signal_connect(gaim_conversations_get_handle(), "chat-buddy-leaving", pl, GAIM_CALLBACK(gi_chatleavecb), NULL); + me = pl; } GAIM_INIT_PLUGIN(dolcon, init, info);