| 2238 unseen = PIDGIN_UNSEEN_TEXT; |
2238 unseen = PIDGIN_UNSEEN_TEXT; |
| 2239 |
2239 |
| 2240 gtkconv_set_unseen(gtkconv, unseen); |
2240 gtkconv_set_unseen(gtkconv, unseen); |
| 2241 } |
2241 } |
| 2242 |
2242 |
| 2243 /* on rejoin only request message history from after this message */ |
|
| 2244 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV) && |
|
| 2245 PURPLE_IS_CHAT_CONVERSATION(conv)) { |
|
| 2246 PurpleChat *chat = purple_blist_find_chat( |
|
| 2247 purple_conversation_get_account(conv), |
|
| 2248 purple_conversation_get_name(conv)); |
|
| 2249 if (chat) { |
|
| 2250 GHashTable *comps = purple_chat_get_components(chat); |
|
| 2251 GDateTime *dt = NULL; |
|
| 2252 time_t now, history_since, prev_history_since = 0; |
|
| 2253 struct tm *history_since_tm; |
|
| 2254 const char *history_since_s, *prev_history_since_s; |
|
| 2255 |
|
| 2256 dt = purple_message_get_timestamp(pmsg); |
|
| 2257 history_since = g_date_time_to_unix(dt) + 1; |
|
| 2258 |
|
| 2259 prev_history_since_s = g_hash_table_lookup(comps, |
|
| 2260 "history_since"); |
|
| 2261 if (prev_history_since_s != NULL) |
|
| 2262 prev_history_since = purple_str_to_time( |
|
| 2263 prev_history_since_s, TRUE, NULL, NULL, |
|
| 2264 NULL); |
|
| 2265 |
|
| 2266 now = time(NULL); |
|
| 2267 /* in case of incorrectly stored timestamps */ |
|
| 2268 if (prev_history_since > now) |
|
| 2269 prev_history_since = now; |
|
| 2270 /* in case of delayed messages */ |
|
| 2271 if (history_since < prev_history_since) |
|
| 2272 history_since = prev_history_since; |
|
| 2273 |
|
| 2274 history_since_tm = gmtime(&history_since); |
|
| 2275 history_since_s = purple_utf8_strftime( |
|
| 2276 "%Y-%m-%dT%H:%M:%SZ", history_since_tm); |
|
| 2277 if (!purple_strequal(prev_history_since_s, |
|
| 2278 history_since_s)) |
|
| 2279 g_hash_table_replace(comps, |
|
| 2280 g_strdup("history_since"), |
|
| 2281 g_strdup(history_since_s)); |
|
| 2282 } |
|
| 2283 } |
|
| 2284 |
|
| 2285 purple_signal_emit(pidgin_conversations_get_handle(), |
2243 purple_signal_emit(pidgin_conversations_get_handle(), |
| 2286 (PURPLE_IS_IM_CONVERSATION(conv) ? "displayed-im-msg" : "displayed-chat-msg"), |
2244 (PURPLE_IS_IM_CONVERSATION(conv) ? "displayed-im-msg" : "displayed-chat-msg"), |
| 2287 conv, pmsg); |
2245 conv, pmsg); |
| 2288 } |
2246 } |
| 2289 |
2247 |