aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-08-21 23:42:01 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-08-21 23:42:01 +0100
commit4022b686cce05eb9a42b744335abd09d5ae7d0f0 (patch)
treefe827cdf6aef1fe7c3e9d0458848be3edda60ea1 /protocols
parent327af51a28fe292cfc4a68caa086a13175a69719 (diff)
parentc00dd7117be2a5fda92d6f7d72b0e4e54fa5d615 (diff)
Merge mainline.
Diffstat (limited to 'protocols')
-rw-r--r--protocols/bee.c1
-rw-r--r--protocols/bee.h2
-rw-r--r--protocols/bee_user.c9
-rw-r--r--protocols/nogaim.h3
-rw-r--r--protocols/oscar/oscar.c4
-rw-r--r--protocols/purple/purple.c50
-rw-r--r--protocols/yahoo/yahoo.c2
7 files changed, 58 insertions, 13 deletions
diff --git a/protocols/bee.c b/protocols/bee.c
index c5eeee17..81cb7619 100644
--- a/protocols/bee.c
+++ b/protocols/bee.c
@@ -39,6 +39,7 @@ bee_t *bee_new()
s = set_add( &b->set, "auto_reconnect", "true", set_eval_bool, b );
s = set_add( &b->set, "auto_reconnect_delay", "5*3<900", set_eval_account_reconnect_delay, b );
s = set_add( &b->set, "debug", "false", set_eval_bool, b );
+ s = set_add( &b->set, "mobile_is_away", "false", set_eval_bool, b );
s = set_add( &b->set, "save_on_quit", "true", set_eval_bool, b );
s = set_add( &b->set, "status", NULL, set_eval_away_status, b );
s->flags |= SET_NULL_OK;
diff --git a/protocols/bee.h b/protocols/bee.h
index 6e3cf563..d7da3671 100644
--- a/protocols/bee.h
+++ b/protocols/bee.h
@@ -55,10 +55,12 @@ typedef struct bee
bee_t *bee_new();
void bee_free( bee_t *b );
+/* TODO(wilmer): Kill at least the OPT_ flags that have an equivalent here. */
typedef enum
{
BEE_USER_ONLINE = 1, /* Compatibility with old OPT_LOGGED_IN flag */
BEE_USER_AWAY = 4, /* Compatibility with old OPT_AWAY flag */
+ BEE_USER_MOBILE = 8, /* Compatibility with old OPT_MOBILE flag */
BEE_USER_LOCAL = 256, /* Locally-added contacts (not in real contact list) */
} bee_user_flags_t;
diff --git a/protocols/bee_user.c b/protocols/bee_user.c
index 86f87f86..71b15d29 100644
--- a/protocols/bee_user.c
+++ b/protocols/bee_user.c
@@ -194,6 +194,13 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags,
else
bu->status = NULL;
+ if( bu->status == NULL && ( flags & OPT_MOBILE ) &&
+ set_getbool( &bee->set, "mobile_is_away" ) )
+ {
+ bu->flags |= BEE_USER_AWAY;
+ bu->status = g_strdup( "Mobile" );
+ }
+
if( bee->ui->user_status )
bee->ui->user_status( bee, bu, old );
@@ -267,7 +274,7 @@ void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, ui
imcb_log( ic, "Message from unknown handle %s:\n%s", handle, msg );
}
-void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags )
+void imcb_buddy_typing( struct im_connection *ic, const char *handle, uint32_t flags )
{
bee_user_t *bu;
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index 90254508..2069cf6b 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -62,6 +62,7 @@
#define OPT_LOGGED_IN 0x00000001
#define OPT_LOGGING_OUT 0x00000002
#define OPT_AWAY 0x00000004
+#define OPT_MOBILE 0x00000008
#define OPT_DOES_HTML 0x00000010
#define OPT_LOCALBUDDY 0x00000020 /* For nicks local to one groupchat */
#define OPT_TYPING 0x00000100 /* Some pieces of code make assumptions */
@@ -311,7 +312,7 @@ G_MODULE_EXPORT struct buddy *imcb_find_buddy( struct im_connection *ic, char *h
G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname );
G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick );
-G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags );
+G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, const char *handle, uint32_t flags );
G_MODULE_EXPORT struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *handle );
G_MODULE_EXPORT void imcb_clean_handle( struct im_connection *ic, char *handle );
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index 3f5272cd..db6a28f4 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -898,6 +898,10 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
flags |= OPT_AWAY;
}
+ /* Maybe this should be done just for AIM contacts, not sure. */
+ if (info->flags & AIM_FLAG_WIRELESS)
+ flags |= OPT_MOBILE;
+
if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) {
if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) &&
(info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) {
diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c
index c7cfcfda..5522c0fc 100644
--- a/protocols/purple/purple.c
+++ b/protocols/purple/purple.c
@@ -426,23 +426,16 @@ static void purple_keepalive( struct im_connection *ic )
static int purple_send_typing( struct im_connection *ic, char *who, int flags )
{
PurpleTypingState state = PURPLE_NOT_TYPING;
- PurpleConversation *conv;
+ PurpleAccount *pa = ic->proto_data;
if( flags & OPT_TYPING )
state = PURPLE_TYPING;
else if( flags & OPT_THINKING )
state = PURPLE_TYPED;
- if( ( conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_IM,
- who, ic->proto_data ) ) == NULL )
- {
- purple_conv_im_set_typing_state( purple_conversation_get_im_data( conv ), state );
- return 1;
- }
- else
- {
- return 0;
- }
+ serv_send_typing( purple_account_get_connection( pa ), who, state );
+
+ return 1;
}
static void purple_chat_msg( struct groupchat *gc, char *message, int flags )
@@ -808,6 +801,32 @@ static void prplcb_conv_im( PurpleConversation *conv, const char *who, const cha
imcb_buddy_msg( ic, (char*) who, (char*) message, 0, mtime );
}
+/* No, this is not a ui_op but a signal. */
+static void prplcb_buddy_typing( PurpleAccount *account, const char *who, gpointer null )
+{
+ PurpleConversation *conv;
+ PurpleConvIm *im;
+ int state;
+
+ if( ( conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_IM, who, account ) ) == NULL )
+ return;
+
+ im = PURPLE_CONV_IM(conv);
+ switch( purple_conv_im_get_typing_state( im ) )
+ {
+ case PURPLE_TYPING:
+ state = OPT_TYPING;
+ break;
+ case PURPLE_TYPED:
+ state = OPT_THINKING;
+ break;
+ default:
+ state = 0;
+ }
+
+ imcb_buddy_typing( purple_ic_by_pa( account ), who, state );
+}
+
static PurpleConversationUiOps bee_conv_uiops =
{
prplcb_conv_new, /* create_conversation */
@@ -1138,6 +1157,15 @@ void purple_initmodule()
/* Meh? */
purple_prefs_load();
+ /* No, really. So far there were ui_ops for everything, but now suddenly
+ one needs to use signals for typing notification stuff. :-( */
+ purple_signal_connect( purple_conversations_get_handle(), "buddy-typing",
+ &funcs, PURPLE_CALLBACK(prplcb_buddy_typing), NULL );
+ purple_signal_connect( purple_conversations_get_handle(), "buddy-typed",
+ &funcs, PURPLE_CALLBACK(prplcb_buddy_typing), NULL );
+ purple_signal_connect( purple_conversations_get_handle(), "buddy-typing-stopped",
+ &funcs, PURPLE_CALLBACK(prplcb_buddy_typing), NULL );
+
memset( &funcs, 0, sizeof( funcs ) );
funcs.login = purple_login;
funcs.init = purple_init;
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c
index 9f7a7896..7708ed63 100644
--- a/protocols/yahoo/yahoo.c
+++ b/protocols/yahoo/yahoo.c
@@ -588,6 +588,8 @@ void ext_yahoo_status_changed( int id, const char *who, int stat, const char *ms
if( away )
flags |= OPT_AWAY;
+ if( mobile )
+ flags |= OPT_MOBILE;
switch (stat)
{