--- a/libpurple/protocols/mxit/protocol.c Tue Jul 24 11:04:38 2012 +0200 +++ b/libpurple/protocols/mxit/protocol.c Fri Jul 27 09:47:04 2012 +0200 @@ -1135,7 +1135,7 @@ * @param id The identifier of the event (received in message) * @param event Identified the type of event */ -void mxit_send_msgevent( struct MXitSession* session, const char* to, const char* id, int event) +void mxit_send_msgevent( struct MXitSession* session, const char* to, const char* id, int event ) { char data[CP_MAX_PACKET]; int datalen; @@ -2023,6 +2023,49 @@ g_list_foreach( entries, (GFunc)g_free, NULL ); } +/*------------------------------------------------------------------------ + * Process a received message event packet. + * + * @param session The MXit session object + * @param records The packet's data records + * @param rcount The number of data records + */ +static void mxit_parse_cmd_msgevent( struct MXitSession* session, struct record** records, int rcount ) +{ + int event; + + /* + * contactAddress \1 dateTime \1 id \1 event + */ + + /* strip off dummy domain */ + mxit_strip_domain( records[0]->fields[0]->data ); + + event = atoi( records[0]->fields[3]->data ); + + switch ( event ) { + case CP_MSGEVENT_TYPING : /* user is typing */ + case CP_MSGEVENT_ANGRY : /* user is typing angrily */ + purple_debug_info( MXIT_PLUGIN_ID, "Got a TYPING event for %s\n", records[0]->fields[3]->data ); + serv_got_typing( session->con, records[0]->fields[0]->data, 0, PURPLE_TYPING ); + break; + + case CP_MSGEVENT_STOPPED : /* user has stopped typing */ + purple_debug_info( MXIT_PLUGIN_ID, "Got a STOPPED event for %s\n", records[0]->fields[3]->data ); + serv_got_typing_stopped( session->con, records[0]->fields[0]->data ); + break; + + case CP_MSGEVENT_ERASING : /* user is erasing text */ + case CP_MSGEVENT_DELIVERED : /* message was delivered */ + case CP_MSGEVENT_DISPLAYED : /* message was viewed */ + /* these are currently not supported by libPurple */ + break; + + default: + purple_debug_error( MXIT_PLUGIN_ID, "Unknown message event received (%i)\n", event ); + } +} + /*------------------------------------------------------------------------ * Return the length of a multimedia chunk @@ -2302,6 +2345,11 @@ mxit_parse_cmd_suggestcontacts( session, &packet->records[2], packet->rcount - 2 ); break; + case CP_CMD_GOT_MSGEVENT : + /* received message event */ + mxit_parse_cmd_msgevent( session, &packet->records[2], packet->rcount - 2 ); + break; + case CP_CMD_MOOD : /* mood update */ case CP_CMD_UPDATE :