mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
saving irc splits now
This commit is contained in:
parent
c4d0efacff
commit
2a8c5e654f
2 changed files with 22 additions and 2 deletions
|
@ -158,14 +158,15 @@ Irc &Irc::getInstance()
|
||||||
|
|
||||||
int Irc::uniqueId()
|
int Irc::uniqueId()
|
||||||
{
|
{
|
||||||
/// XXX: also check for channels
|
|
||||||
int i = this->currentId_ + 1;
|
int i = this->currentId_ + 1;
|
||||||
auto it = this->servers_.find(i);
|
auto it = this->servers_.find(i);
|
||||||
|
auto it2 = this->abandonedChannels_.find(i);
|
||||||
|
|
||||||
while (it != this->servers_.end())
|
while (it != this->servers_.end() || it2 != this->abandonedChannels_.end())
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
it = this->servers_.find(i);
|
it = this->servers_.find(i);
|
||||||
|
it2 = this->abandonedChannels_.find(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (this->currentId_ = i);
|
return (this->currentId_ = i);
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
#include "debug/AssertInGuiThread.hpp"
|
#include "debug/AssertInGuiThread.hpp"
|
||||||
#include "debug/Log.hpp"
|
#include "debug/Log.hpp"
|
||||||
#include "messages/MessageElement.hpp"
|
#include "messages/MessageElement.hpp"
|
||||||
|
#include "providers/irc/Irc2.hpp"
|
||||||
|
#include "providers/irc/IrcChannel2.hpp"
|
||||||
|
#include "providers/irc/IrcServer.hpp"
|
||||||
#include "providers/twitch/TwitchServer.hpp"
|
#include "providers/twitch/TwitchServer.hpp"
|
||||||
#include "singletons/Fonts.hpp"
|
#include "singletons/Fonts.hpp"
|
||||||
#include "singletons/Paths.hpp"
|
#include "singletons/Paths.hpp"
|
||||||
|
@ -612,6 +615,17 @@ void WindowManager::encodeChannel(IndirectChannel channel, QJsonObject &obj)
|
||||||
obj.insert("type", "whispers");
|
obj.insert("type", "whispers");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Channel::Type::Irc:
|
||||||
|
{
|
||||||
|
if (auto ircChannel =
|
||||||
|
dynamic_cast<IrcChannel *>(channel.get().get()))
|
||||||
|
{
|
||||||
|
obj.insert("type", "irc");
|
||||||
|
obj.insert("server", ircChannel->server()->id());
|
||||||
|
obj.insert("channel", ircChannel->getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,6 +653,11 @@ IndirectChannel WindowManager::decodeChannel(const QJsonObject &obj)
|
||||||
{
|
{
|
||||||
return app->twitch.server->whispersChannel;
|
return app->twitch.server->whispersChannel;
|
||||||
}
|
}
|
||||||
|
else if (type == "irc")
|
||||||
|
{
|
||||||
|
return Irc::getInstance().getOrAddChannel(
|
||||||
|
obj.value("server").toInt(-1), obj.value("channel").toString());
|
||||||
|
}
|
||||||
|
|
||||||
return Channel::getEmpty();
|
return Channel::getEmpty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue