summaryrefslogtreecommitdiff
path: root/src/abaddon.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-08-12 18:35:58 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-08-12 18:35:58 -0400
commit6a5ecb4d9584f7276cf1d592c95811a66943f61c (patch)
tree2c09268db37461ce9e1882789183c508bb36dd4a /src/abaddon.cpp
parentdc28eae95a46c3079fcc76b3425ffa37844dd37d (diff)
parentf60cea2216dd9677cb9105364cdaa778a0c187db (diff)
downloadabaddon-portaudio-6a5ecb4d9584f7276cf1d592c95811a66943f61c.tar.gz
abaddon-portaudio-6a5ecb4d9584f7276cf1d592c95811a66943f61c.zip
Merge branch 'attachments'
Diffstat (limited to 'src/abaddon.cpp')
-rw-r--r--src/abaddon.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/abaddon.cpp b/src/abaddon.cpp
index 08e6857..e296aa4 100644
--- a/src/abaddon.cpp
+++ b/src/abaddon.cpp
@@ -11,6 +11,7 @@
#include "dialogs/setstatus.hpp"
#include "dialogs/friendpicker.hpp"
#include "dialogs/verificationgate.hpp"
+#include "dialogs/textinput.hpp"
#include "abaddon.hpp"
#include "windows/guildsettingswindow.hpp"
#include "windows/profilewindow.hpp"
@@ -741,17 +742,13 @@ void Abaddon::ActionChatLoadHistory(Snowflake id) {
});
}
-void Abaddon::ActionChatInputSubmit(std::string msg, Snowflake channel, Snowflake referenced_message) {
- if (msg.substr(0, 7) == "/shrug " || msg == "/shrug")
- msg = msg.substr(6) + "\xC2\xAF\x5C\x5F\x28\xE3\x83\x84\x29\x5F\x2F\xC2\xAF"; // this is important
+void Abaddon::ActionChatInputSubmit(ChatSubmitParams data) {
+ if (data.Message.substr(0, 7) == "/shrug " || data.Message == "/shrug")
+ data.Message = data.Message.substr(6) + "\xC2\xAF\x5C\x5F\x28\xE3\x83\x84\x29\x5F\x2F\xC2\xAF"; // this is important
- if (!channel.IsValid()) return;
- if (!m_discord.HasChannelPermission(m_discord.GetUserData().ID, channel, Permission::VIEW_CHANNEL)) return;
+ if (!m_discord.HasChannelPermission(m_discord.GetUserData().ID, data.ChannelID, Permission::VIEW_CHANNEL)) return;
- if (referenced_message.IsValid())
- m_discord.SendChatMessage(msg, channel, referenced_message);
- else
- m_discord.SendChatMessage(msg, channel);
+ m_discord.SendChatMessage(data, NOOP_CALLBACK);
}
void Abaddon::ActionChatEditMessage(Snowflake channel_id, Snowflake id) {
@@ -860,6 +857,15 @@ void Abaddon::ActionViewThreads(Snowflake channel_id) {
window->show();
}
+std::optional<Glib::ustring> Abaddon::ShowTextPrompt(const Glib::ustring &prompt, const Glib::ustring &title, const Glib::ustring &placeholder, Gtk::Window *window) {
+ TextInputDialog dlg(prompt, title, placeholder, window != nullptr ? *window : *m_main_window);
+ const auto code = dlg.run();
+ if (code == Gtk::RESPONSE_OK)
+ return dlg.GetInput();
+ else
+ return {};
+}
+
bool Abaddon::ShowConfirm(const Glib::ustring &prompt, Gtk::Window *window) {
ConfirmDialog dlg(window != nullptr ? *window : *m_main_window);
dlg.SetConfirmText(prompt);