Mercurial > pidgin
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 13841:f3d4a9902ead | 13842:a9ff4499d9ce |
|---|---|
| 3963 return 1; | 3963 return 1; |
| 3964 } | 3964 } |
| 3965 } | 3965 } |
| 3966 | 3966 |
| 3967 | 3967 |
| 3968 static int mw_prpl_send_typing(GaimConnection *gc, const char *name, | 3968 static unsigned int mw_prpl_send_typing(GaimConnection *gc, const char *name, |
| 3969 int typing) { | 3969 GaimTypingState state) { |
| 3970 | 3970 |
| 3971 struct mwGaimPluginData *pd; | 3971 struct mwGaimPluginData *pd; |
| 3972 struct mwIdBlock who = { (char *) name, NULL }; | 3972 struct mwIdBlock who = { (char *) name, NULL }; |
| 3973 struct mwConversation *conv; | 3973 struct mwConversation *conv; |
| 3974 | 3974 |
| 3975 gpointer t = GINT_TO_POINTER(!! typing); | 3975 gpointer t = GINT_TO_POINTER(!! state); |
| 3976 | 3976 |
| 3977 g_return_val_if_fail(gc != NULL, 0); | 3977 g_return_val_if_fail(gc != NULL, 0); |
| 3978 pd = gc->proto_data; | 3978 pd = gc->proto_data; |
| 3979 | 3979 |
| 3980 g_return_val_if_fail(pd != NULL, 0); | 3980 g_return_val_if_fail(pd != NULL, 0); |
| 3982 conv = mwServiceIm_getConversation(pd->srvc_im, &who); | 3982 conv = mwServiceIm_getConversation(pd->srvc_im, &who); |
| 3983 | 3983 |
| 3984 if(mwConversation_isOpen(conv)) | 3984 if(mwConversation_isOpen(conv)) |
| 3985 return ! mwConversation_send(conv, mwImSend_TYPING, t); | 3985 return ! mwConversation_send(conv, mwImSend_TYPING, t); |
| 3986 | 3986 |
| 3987 if(typing) { | 3987 if ((state == GAIM_TYPING) || (state == GAIM_TYPED)) { |
| 3988 /* let's only open a channel for typing, not for not-typing. | 3988 /* let's only open a channel for typing, not for not-typing. |
| 3989 Otherwise two users in psychic mode will continually open | 3989 Otherwise two users in psychic mode will continually open |
| 3990 conversations to each other, never able to get rid of them, as | 3990 conversations to each other, never able to get rid of them, as |
| 3991 when the other person closes, it psychicaly opens again */ | 3991 when the other person closes, it psychicaly opens again */ |
| 3992 | 3992 |
| 3994 | 3994 |
| 3995 if(! mwConversation_isPending(conv)) | 3995 if(! mwConversation_isPending(conv)) |
| 3996 mwConversation_open(conv); | 3996 mwConversation_open(conv); |
| 3997 } | 3997 } |
| 3998 | 3998 |
| 3999 /* | |
| 4000 * TODO: This should probably be "0." When it's set to 1, the Gaim | |
| 4001 * core will call serv_send_typing(gc, who, GAIM_TYPING) once | |
| 4002 * every second until the Gaim user stops typing. --KingAnt | |
| 4003 */ | |
| 3999 return 1; | 4004 return 1; |
| 4000 } | 4005 } |
| 4001 | 4006 |
| 4002 | 4007 |
| 4003 static const char *mw_client_name(guint16 type) { | 4008 static const char *mw_client_name(guint16 type) { |
