OLD | NEW |
(Empty) | |
| 1 // Copyright 2004 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "third_party/xmpp/moduleimpl.h" |
| 6 #include "webrtc/base/common.h" |
| 7 |
| 8 namespace buzz { |
| 9 |
| 10 XmppModuleImpl::XmppModuleImpl() : |
| 11 engine_(NULL), |
| 12 stanza_handler_(this) { |
| 13 } |
| 14 |
| 15 XmppModuleImpl::~XmppModuleImpl() |
| 16 { |
| 17 if (engine_ != NULL) { |
| 18 engine_->RemoveStanzaHandler(&stanza_handler_); |
| 19 engine_ = NULL; |
| 20 } |
| 21 } |
| 22 |
| 23 XmppReturnStatus |
| 24 XmppModuleImpl::RegisterEngine(XmppEngine* engine) |
| 25 { |
| 26 if (NULL == engine || NULL != engine_) |
| 27 return XMPP_RETURN_BADARGUMENT; |
| 28 |
| 29 engine->AddStanzaHandler(&stanza_handler_); |
| 30 engine_ = engine; |
| 31 |
| 32 return XMPP_RETURN_OK; |
| 33 } |
| 34 |
| 35 XmppEngine* |
| 36 XmppModuleImpl::engine() { |
| 37 ASSERT(NULL != engine_); |
| 38 return engine_; |
| 39 } |
| 40 |
| 41 } |
| 42 |
OLD | NEW |