Changeset - 2b338d77da37
[Not reviewed]
0 3 0
Jan Kaluza - 14 years ago 2011-05-25 16:46:40
hanzz.k@gmail.com
Messaging using libpurple backend works again
3 files changed with 7 insertions and 5 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/main.cpp
Show inline comments
 
@@ -71,12 +71,13 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
 
				Log(user, "creating new account");
 
				account = purple_account_new(legacyName.c_str(), protocol);
 

	
 
				purple_accounts_add(account);
 
			}
 

	
 
			m_sessions[user] = account;
 
			purple_account_set_password(account, password.c_str());
 
			purple_account_set_enabled(account, "spectrum", TRUE);
 
			
 
			const PurpleStatusType *status_type = purple_account_get_status_type_with_primitive(account, PURPLE_STATUS_AVAILABLE);
 
			if (status_type != NULL) {
 
				purple_account_set_status(account, purple_status_type_get_id(status_type), TRUE, NULL);
 
@@ -85,12 +86,13 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
 
		}
 

	
 
		void handleLogoutRequest(const std::string &user, const std::string &legacyName) {
 
			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.
 
				// This has to be called before m_account->ui_data = NULL;, because it uses
 
				// ui_data to call SpectrumMessageHandler::purpleConversationDestroyed() callback.
 
				GList *iter;
 
@@ -106,25 +108,25 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
 
				m_accounts.erase(account);
 
			}
 
		}
 

	
 
		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) {
 
					conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, legacyName.c_str());
 
				}
 
				gchar *_markup = purple_markup_escape_text(message.c_str(), -1);
 
				purple_conv_im_send(PURPLE_CONV_IM(conv), _markup);
 
				g_free(_markup);
 
			}
 
		}
 

	
 
		std::map<std::string, PurpleAccount *> m_sessions;
 
		std::map<PurpleAccount *, std::string> m_accounts;
 
	private:
 
		Config *config;
 
};
 

	
 
static std::string getAlias(PurpleBuddy *m_buddy) {
docs/Doxyfile
Show inline comments
 
@@ -1442,13 +1442,13 @@ DIRECTORY_GRAPH        = YES
 

	
 
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 
 
# \dotfile command).
 

	
 
DOTFILE_DIRS           = 
spectrum/src/sample.cfg
Show inline comments
 
[service]
 
jid = localhost
 
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]
 
database = test.sql
 
prefix=icq
0 comments (0 inline, 0 general)