(Partially) Fix messages being displayed wrongly sorted in ConversationSummary due to being compared->equal
This commit is contained in:
parent
680d28360c
commit
d0d68f5878
|
@ -93,7 +93,8 @@ public abstract class MetaConversationItem : Object {
|
||||||
public virtual Jid? jid { get; set; default=null; }
|
public virtual Jid? jid { get; set; default=null; }
|
||||||
public virtual bool dim { get; set; default=false; }
|
public virtual bool dim { get; set; default=false; }
|
||||||
public virtual DateTime? sort_time { get; set; default=null; }
|
public virtual DateTime? sort_time { get; set; default=null; }
|
||||||
public virtual double seccondary_sort_indicator { get; set; }
|
public virtual long seccondary_sort_indicator { get; set; }
|
||||||
|
public virtual long tertiary_sort_indicator { get; set; }
|
||||||
public virtual DateTime? display_time { get; set; default=null; }
|
public virtual DateTime? display_time { get; set; default=null; }
|
||||||
public virtual Encryption? encryption { get; set; default=null; }
|
public virtual Encryption? encryption { get; set; default=null; }
|
||||||
public virtual Entities.Message.Marked? mark { get; set; default=null; }
|
public virtual Entities.Message.Marked? mark { get; set; default=null; }
|
||||||
|
|
|
@ -78,7 +78,8 @@ public class ContentMetaItem : Plugins.MetaConversationItem {
|
||||||
public ContentMetaItem(ContentItem content_item, ContentItemWidgetFactory widget_factory) {
|
public ContentMetaItem(ContentItem content_item, ContentItemWidgetFactory widget_factory) {
|
||||||
this.jid = content_item.jid;
|
this.jid = content_item.jid;
|
||||||
this.sort_time = content_item.sort_time;
|
this.sort_time = content_item.sort_time;
|
||||||
this.seccondary_sort_indicator = content_item.id;
|
this.seccondary_sort_indicator = (long) content_item.display_time.to_unix();
|
||||||
|
this.tertiary_sort_indicator = content_item.id;
|
||||||
this.display_time = content_item.display_time;
|
this.display_time = content_item.display_time;
|
||||||
this.encryption = content_item.encryption;
|
this.encryption = content_item.encryption;
|
||||||
this.mark = content_item.mark;
|
this.mark = content_item.mark;
|
||||||
|
|
|
@ -381,15 +381,15 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int compare_meta_items(Plugins.MetaConversationItem a, Plugins.MetaConversationItem b) {
|
private static int compare_meta_items(Plugins.MetaConversationItem a, Plugins.MetaConversationItem b) {
|
||||||
int res = a.sort_time.compare(b.sort_time);
|
int cmp1 = a.sort_time.compare(b.sort_time);
|
||||||
if (res == 0) {
|
if (cmp1 == 0) {
|
||||||
if (a.seccondary_sort_indicator < b.seccondary_sort_indicator) {
|
double cmp2 = a.seccondary_sort_indicator - b.seccondary_sort_indicator;
|
||||||
res = -1;
|
if (cmp2 == 0) {
|
||||||
} else if (a.seccondary_sort_indicator > b.seccondary_sort_indicator) {
|
return (int) (a.tertiary_sort_indicator - b.tertiary_sort_indicator);
|
||||||
res = 1;
|
|
||||||
}
|
}
|
||||||
|
return (int) cmp2;
|
||||||
}
|
}
|
||||||
return res;
|
return cmp1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clear() {
|
private void clear() {
|
||||||
|
|
Loading…
Reference in a new issue