aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/jabber/jabber.c18
-rw-r--r--protocols/twitter/twitter.c2
-rw-r--r--protocols/twitter/twitter_lib.c7
3 files changed, 21 insertions, 6 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index 229e35bf..f7e1e664 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -95,7 +95,7 @@ static void jabber_login( account_t *acc )
{
struct im_connection *ic = imcb_new( acc );
struct jabber_data *jd = g_new0( struct jabber_data, 1 );
- struct ns_srv_reply *srv = NULL;
+ struct ns_srv_reply **srvl = NULL, *srv = NULL;
char *connect_to, *s;
int i;
@@ -195,9 +195,19 @@ static void jabber_login( account_t *acc )
/* Figure out the hostname to connect to. */
if( acc->server && *acc->server )
connect_to = acc->server;
- else if( ( srv = srv_lookup( "xmpp-client", "tcp", jd->server ) ) ||
- ( srv = srv_lookup( "jabber-client", "tcp", jd->server ) ) )
+ else if( ( srvl = srv_lookup( "xmpp-client", "tcp", jd->server ) ) ||
+ ( srvl = srv_lookup( "jabber-client", "tcp", jd->server ) ) )
+ {
+ /* Find the lowest-priority one. These usually come
+ back in random/shuffled order. Not looking at
+ weights etc for now. */
+ srv = *srvl;
+ for( i = 1; srvl[i]; i ++ )
+ if( srvl[i]->prio < srv->prio )
+ srv = srvl[i];
+
connect_to = srv->name;
+ }
else
connect_to = jd->server;
@@ -226,7 +236,7 @@ static void jabber_login( account_t *acc )
{
jd->fd = proxy_connect( connect_to, srv ? srv->port : set_getint( &acc->set, "port" ), jabber_connected_plain, ic );
}
- g_free( srv );
+ srv_free( srvl );
if( jd->fd == -1 )
{
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c
index a2f2325c..d5b71bc3 100644
--- a/protocols/twitter/twitter.c
+++ b/protocols/twitter/twitter.c
@@ -256,7 +256,7 @@ static void twitter_logout( struct im_connection *ic )
struct twitter_data *td = ic->proto_data;
// Set the status to logged out.
- ic->flags = 0;
+ ic->flags &= ~ OPT_LOGGED_IN;
// Remove the main_loop function from the function queue.
b_event_remove(td->main_loop_id);
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c
index f9e808f7..22d2a3bd 100644
--- a/protocols/twitter/twitter_lib.c
+++ b/protocols/twitter/twitter_lib.c
@@ -356,6 +356,11 @@ static xt_status twitter_xt_get_user_list( struct xt_node *node, struct twitter_
return XT_HANDLED;
}
+#ifdef __GLIBC__
+#define TWITTER_TIME_FORMAT "%a %b %d %H:%M:%S %z %Y"
+#else
+#define TWITTER_TIME_FORMAT "%a %b %d %H:%M:%S +0000 %Y"
+#endif
/**
* Function to fill a twitter_xml_status struct.
@@ -392,7 +397,7 @@ static xt_status twitter_xt_get_status( struct xt_node *node, struct twitter_xml
/* Very sensitive to changes to the formatting of
this field. :-( Also assumes the timezone used
is UTC since C time handling functions suck. */
- if( strptime( child->text, "%a %b %d %H:%M:%S %z %Y", &parsed ) != NULL )
+ if( strptime( child->text, TWITTER_TIME_FORMAT, &parsed ) != NULL )
txs->created_at = mktime_utc( &parsed );
}
else if (g_strcasecmp( "user", child->name ) == 0)