[pan2] Bug 527313: 'Add port to server dialog' -- apply commits 862da67 , af30418 from lostcoder
- From: Charles Stephen Kerr <csk src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pan2] Bug 527313: 'Add port to server dialog' -- apply commits 862da67 , af30418 from lostcoder
- Date: Mon, 28 Sep 2009 22:41:37 +0000 (UTC)
commit 8777cb8dec7800722126ccdebf28c7a6dae8dcfc
Author: Charles Kerr <charles rebelbase com>
Date: Mon Sep 28 17:41:21 2009 -0500
Bug 527313: 'Add port to server dialog' -- apply commits 862da67 , af30418 from lostcoder
pan/data-impl/server.cc | 8 +++++++-
pan/data/server-info.h | 1 +
pan/gui/server-ui.cc | 4 +---
pan/tasks/socket-impl-gio.cc | 9 +++++----
4 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/pan/data-impl/server.cc b/pan/data-impl/server.cc
index 9e98ba1..0afc4ad 100644
--- a/pan/data-impl/server.cc
+++ b/pan/data-impl/server.cc
@@ -188,8 +188,14 @@ DataImpl :: get_server_addr (const Quark & server,
std::string
DataImpl :: get_server_address (const Quark& server) const
{
+ std::string str;
const Server * s (find_server (server));
- return std::string (s ? s->host : "");
+ if (s) {
+ std::ostringstream x(s->host,std::ios_base::ate);
+ x << ":" << s->port;
+ str = x.str();
+ }
+ return str;
}
int
diff --git a/pan/data/server-info.h b/pan/data/server-info.h
index 8b96d25..bcdc3f0 100644
--- a/pan/data/server-info.h
+++ b/pan/data/server-info.h
@@ -71,6 +71,7 @@ namespace pan
std::string & setme_address,
int & setme_port) const = 0;
+ // only used for debug and loging output
virtual std::string get_server_address (const Quark& servername) const = 0;
/** If set_server_limits() has never been called, 2 is returned. */
diff --git a/pan/gui/server-ui.cc b/pan/gui/server-ui.cc
index fa6dba8..5220ca3 100644
--- a/pan/gui/server-ui.cc
+++ b/pan/gui/server-ui.cc
@@ -374,9 +374,7 @@ namespace
foreach_const (quarks_t, servers, it)
{
const Quark& server (*it);
- int port;
- std::string addr;
- d->data.get_server_addr (*it, addr, port);
+ std::string addr(d->data.get_server_address (*it));
GtkTreeIter iter;
gtk_list_store_append (d->servers_store, &iter);
diff --git a/pan/tasks/socket-impl-gio.cc b/pan/tasks/socket-impl-gio.cc
index 04ec1bc..dead2ba 100644
--- a/pan/tasks/socket-impl-gio.cc
+++ b/pan/tasks/socket-impl-gio.cc
@@ -166,9 +166,10 @@ namespace
// get an addrinfo for the host
const std::string host (host_in.str, host_in.len);
- char portbuf[32];
+ char portbuf[32], hpbuf[255];
g_snprintf (portbuf, sizeof(portbuf), "%d", port);
-
+ g_snprintf (hpbuf,sizeof(hpbuf),"%s:%s",host_in.str,portbuf);
+
#ifdef G_OS_WIN32 // windows might not have getaddrinfo...
if (!p_getaddrinfo)
{
@@ -221,7 +222,7 @@ namespace
err = p_getaddrinfo (host.c_str(), portbuf, &hints, &ans);
if (err != 0) {
char buf[512];
- snprintf (buf, sizeof(buf), _("Error connecting to \"%s\""), host.c_str());
+ snprintf (buf, sizeof(buf), _("Error connecting to \"%s\""), hpbuf);
setme_err = buf;
if (errno) {
setme_err += " (";
@@ -259,7 +260,7 @@ namespace
// create the giochannel...
if (sockfd < 0) {
char buf[512];
- snprintf (buf, sizeof(buf), _("Error connecting to \"%s\""), host.c_str());
+ snprintf (buf, sizeof(buf), _("Error connecting to \"%s\""), hpbuf);
setme_err = buf;
if (errno) {
setme_err += " (";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]