aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2005-12-14 00:27:58 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2005-12-14 00:27:58 +0100
commit22bf64eab8a79352317ee190cddfeef3011aa8dc (patch)
tree588aeb197e2b24660c2813866270f8e780903da0
parent6aaa2213588f7c4c00a68c5622f6974679eaf196 (diff)
parente7f46c56ffa29c6f8f4917c5f367a61706758e2a (diff)
Improved typing notification support. (from f0rked)
-rw-r--r--protocols/msn/sb.c2
-rw-r--r--protocols/nogaim.c16
-rw-r--r--protocols/nogaim.h2
-rw-r--r--protocols/oscar/oscar.c18
-rw-r--r--protocols/yahoo/yahoo.c10
5 files changed, 37 insertions, 11 deletions
diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c
index 793a881e..2f4d05d5 100644
--- a/protocols/msn/sb.c
+++ b/protocols/msn/sb.c
@@ -643,7 +643,7 @@ static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int
if( who )
{
- serv_got_typing( gc, who, 5 );
+ serv_got_typing( gc, who, 5, 1 );
g_free( who );
}
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 3ab4737e..34dfb2c3 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -696,15 +696,25 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f
irc_msgfrom( irc, u->nick, msg );
}
-void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout )
+void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type )
{
user_t *u;
if( !set_getint( gc->irc, "typing_notice" ) )
return;
- if( ( u = user_findhandle( gc, handle ) ) )
- irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, "\1TYPING 1\1" );
+ if( ( u = user_findhandle( gc, handle ) ) ) {
+ /* If type is:
+ * 0: user has stopped typing
+ * 1: user is actively typing
+ * 2: user has entered text, but is not actively typing
+ */
+ if (type == 0 || type == 1 || type == 2) {
+ char buf[256];
+ g_snprintf(buf, 256, "\1TYPING %d\1", type);
+ irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, buf );
+ }
+ }
}
void serv_got_chat_left( struct gaim_connection *gc, int id )
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index 5fc9aca5..829a96c0 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -299,7 +299,7 @@ G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *id, char
/* server.c */
G_MODULE_EXPORT void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps );
G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
-G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout );
+G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type );
G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data );
G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, char *handle );
G_MODULE_EXPORT void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime );
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index 15844479..240bab14 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -2450,10 +2450,20 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...)
sn = va_arg(ap, char*);
type2 = va_arg(ap, int);
va_end(ap);
-
- if(type2 == 0x0001 || type2 == 0x0002)
- serv_got_typing(gc, sn, 0);
-
+
+ if(type2 == 0x0002) {
+ /* User is typing */
+ serv_got_typing(gc, sn, 0, 1);
+ }
+ else if (type2 == 0x0001) {
+ /* User has typed something, but is not actively typing (stale) */
+ serv_got_typing(gc, sn, 0, 2);
+ }
+ else {
+ /* User has stopped typing */
+ serv_got_typing(gc, sn, 0, 0);
+ }
+
return 1;
}
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c
index d7f7d1dc..74d468eb 100644
--- a/protocols/yahoo/yahoo.c
+++ b/protocols/yahoo/yahoo.c
@@ -640,8 +640,14 @@ void ext_yahoo_got_file( int id, char *who, char *url, long expires, char *msg,
void ext_yahoo_typing_notify( int id, char *who, int stat )
{
struct gaim_connection *gc = byahoo_get_gc_by_id( id );
-
- serv_got_typing( gc, who, 1 );
+ if (stat == 1) {
+ /* User is typing */
+ serv_got_typing( gc, who, 1, 1 );
+ }
+ else {
+ /* User stopped typing */
+ serv_got_typing( gc, who, 1, 0 );
+ }
}
void ext_yahoo_system_message( int id, char *msg )