X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=clients%2Fgaim%2Fgaim-dolcon.c;h=6d2972675e14b1edfc7bf661fbc7b32b51ff9e80;hb=5e1e52f14fabed501d62d56fecc0b91d972e5673;hp=715c629ac40c45624011773622f2f9787a590564;hpb=f6b0a5567bd21934f5318af9497afb3c6e1391e8;p=doldaconnect.git diff --git a/clients/gaim/gaim-dolcon.c b/clients/gaim/gaim-dolcon.c index 715c629..6d29726 100644 --- a/clients/gaim/gaim-dolcon.c +++ b/clients/gaim/gaim-dolcon.c @@ -98,7 +98,7 @@ static void newpeercb(struct dc_fnetpeer *peer) data = peer->fn->udata; if((conv = gaim_find_chat(data->gc, peer->fn->id)) != NULL) { - buf = sprintf2("%i:%s", peer->fn->id, icswcstombs(peer->nick, "UTF-8", 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); free(buf); } @@ -113,7 +113,7 @@ static void delpeercb(struct dc_fnetpeer *peer) data = peer->fn->udata; if((conv = gaim_find_chat(data->gc, peer->fn->id)) != NULL) { - buf = sprintf2("%s", peer->fn->id, icswcstombs(peer->nick, "UTF-8", NULL)); + buf = sprintf2("%s", icswcstombs(peer->nick, "UTF-8", NULL)); gaim_conv_chat_remove_user(GAIM_CONV_CHAT(conv), buf, NULL); free(buf); } @@ -170,14 +170,19 @@ static void dcfdcb(struct conndata *data, int fd, GaimInputCondition condition) } while((resp = dc_getresp()) != NULL) { if(!wcscmp(resp->cmdname, L".connect")) { - if(resp->code == 200) { - gaim_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(resp->code != 201) { dc_disconnect(); disconnected(data); gaim_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"); + return; + } else { + gaim_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")) { dc_uimisc_handlenotify(resp); @@ -365,7 +370,7 @@ static void gi_login(GaimAccount *act) return; } gaim_connection_update_progress(gc, "Connecting", 1, 3); - if((data->fd = dc_connect((char *)gaim_account_get_string(act, "server", "localhost"), -1)) < 0) + if((data->fd = dc_connect((char *)gaim_account_get_string(act, "server", "localhost"))) < 0) { gaim_connection_error(gc, "Could not connect to server"); return; @@ -500,7 +505,7 @@ static void init(GaimPlugin *pl) GaimAccountOption *opt; dc_init(); - opt = gaim_account_option_string_new("Server", "server", "localhost"); + 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);