Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/EionRobb/pidgin-opensteamworks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreionrobb <eionrobb@8ca6c67d-4297-256d-f884-781da6d5760b>2015-07-02 00:30:03 +0300
committereionrobb <eionrobb@8ca6c67d-4297-256d-f884-781da6d5760b>2015-07-02 00:30:03 +0300
commitfb4ea0e9504e6f4603445df0397273ab6100ac6a (patch)
tree615dc365a5b01153397e6003b699acebc4a71b6c
parentc3a9f074a2cb28474ff3ec56d800a14e6e655f5d (diff)
Fix up history so that we're not getting the same offline messages every time we connect
-rw-r--r--steam-mobile/libsteam.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/steam-mobile/libsteam.c b/steam-mobile/libsteam.c
index 644348d..c1b0bee 100644
--- a/steam-mobile/libsteam.c
+++ b/steam-mobile/libsteam.c
@@ -547,7 +547,7 @@ steam_poll_cb(SteamAccount *sa, JsonObject *obj, gpointer user_data)
{
JsonObject *message = json_array_get_object_element(messages, index);
const gchar *type = json_object_get_string_member(message, "type");
- purple_debug_info("steam", "new message of type %s\n", type);
+
if (g_str_equal(type, "typing"))
{
serv_got_typing(sa->pc, json_object_get_string_member(message, "steamid_from"), 20, PURPLE_TYPING);
@@ -619,14 +619,19 @@ steam_poll_cb(SteamAccount *sa, JsonObject *obj, gpointer user_data)
gchar *has_left_msg = g_strdup_printf("%s has left the conversation", alias ? alias : "User");
purple_conversation_write(conv, "", has_left_msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
g_free(has_left_msg);
+ } else {
+ purple_debug_error("steam", "unknown message type %s\n", type);
}
}
+ purple_account_set_int(sa->account, "last_message_timestamp", sa->last_message_timestamp);
+
if (json_object_has_member(obj, "messagelast"))
sa->message = MAX(sa->message, (guint) json_object_get_int_member(obj, "messagelast"));
if (json_object_has_member(obj, "error") && g_str_equal(json_object_get_string_member(obj, "error"), "Not Logged On"))
{
+ g_string_free(users_to_update, TRUE);
purple_connection_error(sa->pc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Reconnect needed"));
}
@@ -916,8 +921,8 @@ steam_get_conversations_cb(SteamAccount *sa, JsonObject *obj, gpointer user_data
gint64 last_view = json_object_get_int_member(session, "last_view");
gint64 unread_message_count = json_object_get_int_member(session, "unread_message_count");
- if (unread_message_count > 0) {
- steam_get_offline_history(sa, steam_accountid_to_steamid(accountid_friend), last_view);
+ if (last_message > sa->last_message_timestamp) {
+ steam_get_offline_history(sa, steam_accountid_to_steamid(accountid_friend), sa->last_message_timestamp);
}
}
}
@@ -1355,6 +1360,7 @@ steam_login(PurpleAccount *account)
sa->hostname_ip_cache = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
sa->sent_messages_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
sa->waiting_conns = g_queue_new();
+ sa->last_message_timestamp = purple_account_get_int(sa->account, "last_message_timestamp", 0);
#ifdef G_OS_UNIX
if(core_is_haze) {