diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/account.c | 26 | ||||
-rw-r--r-- | protocols/account.h | 3 | ||||
-rw-r--r-- | protocols/jabber/iq.c | 2 | ||||
-rw-r--r-- | protocols/jabber/jabber.h | 1 | ||||
-rw-r--r-- | protocols/jabber/jabber_util.c | 22 | ||||
-rw-r--r-- | protocols/msn/soap.h | 2 | ||||
-rw-r--r-- | protocols/oscar/rxqueue.c | 2 | ||||
-rw-r--r-- | protocols/oscar/txqueue.c | 2 | ||||
-rw-r--r-- | protocols/twitter/twitter.c | 10 | ||||
-rw-r--r-- | protocols/yahoo/libyahoo2.c | 2 | ||||
-rw-r--r-- | protocols/yahoo/yahoo_httplib.c | 2 | ||||
-rw-r--r-- | protocols/yahoo/yahoo_util.h | 2 |
12 files changed, 59 insertions, 17 deletions
diff --git a/protocols/account.c b/protocols/account.c index b90a60ee..83c214b1 100644 --- a/protocols/account.c +++ b/protocols/account.c @@ -27,6 +27,10 @@ #include "bitlbee.h" #include "account.h" +static const char* account_protocols_local[] = { + "gg", NULL +}; + static char *set_eval_nick_source( set_t *set, char *value ); account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass ) @@ -346,6 +350,9 @@ static gboolean account_on_timeout( gpointer d, gint fd, b_input_condition cond void account_on( bee_t *bee, account_t *a ) { + GHashTableIter nicks; + gpointer k, v; + if( a->ic ) { /* Trying to enable an already-enabled account */ @@ -359,6 +366,15 @@ void account_on( bee_t *bee, account_t *a ) if( a->ic && !( a->ic->flags & ( OPT_SLOW_LOGIN | OPT_LOGGED_IN ) ) ) a->ic->keepalive = b_timeout_add( 120000, account_on_timeout, a->ic ); + + if( a->flags & ACC_FLAG_LOCAL ) + { + g_hash_table_iter_init(&nicks, a->nicks); + while( g_hash_table_iter_next( &nicks, &k, &v ) ) + { + a->prpl->add_buddy( a->ic, (char*) k, NULL ); + } + } } void account_off( bee_t *bee, account_t *a ) @@ -464,3 +480,13 @@ int account_reconnect_delay( account_t *a ) return a->auto_reconnect_delay; } + +int protocol_account_islocal( const char* protocol ) +{ + const char** p = account_protocols_local; + do { + if( strcmp( *p, protocol ) == 0 ) + return 1; + } while( *( ++p ) ); + return 0; +} diff --git a/protocols/account.h b/protocols/account.h index ed3ca531..14633fad 100644 --- a/protocols/account.h +++ b/protocols/account.h @@ -58,6 +58,8 @@ char *set_eval_account( set_t *set, char *value ); char *set_eval_account_reconnect_delay( set_t *set, char *value ); int account_reconnect_delay( account_t *a ); +int protocol_account_islocal( const char* protocol ); + typedef enum { ACC_SET_OFFLINE_ONLY = 0x02, /* Allow changes only if the acct is offline. */ @@ -69,6 +71,7 @@ typedef enum ACC_FLAG_AWAY_MESSAGE = 0x01, /* Supports away messages instead of just states. */ ACC_FLAG_STATUS_MESSAGE = 0x02, /* Supports status messages (without being away). */ ACC_FLAG_HANDLE_DOMAINS = 0x04, /* Contact handles need a domain portion. */ + ACC_FLAG_LOCAL = 0x08, /* Contact list is local. */ } account_flag_t; #endif diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 31b92049..61417bcc 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -351,7 +351,7 @@ xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, { /* Server is crap, but this is no disaster. */ } - else if( strncmp( jd->me, c->text, strlen( jd->me ) ) != 0 ) + else if( jabber_compare_jid( jd->me, c->text ) == 0 ) { s = strchr( c->text, '/' ); if( s ) diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index 006da9a3..21769a3b 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -288,6 +288,7 @@ xt_status jabber_cache_handle_packet( struct im_connection *ic, struct xt_node * const struct jabber_away_state *jabber_away_state_by_code( char *code ); const struct jabber_away_state *jabber_away_state_by_name( char *name ); void jabber_buddy_ask( struct im_connection *ic, char *handle ); +int jabber_compare_jid( const char *jid1, const char *jid2 ); char *jabber_normalize( const char *orig ); typedef enum diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 67aa378a..0fcc8338 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -307,6 +307,28 @@ void jabber_buddy_ask( struct im_connection *ic, char *handle ) g_free( buf ); } +/* Compares just the bare portions of two Jabber IDs. */ +int jabber_compare_jid( const char *jid1, const char *jid2 ) +{ + int i; + + for( i = 0; ; i ++ ) + { + if( jid1[i] == '\0' || jid1[i] == '/' || jid2[i] == '\0' || jid2[i] == '/' ) + { + if( ( jid1[i] == '\0' || jid1[i] == '/' ) && ( jid2[i] == '\0' || jid2[i] == '/' ) ) + break; + return FALSE; + } + if( tolower( jid1[i] ) != tolower( jid2[i] ) ) + { + return FALSE; + } + } + + return TRUE; +} + /* Returns a new string. Don't leak it! */ char *jabber_normalize( const char *orig ) { diff --git a/protocols/msn/soap.h b/protocols/msn/soap.h index cb731ea7..1fd1f32b 100644 --- a/protocols/msn/soap.h +++ b/protocols/msn/soap.h @@ -35,12 +35,10 @@ #include <stdlib.h> #include <string.h> #include <sys/types.h> -#ifndef _WIN32 #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> -#endif #include "nogaim.h" diff --git a/protocols/oscar/rxqueue.c b/protocols/oscar/rxqueue.c index 081e967c..9ac8466e 100644 --- a/protocols/oscar/rxqueue.c +++ b/protocols/oscar/rxqueue.c @@ -8,9 +8,7 @@ #include <aim.h> -#ifndef _WIN32 #include <sys/socket.h> -#endif /* * diff --git a/protocols/oscar/txqueue.c b/protocols/oscar/txqueue.c index d38986d0..e48511fa 100644 --- a/protocols/oscar/txqueue.c +++ b/protocols/oscar/txqueue.c @@ -8,9 +8,7 @@ #include <aim.h> #include "im.h" -#ifndef _WIN32 #include <sys/socket.h> -#endif /* * Allocate a new tx frame. diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 70e11067..2a6ae88f 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -322,7 +322,7 @@ static void twitter_init(account_t * acc) s = set_add(&acc->set, "show_ids", "true", set_eval_bool, acc); - s = set_add(&acc->set, "show_old_mentions", "20", set_eval_int, acc); + s = set_add(&acc->set, "show_old_mentions", "0", set_eval_int, acc); s = set_add(&acc->set, "strip_newlines", "false", set_eval_bool, acc); @@ -601,7 +601,7 @@ static void twitter_handle_command(struct im_connection *ic, char *message) bee_user_t *bu = NULL; cmds = g_strdup(message); - cmd = split_command_parts(cmds); + cmd = split_command_parts(cmds, 2); if (cmd[0] == NULL) { goto eof; @@ -616,7 +616,9 @@ static void twitter_handle_command(struct im_connection *ic, char *message) twitter_log(ic, "Could not undo last action"); goto eof; - } else if (g_strcasecmp(cmd[0], "favourite") == 0 && cmd[1]) { + } else if ((g_strcasecmp(cmd[0], "favourite") == 0 || + g_strcasecmp(cmd[0], "favorite") == 0 || + g_strcasecmp(cmd[0], "fav") == 0) && cmd[1]) { if ((id = twitter_message_id_from_command_arg(ic, cmd[1], NULL))) { twitter_favourite_tweet(ic, id); } else { @@ -661,7 +663,7 @@ static void twitter_handle_command(struct im_connection *ic, char *message) "post any statuses recently", cmd[1]); goto eof; } - message = new = g_strdup_printf("@%s %s", bu->handle, message + (cmd[2] - cmd[0])); + message = new = g_strdup_printf("@%s %s", bu->handle, cmd[2]); in_reply_to = id; allow_post = TRUE; } else if (g_strcasecmp(cmd[0], "post") == 0) { diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index da427279..972ee134 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -47,9 +47,7 @@ * */ -#ifndef _WIN32 #include <unistd.h> -#endif #include <errno.h> #include <stdio.h> #include <stdarg.h> diff --git a/protocols/yahoo/yahoo_httplib.c b/protocols/yahoo/yahoo_httplib.c index fd63d507..93fdb263 100644 --- a/protocols/yahoo/yahoo_httplib.c +++ b/protocols/yahoo/yahoo_httplib.c @@ -37,9 +37,7 @@ char *strchr(), *strrchr(); #endif #include <errno.h> -#ifndef _WIN32 #include <unistd.h> -#endif #include <ctype.h> #include "yahoo2.h" #include "yahoo2_callbacks.h" diff --git a/protocols/yahoo/yahoo_util.h b/protocols/yahoo/yahoo_util.h index 8cb721c1..6b4da304 100644 --- a/protocols/yahoo/yahoo_util.h +++ b/protocols/yahoo/yahoo_util.h @@ -64,7 +64,6 @@ void *y_memdup(const void *addr, int n); char **y_strsplit(char *str, char *sep, int nelem); void y_strfreev(char **vector); -#ifndef _WIN32 int strncasecmp(const char *s1, const char *s2, size_t n); int strcasecmp(const char *s1, const char *s2); @@ -72,7 +71,6 @@ char *strdup(const char *s); int snprintf(char *str, size_t size, const char *format, ...); int vsnprintf(char *str, size_t size, const char *format, va_list ap); -#endif #endif |