Remove Slack message handling
This commit is contained in:
parent
d27fb963e7
commit
73cb6eaa49
|
@ -37,7 +37,6 @@ public class MessageProcessor : StreamInteractionModule, Object {
|
||||||
received_pipeline.connect(new FilterMessageListener());
|
received_pipeline.connect(new FilterMessageListener());
|
||||||
received_pipeline.connect(new StoreMessageListener(stream_interactor));
|
received_pipeline.connect(new StoreMessageListener(stream_interactor));
|
||||||
received_pipeline.connect(new MamMessageListener(stream_interactor));
|
received_pipeline.connect(new MamMessageListener(stream_interactor));
|
||||||
received_pipeline.connect(new SlackMessageListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entities.Message send_text(string text, Conversation conversation) {
|
public Entities.Message send_text(string text, Conversation conversation) {
|
||||||
|
@ -230,34 +229,6 @@ public class MessageProcessor : StreamInteractionModule, Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SlackMessageListener : MessageListener {
|
|
||||||
|
|
||||||
public string[] after_actions_const = new string[]{ "DEDUPLICATE" };
|
|
||||||
public override string action_group { get { return "SLACK"; } }
|
|
||||||
public override string[] after_actions { get { return after_actions_const; } }
|
|
||||||
|
|
||||||
public override async bool run(Entities.Message message, Xmpp.MessageStanza stanza, Conversation conversation) {
|
|
||||||
// Slack non-standard behavior
|
|
||||||
Account account = conversation.account;
|
|
||||||
if (account.domainpart.index_of("xmpp.slack.com") == account.domainpart.length - 14) {
|
|
||||||
if (message.counterpart.equals_bare(account.bare_jid)) {
|
|
||||||
// Ignore messages from us, because we neither know which conversation they belong to, nor can match
|
|
||||||
// them to one of our send messages because of timestamp mismatches.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (message.direction == Entities.Message.DIRECTION_RECEIVED && stanza.type_ == "chat" && message.body.index_of("["+account.localpart+"] ") == 0) {
|
|
||||||
// That is the best thing we can do, although allowing for attacks.
|
|
||||||
message.direction = Entities.Message.DIRECTION_SENT;
|
|
||||||
message.body = message.body.substring(account.localpart.length + 3);
|
|
||||||
}
|
|
||||||
if (stanza.stanza.get_attribute("ts") != null) {
|
|
||||||
message.time = new DateTime.from_unix_utc((int64) double.parse(stanza.stanza.get_attribute("ts")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Entities.Message create_out_message(string text, Conversation conversation) {
|
public Entities.Message create_out_message(string text, Conversation conversation) {
|
||||||
Entities.Message message = new Entities.Message(text);
|
Entities.Message message = new Entities.Message(text);
|
||||||
message.type_ = Util.get_message_type_for_conversation(conversation);
|
message.type_ = Util.get_message_type_for_conversation(conversation);
|
||||||
|
|
Loading…
Reference in a new issue