diff src/protocols/sametime/sametime.c @ 13842:a9ff4499d9ce

[gaim-migrate @ 16295] Hopefully improve the typing notification code so it's a lot easier to understand. This also creates a distinction between the signals emitted when receiving GAIM_TYPED and GAIM_NOT_TYPING messages (by adding a gaim-typed signal). And the gaim-not-typing signal should work in all cases. Most of this is stuff I changed last week during work, thanks to Meebo committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 20 Jun 2006 08:17:49 +0000
parents a5bfc93b5309
children 614c56622453
line wrap: on
line diff
--- a/src/protocols/sametime/sametime.c	Tue Jun 20 04:05:56 2006 +0000
+++ b/src/protocols/sametime/sametime.c	Tue Jun 20 08:17:49 2006 +0000
@@ -3965,14 +3965,14 @@
 }
 
 
-static int mw_prpl_send_typing(GaimConnection *gc, const char *name,
-			       int typing) {
+static unsigned int mw_prpl_send_typing(GaimConnection *gc, const char *name,
+			       GaimTypingState state) {
   
   struct mwGaimPluginData *pd;
   struct mwIdBlock who = { (char *) name, NULL };
   struct mwConversation *conv;
 
-  gpointer t = GINT_TO_POINTER(!! typing);
+  gpointer t = GINT_TO_POINTER(!! state);
 
   g_return_val_if_fail(gc != NULL, 0);
   pd = gc->proto_data;
@@ -3984,7 +3984,7 @@
   if(mwConversation_isOpen(conv))
     return ! mwConversation_send(conv, mwImSend_TYPING, t);
 
-  if(typing) {
+  if ((state == GAIM_TYPING) || (state == GAIM_TYPED)) {
     /* let's only open a channel for typing, not for not-typing.
        Otherwise two users in psychic mode will continually open
        conversations to each other, never able to get rid of them, as
@@ -3996,6 +3996,11 @@
       mwConversation_open(conv);
   }
 
+  /*
+   * TODO: This should probably be "0."  When it's set to 1, the Gaim
+   *       core will call serv_send_typing(gc, who, GAIM_TYPING) once
+   *       every second until the Gaim user stops typing. --KingAnt
+   */
   return 1;
 }