Handle unknown own MUC jid better
This commit is contained in:
parent
fbd70ceaac
commit
13d3d2aca6
|
@ -68,17 +68,22 @@ public class MessageCorrection : StreamInteractionModule, MessageListener {
|
|||
public bool is_own_correction_allowed(Conversation conversation, Message message) {
|
||||
string stanza_id = message.edit_to ?? message.stanza_id;
|
||||
|
||||
Jid own_jid = conversation.account.full_jid;
|
||||
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
|
||||
Jid? own_jid = null;
|
||||
if (conversation.type_ == Conversation.Type.CHAT) {
|
||||
own_jid = conversation.account.full_jid;
|
||||
} else if (conversation.type_ == Conversation.Type.GROUPCHAT) {
|
||||
own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
|
||||
}
|
||||
|
||||
if (own_jid == null) return false;
|
||||
|
||||
return last_messages.has_key(conversation) &&
|
||||
last_messages[conversation].has_key(own_jid) &&
|
||||
last_messages[conversation][own_jid].stanza_id == stanza_id;
|
||||
}
|
||||
|
||||
private void check_add_correction_node(Entities.Message message, Xmpp.MessageStanza message_stanza, Conversation conversation) {
|
||||
if (message.stanza_id in outstanding_correction_nodes) {
|
||||
if (outstanding_correction_nodes.has_key(message.stanza_id)) {
|
||||
LastMessageCorrection.set_replace_id(message_stanza, outstanding_correction_nodes[message.stanza_id]);
|
||||
outstanding_correction_nodes.unset(message.stanza_id);
|
||||
} else {
|
||||
|
|
|
@ -48,6 +48,9 @@ public class NotificationEvents : StreamInteractionModule, Object {
|
|||
|
||||
private bool should_notify(ContentItem content_item, Conversation conversation) {
|
||||
Conversation.NotifySetting notify = conversation.get_notification_setting(stream_interactor);
|
||||
|
||||
if (notify == Conversation.NotifySetting.OFF) return false;
|
||||
|
||||
switch (content_item.type_) {
|
||||
case MessageItem.TYPE:
|
||||
Message message = (content_item as MessageItem).message;
|
||||
|
@ -60,13 +63,13 @@ public class NotificationEvents : StreamInteractionModule, Object {
|
|||
if (file_transfer.direction == FileTransfer.DIRECTION_SENT) return false;
|
||||
break;
|
||||
}
|
||||
if (notify == Conversation.NotifySetting.OFF) return false;
|
||||
Jid? nick = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
|
||||
if (content_item.type_ == MessageItem.TYPE) {
|
||||
|
||||
if (content_item.type_ == MessageItem.TYPE && notify == Conversation.NotifySetting.HIGHLIGHT) {
|
||||
Jid? nick = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
|
||||
if (nick == null) return false;
|
||||
|
||||
Entities.Message message = (content_item as MessageItem).message;
|
||||
if (notify == Conversation.NotifySetting.HIGHLIGHT && nick != null) {
|
||||
return Regex.match_simple("\\b" + Regex.escape_string(nick.resourcepart) + "\\b", message.body, RegexCompileFlags.CASELESS);
|
||||
}
|
||||
return Regex.match_simple("\\b" + Regex.escape_string(nick.resourcepart) + "\\b", message.body, RegexCompileFlags.CASELESS);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue