Mercurial > pidgin
comparison src/protocols/simple/simple.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 | e4a4983752a9 |
| children | 91a4cc3ee221 |
comparison
equal
deleted
inserted
replaced
| 13841:f3d4a9902ead | 13842:a9ff4499d9ce |
|---|---|
| 1051 | 1051 |
| 1052 g_free(from); | 1052 g_free(from); |
| 1053 send_sip_response(sip->gc, msg, 200, "OK", NULL); | 1053 send_sip_response(sip->gc, msg, 200, "OK", NULL); |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 static int simple_typing(GaimConnection *gc, const char *name, int typing) { | 1056 static unsigned int simple_typing(GaimConnection *gc, const char *name, GaimTypingState state) { |
| 1057 struct simple_account_data *sip = gc->proto_data; | 1057 struct simple_account_data *sip = gc->proto_data; |
| 1058 | 1058 |
| 1059 gchar *xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | 1059 gchar *xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 1060 "<isComposing xmlns=\"urn:ietf:params:xml:ns:im-iscomposing\"\n" | 1060 "<isComposing xmlns=\"urn:ietf:params:xml:ns:im-iscomposing\"\n" |
| 1061 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" | 1061 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" |
| 1063 "<state>%s</state>\n" | 1063 "<state>%s</state>\n" |
| 1064 "<contenttype>text/plain</contenttype>\n" | 1064 "<contenttype>text/plain</contenttype>\n" |
| 1065 "<refresh>60</refresh>\n" | 1065 "<refresh>60</refresh>\n" |
| 1066 "</isComposing>"; | 1066 "</isComposing>"; |
| 1067 gchar *recv = g_strdup(name); | 1067 gchar *recv = g_strdup(name); |
| 1068 if(typing == GAIM_TYPING) { | 1068 if(state == GAIM_TYPING) { |
| 1069 gchar *msg = g_strdup_printf(xml, "active"); | 1069 gchar *msg = g_strdup_printf(xml, "active"); |
| 1070 simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); | 1070 simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); |
| 1071 g_free(msg); | 1071 g_free(msg); |
| 1072 } else { | 1072 } else /* TODO: Only if (state == GAIM_TYPED) ? */ { |
| 1073 gchar *msg = g_strdup_printf(xml, "idle"); | 1073 gchar *msg = g_strdup_printf(xml, "idle"); |
| 1074 simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); | 1074 simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); |
| 1075 g_free(msg); | 1075 g_free(msg); |
| 1076 } | 1076 } |
| 1077 g_free(recv); | 1077 g_free(recv); |
| 1078 /* | |
| 1079 * TODO: Is this right? It will cause the core to call | |
| 1080 * serv_send_typing(gc, who, GAIM_TYPING) once every second | |
| 1081 * until the user stops typing. If that's not desired, | |
| 1082 * then return 0 instead. | |
| 1083 */ | |
| 1078 return 1; | 1084 return 1; |
| 1079 } | 1085 } |
| 1080 | 1086 |
| 1081 static gchar *find_tag(gchar *hdr) { | 1087 static gchar *find_tag(gchar *hdr) { |
| 1082 gchar *tmp = strstr(hdr, ";tag="); | 1088 gchar *tmp = strstr(hdr, ";tag="); |
