loudmouth/lm-message.h
author Samuel Tesla <stesla@engineyard.com>
Mon, 09 Mar 2009 18:05:59 -0500
changeset 593 2c04915af500
parent 518 cdd6a0c5b439
child 607 e2bd14357c9a
permissions -rw-r--r--
Update release information files. * Combined AUTHORS and CONTRIBUTORS. * Added some more folks to the AUTHORS file based on commit history. * Added Makefile recipe to dynamically generate ChangeLog from last annotated tag or a specified ref. * Added ignores for tarballs and ChangeLog.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
516
4dd3aa6b83e5 Change the tab width to 4 steps in the emacs headers
Mikael Hallendal <micke@imendio.com>
parents: 515
diff changeset
     1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     2
/*
99
81e9d035de02 2004-10-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 84
diff changeset
     3
 * Copyright (C) 2003 Imendio AB
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     4
 *
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     6
 * modify it under the terms of the GNU Lesser General Public License as
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     7
 * published by the Free Software Foundation; either version 2 of the
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     8
 * License, or (at your option) any later version.
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     9
 *
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    13
 * Lesser General Public License for more details.
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    14
 *
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    15
 * You should have received a copy of the GNU Lesser General Public
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    16
 * License along with this program; if not, write to the
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    18
 * Boston, MA 02111-1307, USA.
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    19
 */
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    20
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    21
#ifndef __LM_MESSAGE_H__
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    22
#define __LM_MESSAGE_H__
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    23
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    24
#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    25
#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    26
#endif
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    27
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    28
#include <loudmouth/lm-message-node.h>
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    29
101
a8abfbc8c005 2004-10-22 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
    30
G_BEGIN_DECLS
a8abfbc8c005 2004-10-22 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
    31
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    32
typedef struct LmMessagePriv LmMessagePriv;
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    33
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    34
typedef struct {
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    35
    LmMessageNode *node;
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    36
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    37
    LmMessagePriv *priv;
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    38
} LmMessage;
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    39
417
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    40
/**
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    41
 * LmMessageType:
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    42
 * @LM_MESSAGE_TYPE_MESSAGE: a message, <message/>
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    43
 * @LM_MESSAGE_TYPE_PRESENCE: a presence element, <presence/>
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    44
 * @LM_MESSAGE_TYPE_IQ: an info/query element, <iq/>
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    45
 * @LM_MESSAGE_TYPE_STREAM: the stream:stream element, you probably don't need to create a message of this type.
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    46
 * @LM_MESSAGE_TYPE_STREAM_ERROR: a stream:error element
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    47
 * @LM_MESSAGE_TYPE_STREAM_FEATURES:  * @LM_MESSAGE_TYPE_AUTH:  * @LM_MESSAGE_TYPE_CHALLENGE:  * @LM_MESSAGE_TYPE_RESPONSE:  * @LM_MESSAGE_TYPE_SUCCESS:  * @LM_MESSAGE_TYPE_FAILURE:  * @LM_MESSAGE_TYPE_PROCEED:  * @LM_MESSAGE_TYPE_STARTTLS:  * @LM_MESSAGE_TYPE_UNKNOWN: incoming message is of some unknown type.
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    48
 * 
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    49
 * Describes what type of message a message is. This maps directly to top level elements in the jabber protocol.
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    50
 */
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    51
typedef enum {
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    52
    LM_MESSAGE_TYPE_MESSAGE,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    53
    LM_MESSAGE_TYPE_PRESENCE,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    54
    LM_MESSAGE_TYPE_IQ,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    55
    LM_MESSAGE_TYPE_STREAM,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    56
    LM_MESSAGE_TYPE_STREAM_ERROR,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    57
    LM_MESSAGE_TYPE_STREAM_FEATURES,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    58
    LM_MESSAGE_TYPE_AUTH,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    59
    LM_MESSAGE_TYPE_CHALLENGE,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    60
    LM_MESSAGE_TYPE_RESPONSE,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    61
    LM_MESSAGE_TYPE_SUCCESS,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    62
    LM_MESSAGE_TYPE_FAILURE,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    63
    LM_MESSAGE_TYPE_PROCEED,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    64
    LM_MESSAGE_TYPE_STARTTLS,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    65
    LM_MESSAGE_TYPE_UNKNOWN
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    66
} LmMessageType;
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    67
417
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    68
/**
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    69
 * LmMessageSubType:
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    70
 * @LM_MESSAGE_SUB_TYPE_NOT_SET: the default. No "type" attribute will be sent.
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    71
 * @LM_MESSAGE_SUB_TYPE_AVAILABLE: presence is available, applies to message type "presence"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    72
 * @LM_MESSAGE_SUB_TYPE_NORMAL:  * @LM_MESSAGE_SUB_TYPE_CHAT: message is a chat message, applies to message type "message"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    73
 * @LM_MESSAGE_SUB_TYPE_GROUPCHAT: message is a group chat message, applies to message type "message"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    74
 * @LM_MESSAGE_SUB_TYPE_HEADLINE: message is a headline message, applies to message type "message"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    75
 * @LM_MESSAGE_SUB_TYPE_UNAVAILABLE: presence is unavailable, applies to message type "presence"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    76
 * @LM_MESSAGE_SUB_TYPE_PROBE: a probe presence, applies to message type "presence"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    77
 * @LM_MESSAGE_SUB_TYPE_SUBSCRIBE: try to subscribe to another jids presence, applies to message type "presence"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    78
 * @LM_MESSAGE_SUB_TYPE_UNSUBSCRIBE: unsubscribes from another jids presence, applies to message type "presence"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    79
 * @LM_MESSAGE_SUB_TYPE_SUBSCRIBED: reply from a subscribe message, informs that the subscription was successful. Applies to message type "presence"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    80
 * @LM_MESSAGE_SUB_TYPE_UNSUBSCRIBED: reply from subscribe or unsubscribe message. If it's a reply from a subscribe message it notifies that the subscription failed. Applies to message type "presence"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    81
 * @LM_MESSAGE_SUB_TYPE_GET: used to get information from an IQ query, applies to message type "iq"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    82
 * @LM_MESSAGE_SUB_TYPE_SET: used to set information in a IQ call, applised to message type "iq"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    83
 * @LM_MESSAGE_SUB_TYPE_RESULT: message is an IQ reply, applies to message type "iq"
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    84
 * @LM_MESSAGE_SUB_TYPE_ERROR: messages is an error, applies to all message types.
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    85
 * 
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    86
 * Describes the sub type of a message. This is equal to the "type" attribute in the jabber protocol. What sub type a message can have is depending on the type of the message.
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 328
diff changeset
    87
 */
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    88
typedef enum {
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    89
    LM_MESSAGE_SUB_TYPE_NOT_SET = -10,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    90
    LM_MESSAGE_SUB_TYPE_AVAILABLE = -1,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    91
    LM_MESSAGE_SUB_TYPE_NORMAL = 0,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    92
    LM_MESSAGE_SUB_TYPE_CHAT,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    93
    LM_MESSAGE_SUB_TYPE_GROUPCHAT,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    94
    LM_MESSAGE_SUB_TYPE_HEADLINE,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    95
    LM_MESSAGE_SUB_TYPE_UNAVAILABLE,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    96
    LM_MESSAGE_SUB_TYPE_PROBE,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    97
    LM_MESSAGE_SUB_TYPE_SUBSCRIBE,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    98
    LM_MESSAGE_SUB_TYPE_UNSUBSCRIBE,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    99
    LM_MESSAGE_SUB_TYPE_SUBSCRIBED,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   100
    LM_MESSAGE_SUB_TYPE_UNSUBSCRIBED,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   101
    LM_MESSAGE_SUB_TYPE_GET,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   102
    LM_MESSAGE_SUB_TYPE_SET,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   103
    LM_MESSAGE_SUB_TYPE_RESULT,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   104
    LM_MESSAGE_SUB_TYPE_ERROR
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   105
} LmMessageSubType;
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   106
8
33d64cf345be 2003-06-15 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 7
diff changeset
   107
LmMessage *      lm_message_new               (const gchar      *to,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   108
                                               LmMessageType     type);
8
33d64cf345be 2003-06-15 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 7
diff changeset
   109
LmMessage *      lm_message_new_with_sub_type (const gchar      *to,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   110
                                               LmMessageType     type,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   111
                                               LmMessageSubType  sub_type);
8
33d64cf345be 2003-06-15 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 7
diff changeset
   112
LmMessageType    lm_message_get_type          (LmMessage        *message);
33d64cf345be 2003-06-15 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 7
diff changeset
   113
LmMessageSubType lm_message_get_sub_type      (LmMessage        *message);
33d64cf345be 2003-06-15 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 7
diff changeset
   114
LmMessageNode *  lm_message_get_node          (LmMessage        *message);
33d64cf345be 2003-06-15 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 7
diff changeset
   115
LmMessage *      lm_message_ref               (LmMessage        *message);
33d64cf345be 2003-06-15 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 7
diff changeset
   116
void             lm_message_unref             (LmMessage        *message);
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   117
101
a8abfbc8c005 2004-10-22 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
   118
G_END_DECLS
a8abfbc8c005 2004-10-22 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
   119
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   120
#endif /* __LM_MESSAGE_H__ */