soc.2009.transport: d21cd2f6: Working chat_remove_users handler
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Wed Jun 10 07:36:14 EDT 2009
-----------------------------------------------------------------
Revision: d21cd2f64ef6854df36a0aede0d6c112fa1fd5e6
Ancestor: 26b9f581f22ef2cb05f2b4caf0ce29181dc47d2f
Author: hanzz at soc.pidgin.im
Date: 2009-06-10T11:30:55
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/d21cd2f64ef6854df36a0aede0d6c112fa1fd5e6
Modified files:
main.cpp main.h muchandler.cpp muchandler.h user.cpp user.h
ChangeLog:
Working chat_remove_users handler
-------------- next part --------------
============================================================
--- main.cpp 108eb47ef7a67d21b07af57566162b7988c6213d
+++ main.cpp 1e1599c31facbb39a8ba6f828a599164a4ef601f
@@ -120,6 +120,10 @@ static void conv_chat_rename_user(Purple
GlooxMessageHandler::instance()->purpleChatRenameUser(conv, old_name, new_name, new_alias);
}
+static void conv_chat_remove_users(PurpleConversation *conv, GList *users) {
+ GlooxMessageHandler::instance()->purpleChatRemoveUsers(conv, users);
+}
+
/*
* Called when user is logged in...
*/
@@ -392,7 +396,7 @@ static PurpleConversationUiOps conversat
NULL,//pidgin_conv_write_conv, /* write_conv */
conv_chat_add_users, /* chat_add_users */
conv_chat_rename_user, /* chat_rename_user */
- NULL,//pidgin_conv_chat_remove_users, /* chat_remove_users */
+ conv_chat_remove_users, /* chat_remove_users */
NULL,//pidgin_conv_chat_update_user, /* chat_update_user */
NULL,//pidgin_conv_present_conversation, /* present */
NULL,//pidgin_conv_has_focus, /* has_focus */
@@ -916,6 +920,16 @@ void GlooxMessageHandler::purpleChatRena
}
}
+void GlooxMessageHandler::purpleChatRemoveUsers(PurpleConversation *conv, GList *users) {
+ PurpleAccount *account = purple_conversation_get_account(conv);
+ User *user = userManager()->getUserByAccount(account);
+ if (user) {
+ if (user->isConnected()){
+ user->purpleChatRemoveUsers(conv, users);
+ }
+ }
+}
+
void GlooxMessageHandler::purpleBuddyChanged(PurpleBuddy* buddy){
if (buddy!=NULL){
PurpleAccount *a=purple_buddy_get_account(buddy);
============================================================
--- main.h 715981f6a4a14711fcf38c11674faf5c410b1eb6
+++ main.h 64bc2ecaab87aa67a616e6b6749dcd7933f3fb40
@@ -161,6 +161,7 @@ public:
void purpleConversationWriteChat(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime);
void purpleChatAddUsers(PurpleConversation *conv, GList *cbuddies, gboolean new_arrivals);
void purpleChatRenameUser(PurpleConversation *conv, const char *old_name, const char *new_name, const char *new_alias);
+ void purpleChatRemoveUsers(PurpleConversation *conv, GList *users);
void * purpleAuthorizeReceived(PurpleAccount *account,const char *remote_user,const char *id,const char *alias,const char *message,gboolean on_list,PurpleAccountRequestAuthorizationCb authorize_cb,PurpleAccountRequestAuthorizationCb deny_cb,void *user_data);
void purpleBuddyTyping(PurpleAccount *account, const char *who);
void purpleBuddyTypingStopped(PurpleAccount *account, const char *who);
============================================================
--- muchandler.cpp e6929232eac44611025e73b3b5a7a7928e663ec3
+++ muchandler.cpp a77a9e591a86e7fc6be2baf6c7b7c81b04bd68b6
@@ -140,3 +140,25 @@ void MUCHandler::renameUser(const char *
}
+void MUCHandler::removeUsers(GList *users) {
+ GList *l;
+ for (l = users; l != NULL; l = l->next) {
+ std::string user((char *)l->data);
+ Tag *tag = new Tag("presence");
+ tag->addAttribute("from", m_jid + "/" + user);
+ tag->addAttribute("to", m_userJid);
+ tag->addAttribute("type", "unavailable");
+
+ Tag *x = new Tag("x");
+ x->addAttribute("xmlns", "http://jabber.org/protocol/muc#user");
+
+ Tag *item = new Tag("item");
+ item->addAttribute("affiliation", "member");
+ item->addAttribute("role", "participant");
+
+ x->addChild(item);
+ tag->addChild(x);
+ m_user->p->j->send(tag);
+ }
+}
+
============================================================
--- muchandler.h 8f104ea2e1ce45bf86a3013392f93b8cd2b1c19e
+++ muchandler.h 549406e9de603c1d05b2885da2448bb717b4ed22
@@ -40,6 +40,7 @@ class MUCHandler
void addUsers(GList *cbuddies);
void messageReceived(const char *who, const char *msg, PurpleMessageFlags flags, time_t mtime);
void renameUser(const char *old_name, const char *new_name, const char *new_alias);
+ void removeUsers(GList *users);
private:
User *m_user;
============================================================
--- user.cpp 0db9c47147e31d935975f345427c37e67664eed0
+++ user.cpp 505f60568710fbdc8484555e42eadd816da7d227
@@ -554,6 +554,13 @@ void User::purpleChatRenameUser(PurpleCo
}
}
+void User::purpleChatRemoveUsers(PurpleConversation *conv, GList *users) {
+ MUCHandler *muc = (MUCHandler*) g_hash_table_lookup(m_mucs, purple_conversation_get_name(conv));
+ if (muc) {
+ muc->removeUsers(users);
+ }
+}
+
/*
* Called when legacy network user stops typing.
*/
============================================================
--- user.h 76cdabb3ee99a8aa9953f5c6be879a6d310a5c1f
+++ user.h 978873cc5fb92d2e754c3e90ad182515d47b9ca2
@@ -93,6 +93,7 @@ class User {
void purpleConversationWriteIM(PurpleConversation *conv, const char *who, const char *msg, PurpleMessageFlags flags, time_t mtime);
void purpleConversationWriteChat(PurpleConversation *conv, const char *who, const char *msg, PurpleMessageFlags flags, time_t mtime);
void purpleChatRenameUser(PurpleConversation *conv, const char *old_name, const char *new_name, const char *new_alias);
+ void purpleChatRemoveUsers(PurpleConversation *conv, GList *users);
void purpleChatAddUsers(PurpleConversation *conv, GList *cbuddies, gboolean new_arrivals);
void purpleAuthorizeReceived(PurpleAccount *account,const char *remote_user,const char *id,const char *alias,const char *message,gboolean on_list,PurpleAccountRequestAuthorizationCb authorize_cb,PurpleAccountRequestAuthorizationCb deny_cb,void *user_data);
void purpleBuddyTypingStopped(const std::string &uin);
More information about the Commits
mailing list