| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <iostream> | 12 #include <iostream> |
| 13 #include <map> | 13 #include <map> |
| 14 #include <memory> |
| 14 #include <sstream> | 15 #include <sstream> |
| 15 #include <string> | 16 #include <string> |
| 16 #include <vector> | 17 #include <vector> |
| 17 #include "webrtc/libjingle/xmpp/chatroommodule.h" | 18 #include "webrtc/libjingle/xmpp/chatroommodule.h" |
| 18 #include "webrtc/libjingle/xmpp/constants.h" | 19 #include "webrtc/libjingle/xmpp/constants.h" |
| 19 #include "webrtc/libjingle/xmpp/moduleimpl.h" | 20 #include "webrtc/libjingle/xmpp/moduleimpl.h" |
| 20 #include "webrtc/base/arraysize.h" | 21 #include "webrtc/base/arraysize.h" |
| 21 #include "webrtc/base/common.h" | 22 #include "webrtc/base/common.h" |
| 22 | 23 |
| 23 namespace buzz { | 24 namespace buzz { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 ~XmppChatroomMemberImpl() {} | 99 ~XmppChatroomMemberImpl() {} |
| 99 XmppReturnStatus SetPresence(const XmppPresence* presence); | 100 XmppReturnStatus SetPresence(const XmppPresence* presence); |
| 100 | 101 |
| 101 // XmppChatroomMember | 102 // XmppChatroomMember |
| 102 const Jid member_jid() const; | 103 const Jid member_jid() const; |
| 103 const Jid full_jid() const; | 104 const Jid full_jid() const; |
| 104 const std::string name() const; | 105 const std::string name() const; |
| 105 const XmppPresence* presence() const; | 106 const XmppPresence* presence() const; |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 rtc::scoped_ptr<XmppPresence> presence_; | 109 std::unique_ptr<XmppPresence> presence_; |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 class XmppChatroomMemberEnumeratorImpl : | 112 class XmppChatroomMemberEnumeratorImpl : |
| 112 public XmppChatroomMemberEnumerator { | 113 public XmppChatroomMemberEnumerator { |
| 113 public: | 114 public: |
| 114 XmppChatroomMemberEnumeratorImpl(XmppChatroomModuleImpl::JidMemberMap* chatroo
m_jid_members, | 115 XmppChatroomMemberEnumeratorImpl(XmppChatroomModuleImpl::JidMemberMap* chatroo
m_jid_members, |
| 115 int* map_version); | 116 int* map_version); |
| 116 | 117 |
| 117 // XmppChatroomMemberEnumerator | 118 // XmppChatroomMemberEnumerator |
| 118 virtual XmppChatroomMember* current(); | 119 virtual XmppChatroomMember* current(); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 { XMPP_CHATROOM_STATE_REQUESTED_EXIT, XMPP_CHATROOM_STATE_REQUESTED_ENTER, fa
lse, false, TRANSITION_TYPE_NONE, }, | 424 { XMPP_CHATROOM_STATE_REQUESTED_EXIT, XMPP_CHATROOM_STATE_REQUESTED_ENTER, fa
lse, false, TRANSITION_TYPE_NONE, }, |
| 424 { XMPP_CHATROOM_STATE_REQUESTED_EXIT, XMPP_CHATROOM_STATE_IN_ROOM, fa
lse, false, TRANSITION_TYPE_NONE, }, | 425 { XMPP_CHATROOM_STATE_REQUESTED_EXIT, XMPP_CHATROOM_STATE_IN_ROOM, fa
lse, false, TRANSITION_TYPE_NONE, }, |
| 425 }; | 426 }; |
| 426 | 427 |
| 427 | 428 |
| 428 | 429 |
| 429 void | 430 void |
| 430 XmppChatroomModuleImpl::FireEnteredStatus(const XmlElement* presence, | 431 XmppChatroomModuleImpl::FireEnteredStatus(const XmlElement* presence, |
| 431 XmppChatroomEnteredStatus status) { | 432 XmppChatroomEnteredStatus status) { |
| 432 if (chatroom_handler_) { | 433 if (chatroom_handler_) { |
| 433 rtc::scoped_ptr<XmppPresence> xmpp_presence(XmppPresence::Create()); | 434 std::unique_ptr<XmppPresence> xmpp_presence(XmppPresence::Create()); |
| 434 xmpp_presence->set_raw_xml(presence); | 435 xmpp_presence->set_raw_xml(presence); |
| 435 chatroom_handler_->ChatroomEnteredStatus(this, xmpp_presence.get(), status); | 436 chatroom_handler_->ChatroomEnteredStatus(this, xmpp_presence.get(), status); |
| 436 } | 437 } |
| 437 } | 438 } |
| 438 | 439 |
| 439 void | 440 void |
| 440 XmppChatroomModuleImpl::FireExitStatus(XmppChatroomExitedStatus status) { | 441 XmppChatroomModuleImpl::FireExitStatus(XmppChatroomExitedStatus status) { |
| 441 if (chatroom_handler_) | 442 if (chatroom_handler_) |
| 442 chatroom_handler_->ChatroomExitedStatus(this, status); | 443 chatroom_handler_->ChatroomExitedStatus(this, status); |
| 443 } | 444 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 465 XmppChatroomModuleImpl::FireMemberExited(const XmppChatroomMember* exited_member
) { | 466 XmppChatroomModuleImpl::FireMemberExited(const XmppChatroomMember* exited_member
) { |
| 466 if (chatroom_handler_) | 467 if (chatroom_handler_) |
| 467 chatroom_handler_->MemberExited(this, exited_member); | 468 chatroom_handler_->MemberExited(this, exited_member); |
| 468 } | 469 } |
| 469 | 470 |
| 470 | 471 |
| 471 XmppReturnStatus | 472 XmppReturnStatus |
| 472 XmppChatroomModuleImpl::ServerChangedOtherPresence(const XmlElement& | 473 XmppChatroomModuleImpl::ServerChangedOtherPresence(const XmlElement& |
| 473 presence_element) { | 474 presence_element) { |
| 474 XmppReturnStatus xmpp_status = XMPP_RETURN_OK; | 475 XmppReturnStatus xmpp_status = XMPP_RETURN_OK; |
| 475 rtc::scoped_ptr<XmppPresence> presence(XmppPresence::Create()); | 476 std::unique_ptr<XmppPresence> presence(XmppPresence::Create()); |
| 476 IFR(presence->set_raw_xml(&presence_element)); | 477 IFR(presence->set_raw_xml(&presence_element)); |
| 477 | 478 |
| 478 JidMemberMap::iterator pos = chatroom_jid_members_.find(presence->jid()); | 479 JidMemberMap::iterator pos = chatroom_jid_members_.find(presence->jid()); |
| 479 | 480 |
| 480 if (pos == chatroom_jid_members_.end()) { | 481 if (pos == chatroom_jid_members_.end()) { |
| 481 if (presence->available() == XMPP_PRESENCE_AVAILABLE) { | 482 if (presence->available() == XMPP_PRESENCE_AVAILABLE) { |
| 482 XmppChatroomMemberImpl* member = new XmppChatroomMemberImpl(); | 483 XmppChatroomMemberImpl* member = new XmppChatroomMemberImpl(); |
| 483 member->SetPresence(presence.get()); | 484 member->SetPresence(presence.get()); |
| 484 chatroom_jid_members_.insert(std::make_pair(member->member_jid(), member))
; | 485 chatroom_jid_members_.insert(std::make_pair(member->member_jid(), member))
; |
| 485 chatroom_jid_members_version_++; | 486 chatroom_jid_members_version_++; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 } | 728 } |
| 728 | 729 |
| 729 bool | 730 bool |
| 730 XmppChatroomMemberEnumeratorImpl::IsAfterEnd() { | 731 XmppChatroomMemberEnumeratorImpl::IsAfterEnd() { |
| 731 return (iterator_ == map_->end()); | 732 return (iterator_ == map_->end()); |
| 732 } | 733 } |
| 733 | 734 |
| 734 | 735 |
| 735 | 736 |
| 736 } // namespace buzz | 737 } // namespace buzz |
| OLD | NEW |