loudmouth/inc/loudmouth/lm-message.h
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
       
     2 /*
       
     3  * Copyright (C) 2003 Imendio AB
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Lesser General Public License as
       
     7  * published by the Free Software Foundation; either version 2 of the
       
     8  * License, or (at your option) any later version.
       
     9  *
       
    10  * This program is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Lesser General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Lesser General Public
       
    16  * License along with this program; if not, write to the
       
    17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    18  * Boston, MA 02111-1307, USA.
       
    19  */
       
    20 
       
    21 #ifndef __LM_MESSAGE_H__
       
    22 #define __LM_MESSAGE_H__
       
    23 
       
    24 #if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
       
    25 #error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
       
    26 #endif
       
    27 
       
    28 #include "loudmouth/lm-message-node.h"
       
    29 
       
    30 G_BEGIN_DECLS
       
    31 
       
    32 typedef struct LmMessagePriv LmMessagePriv;
       
    33 
       
    34 typedef struct {
       
    35 	LmMessageNode *node;
       
    36 
       
    37 	LmMessagePriv *priv;
       
    38 } LmMessage;
       
    39 
       
    40 typedef enum {
       
    41 	LM_MESSAGE_TYPE_MESSAGE,
       
    42 	LM_MESSAGE_TYPE_PRESENCE,
       
    43 	LM_MESSAGE_TYPE_IQ,
       
    44 	LM_MESSAGE_TYPE_STREAM,
       
    45 	LM_MESSAGE_TYPE_STREAM_ERROR,
       
    46 	LM_MESSAGE_TYPE_STREAM_FEATURES,
       
    47 	LM_MESSAGE_TYPE_AUTH,
       
    48 	LM_MESSAGE_TYPE_CHALLENGE,
       
    49 	LM_MESSAGE_TYPE_RESPONSE,
       
    50 	LM_MESSAGE_TYPE_SUCCESS,
       
    51 	LM_MESSAGE_TYPE_FAILURE,
       
    52 	LM_MESSAGE_TYPE_PROCEED,
       
    53 	LM_MESSAGE_TYPE_STARTTLS,
       
    54 	LM_MESSAGE_TYPE_UNKNOWN
       
    55 } LmMessageType;
       
    56 
       
    57 typedef enum {
       
    58         LM_MESSAGE_SUB_TYPE_NOT_SET = -10,
       
    59 	LM_MESSAGE_SUB_TYPE_AVAILABLE = -1,
       
    60 	LM_MESSAGE_SUB_TYPE_NORMAL = 0,
       
    61 	LM_MESSAGE_SUB_TYPE_CHAT,
       
    62         LM_MESSAGE_SUB_TYPE_GROUPCHAT,
       
    63         LM_MESSAGE_SUB_TYPE_HEADLINE,
       
    64         LM_MESSAGE_SUB_TYPE_UNAVAILABLE,
       
    65         LM_MESSAGE_SUB_TYPE_PROBE,
       
    66         LM_MESSAGE_SUB_TYPE_SUBSCRIBE,
       
    67         LM_MESSAGE_SUB_TYPE_UNSUBSCRIBE,
       
    68         LM_MESSAGE_SUB_TYPE_SUBSCRIBED,
       
    69         LM_MESSAGE_SUB_TYPE_UNSUBSCRIBED,
       
    70 	LM_MESSAGE_SUB_TYPE_GET,
       
    71 	LM_MESSAGE_SUB_TYPE_SET,
       
    72 	LM_MESSAGE_SUB_TYPE_RESULT,
       
    73 	LM_MESSAGE_SUB_TYPE_ERROR
       
    74 } LmMessageSubType;
       
    75 
       
    76 IMPORT_C LmMessage *      lm_message_new               (const gchar      *to,
       
    77 					       LmMessageType     type);
       
    78 IMPORT_C LmMessage *      lm_message_new_with_sub_type (const gchar      *to,
       
    79 					       LmMessageType     type,
       
    80 					       LmMessageSubType  sub_type);
       
    81 IMPORT_C LmMessageType    lm_message_get_type          (LmMessage        *message);
       
    82 IMPORT_C LmMessageSubType lm_message_get_sub_type      (LmMessage        *message);
       
    83 IMPORT_C LmMessageNode *  lm_message_get_node          (LmMessage        *message);
       
    84 IMPORT_C LmMessage *      lm_message_ref               (LmMessage        *message);
       
    85 IMPORT_C void             lm_message_unref             (LmMessage        *message);
       
    86 
       
    87 G_END_DECLS
       
    88 
       
    89 #endif /* __LM_MESSAGE_H__ */