Messaging using libpurple backend works again

This commit is contained in:
Jan Kaluza 2011-05-25 16:46:40 +02:00
parent 164704c8aa
commit 2b338d77da
3 changed files with 7 additions and 5 deletions

View file

@ -74,6 +74,7 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
purple_accounts_add(account);
}
m_sessions[user] = account;
purple_account_set_password(account, password.c_str());
purple_account_set_enabled(account, "spectrum", TRUE);
@ -88,6 +89,7 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
const char *protocol = CONFIG_STRING(config, "service.protocol").c_str();
PurpleAccount *account = purple_accounts_find(legacyName.c_str(), protocol);
if (account) {
m_sessions[user] = NULL;
purple_account_set_enabled(account, "spectrum", FALSE);
// Remove conversations.
@ -109,8 +111,7 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
void handleMessageSendRequest(const std::string &user, const std::string &legacyName, const std::string &message) {
const char *protocol = CONFIG_STRING(config, "service.protocol").c_str();
PurpleAccount *account = purple_accounts_find(user.c_str(), protocol);
std::cout << user << "\n";
PurpleAccount *account = m_sessions[user];
if (account) {
PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, legacyName.c_str(), account);
if (!conv) {
@ -122,6 +123,7 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
}
}
std::map<std::string, PurpleAccount *> m_sessions;
std::map<PurpleAccount *, std::string> m_accounts;
private:
Config *config;

View file

@ -1445,7 +1445,7 @@ DOT_IMAGE_FORMAT = png
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
DOT_PATH = "/usr/bin"
DOT_PATH = ""
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the

View file

@ -4,8 +4,8 @@ password = secret
server = 127.0.0.1
port = 5222
server_mode = 1
#backend=../../backends/libpurple/libpurple_backend
backend=../../backends/libircclient-qt/libircclient-qt_backend
backend=../../backends/libpurple/libpurple_backend
#backend=../../backends/libircclient-qt/libircclient-qt_backend
protocol=prpl-jabber
[database]