summaryrefslogtreecommitdiff
path: root/src/xmpp/jid.cpp
blob: 78b28a0ac8031e3b6c46887f2b38643bc75555b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <xmpp/jid.hpp>

Jid::Jid(const std::string& jid)
{
  std::string::size_type at = jid.find("@");
  if (at != std::string::npos)
    {
      this->local = jid.substr(0, at);
      at++;
    }
  else
    at = 0;
  std::string::size_type slash = jid.find("/", at);
  if (slash != std::string::npos)
    {
      this->resource = jid.substr(slash + 1);
    }
  this->domain = jid.substr(at, slash - at);
}