summaryrefslogtreecommitdiff
path: root/lib/loudmouth/lm-message.c
blob: d6a0c7925ddc0312f7c364bbb9a58a048ec55522 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * lm-message.c - Loudmouth-Wocky compatibility layer
 * Copyright (C) 2009 Collabora Ltd.
 * @author Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "lm-message.h"

LmMessage *
lm_message_new (const gchar *to,
    LmMessageType type)
{
  return wocky_stanza_build (type, WOCKY_STANZA_SUB_TYPE_NONE,
      NULL, to, NULL);
}

LmMessage *
lm_message_new_with_sub_type (const gchar *to,
    LmMessageType type,
    LmMessageSubType sub_type)
{
  return wocky_stanza_build (type, sub_type,
      NULL, to, NULL);
}

LmMessage *
lm_message_ref (LmMessage *message)
{
  return g_object_ref (message);
}

void
lm_message_unref (LmMessage *message)
{
  g_object_unref (message);
}

LmMessageType
lm_message_get_type (LmMessage *message)
{
  WockyStanzaType type;

  wocky_stanza_get_type_info (message, &type, NULL);
  return type;
}

LmMessageSubType
lm_message_get_sub_type (LmMessage *message)
{
  WockyStanzaSubType sub_type;

  wocky_stanza_get_type_info (message, NULL, &sub_type);
  return sub_type;
}

LmMessageNode *
lm_message_get_node (LmMessage *message)
{
  return wocky_stanza_get_top_node (message);
}