Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/talk/xmpp/mucroomuniquehangoutidtask.cc @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 1.3 KB
Line 
1// Copyright 2012 Google Inc. All Rights Reserved.
2
3
4#include "talk/xmpp/mucroomuniquehangoutidtask.h"
5
6#include "talk/xmpp/constants.h"
7
8namespace buzz {
9
10MucRoomUniqueHangoutIdTask::MucRoomUniqueHangoutIdTask(XmppTaskParentInterface* parent,
11                                             const Jid& lookup_server_jid)
12    : IqTask(parent, STR_GET, lookup_server_jid, MakeUniqueRequestXml()) {
13}
14
15// Construct a stanza to request a unique room id. eg:
16//
17// <unique hangout-id="true" xmlns="http://jabber.org/protocol/muc#unique"/>
18XmlElement* MucRoomUniqueHangoutIdTask::MakeUniqueRequestXml() {
19  XmlElement* xml = new XmlElement(QN_MUC_UNIQUE_QUERY, false);
20  xml->SetAttr(QN_HANGOUT_ID, STR_TRUE);
21  return xml;
22}
23
24// Handle a response like the following:
25//
26// <unique hangout-id="hangout_id"
27//    xmlns="http://jabber.org/protocol/muc#unique"/>
28//  muvc-private-chat-guid@groupchat.google.com
29// </unique>
30void MucRoomUniqueHangoutIdTask::HandleResult(const XmlElement* stanza) {
31
32  const XmlElement* unique_elem = stanza->FirstNamed(QN_MUC_UNIQUE_QUERY);
33  if (unique_elem == NULL ||
34      !unique_elem->HasAttr(QN_HANGOUT_ID)) {
35    SignalError(this, stanza);
36    return;
37  }
38
39  std::string hangout_id = unique_elem->Attr(QN_HANGOUT_ID);
40
41  SignalResult(this, hangout_id);
42}
43
44} // namespace buzz
Note: See TracBrowser for help on using the repository browser.