| 1076 } |
1076 } |
| 1077 |
1077 |
| 1078 statedata = xmlnode_get_data(state); |
1078 statedata = xmlnode_get_data(state); |
| 1079 if(statedata) { |
1079 if(statedata) { |
| 1080 if(strstr(statedata, "active")) |
1080 if(strstr(statedata, "active")) |
| 1081 serv_got_typing(sip->gc, from, 0, PURPLE_TYPING); |
1081 serv_got_typing(sip->gc, from, 0, PURPLE_IM_CONVERSATION_TYPING); |
| 1082 else |
1082 else |
| 1083 serv_got_typing_stopped(sip->gc, from); |
1083 serv_got_typing_stopped(sip->gc, from); |
| 1084 |
1084 |
| 1085 g_free(statedata); |
1085 g_free(statedata); |
| 1086 } |
1086 } |
| 1285 g_free(basicstatus_data); |
1285 g_free(basicstatus_data); |
| 1286 |
1286 |
| 1287 send_sip_response(sip->gc, msg, 200, "OK", NULL); |
1287 send_sip_response(sip->gc, msg, 200, "OK", NULL); |
| 1288 } |
1288 } |
| 1289 |
1289 |
| 1290 static unsigned int simple_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) { |
1290 static unsigned int simple_typing(PurpleConnection *gc, const char *name, PurpleIMConversationTypingState state) { |
| 1291 struct simple_account_data *sip = purple_connection_get_protocol_data(gc); |
1291 struct simple_account_data *sip = purple_connection_get_protocol_data(gc); |
| 1292 |
1292 |
| 1293 gchar *xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
1293 gchar *xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 1294 "<isComposing xmlns=\"urn:ietf:params:xml:ns:im-iscomposing\"\n" |
1294 "<isComposing xmlns=\"urn:ietf:params:xml:ns:im-iscomposing\"\n" |
| 1295 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" |
1295 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" |
| 1297 "<state>%s</state>\n" |
1297 "<state>%s</state>\n" |
| 1298 "<contenttype>text/plain</contenttype>\n" |
1298 "<contenttype>text/plain</contenttype>\n" |
| 1299 "<refresh>60</refresh>\n" |
1299 "<refresh>60</refresh>\n" |
| 1300 "</isComposing>"; |
1300 "</isComposing>"; |
| 1301 gchar *recv = g_strdup(name); |
1301 gchar *recv = g_strdup(name); |
| 1302 if(state == PURPLE_TYPING) { |
1302 if(state == PURPLE_IM_CONVERSATION_TYPING) { |
| 1303 gchar *msg = g_strdup_printf(xml, "active"); |
1303 gchar *msg = g_strdup_printf(xml, "active"); |
| 1304 simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); |
1304 simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); |
| 1305 g_free(msg); |
1305 g_free(msg); |
| 1306 } else /* TODO: Only if (state == PURPLE_TYPED) ? */ { |
1306 } else /* TODO: Only if (state == PURPLE_IM_CONVERSATION_TYPED) ? */ { |
| 1307 gchar *msg = g_strdup_printf(xml, "idle"); |
1307 gchar *msg = g_strdup_printf(xml, "idle"); |
| 1308 simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); |
1308 simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); |
| 1309 g_free(msg); |
1309 g_free(msg); |
| 1310 } |
1310 } |
| 1311 g_free(recv); |
1311 g_free(recv); |
| 1312 /* |
1312 /* |
| 1313 * TODO: Is this right? It will cause the core to call |
1313 * TODO: Is this right? It will cause the core to call |
| 1314 * serv_send_typing(gc, who, PURPLE_TYPING) once every second |
1314 * serv_send_typing(gc, who, PURPLE_IM_CONVERSATION_TYPING) once every second |
| 1315 * until the user stops typing. If that's not desired, |
1315 * until the user stops typing. If that's not desired, |
| 1316 * then return 0 instead. |
1316 * then return 0 instead. |
| 1317 */ |
1317 */ |
| 1318 return 1; |
1318 return 1; |
| 1319 } |
1319 } |