loudmouth/lm-feature-ping.c
author Frank Zschockelt <lm@freakysoft.de>
Sat, 11 May 2019 22:14:44 +0200
changeset 735 7ae46452fb10
parent 725 05fa3e01e5b1
permissions -rw-r--r--
Always signal a disconnect after connection_do_close()
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 -*- */
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
     2
/*
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
     3
 * Copyright (C) 2008 Imendio AB
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
     4
 *
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
     6
 * modify it under the terms of the GNU Lesser General Public License as
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
     7
 * published by the Free Software Foundation; either version 2 of the
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
     8
 * License, or (at your option) any later version.
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
     9
 *
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    13
 * Lesser General Public License for more details.
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    14
 *
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    15
 * You should have received a copy of the GNU Lesser General Public
690
7ccf2113ec5f Update the postal address of the FSF
Frank Zschockelt <lm@freakysoft.de>
parents: 624
diff changeset
    16
 * License along with this program; if not, see <https://www.gnu.org/licenses>
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    17
 */
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    18
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    19
#include <config.h>
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    20
506
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
    21
#include "lm-connection.h"
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    22
#include "lm-debug.h"
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    23
#include "lm-internals.h"
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    24
#include "lm-marshal.h"
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    25
#include "lm-misc.h"
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    26
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    27
#include "lm-feature-ping.h"
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    28
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    29
#define XMPP_NS_PING "urn:xmpp:ping"
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    30
725
05fa3e01e5b1 Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents: 690
diff changeset
    31
#define GET_PRIV(obj) (lm_feature_ping_get_instance_private (LM_FEATURE_PING(obj)))
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    32
725
05fa3e01e5b1 Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents: 690
diff changeset
    33
typedef struct LmFeaturePingPrivate LmFeaturePingPrivate;
05fa3e01e5b1 Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents: 690
diff changeset
    34
struct LmFeaturePingPrivate {
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
    LmConnection *connection;
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
    36
    guint         keep_alive_rate;
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
    GSource      *keep_alive_source;
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
    38
    guint         keep_alive_counter;
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    39
};
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    40
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    41
static void     feature_ping_finalize            (GObject           *object);
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    42
static void     feature_ping_get_property        (GObject           *object,
506
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
    43
                                                  guint              param_id,
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
    44
                                                  GValue            *value,
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
    45
                                                  GParamSpec        *pspec);
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    46
static void     feature_ping_set_property        (GObject           *object,
506
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
    47
                                                  guint              param_id,
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
    48
                                                  const GValue      *value,
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
    49
                                                  GParamSpec        *pspec);
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    50
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    51
static LmHandlerResult
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    52
feature_ping_keep_alive_reply                    (LmMessageHandler *handler,
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    53
                                                  LmConnection     *connection,
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    54
                                                  LmMessage        *m,
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    55
                                                  gpointer          user_data);
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    56
static gboolean feature_ping_send_keep_alive     (LmFeaturePing    *fp);
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
    57
725
05fa3e01e5b1 Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents: 690
diff changeset
    58
G_DEFINE_TYPE_WITH_PRIVATE (LmFeaturePing, lm_feature_ping, G_TYPE_OBJECT)
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    59
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    60
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
    61
    PROP_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
    62
    PROP_CONNECTION,
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
    PROP_RATE
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    64
};
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    65
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    66
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
    67
    TIMED_OUT,
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
    68
    LAST_SIGNAL
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    69
};
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    70
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    71
static guint signals[LAST_SIGNAL] = { 0 };
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    72
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    73
static void
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    74
lm_feature_ping_class_init (LmFeaturePingClass *class)
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    75
{
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
    76
    GObjectClass *object_class = G_OBJECT_CLASS (class);
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    77
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
    78
    object_class->finalize     = feature_ping_finalize;
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
    79
    object_class->get_property = feature_ping_get_property;
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
    80
    object_class->set_property = feature_ping_set_property;
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
    81
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
    82
    g_object_class_install_property (object_class,
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
    83
                                     PROP_CONNECTION,
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
    84
                                     g_param_spec_pointer ("connection",
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
    85
                                                           "Connection",
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
    86
                                                           "The LmConnection to use",
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
    87
                                                           G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
506
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
    88
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
    g_object_class_install_property (object_class,
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
                                     PROP_RATE,
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
                                     g_param_spec_uint ("rate",
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
                                                        "Timeout Rate",
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
                                                        "Keep alive rate in seconds",
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
                                                        0, G_MAXUINT,
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
                                                        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
    96
                                                        G_PARAM_READWRITE));
506
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
    97
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 521
diff changeset
    98
    signals[TIMED_OUT] =
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
    99
        g_signal_new ("timed-out",
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
                      G_OBJECT_CLASS_TYPE (object_class),
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
                      G_SIGNAL_RUN_LAST,
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
                      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
   103
                      NULL, NULL,
521
50294ce6587e Updated the build system to use a build directory and a common marshal Makefile.
Mikael Hallendal <micke@imendio.com>
parents: 518
diff changeset
   104
                      _lm_marshal_VOID__VOID,
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
   105
                      G_TYPE_NONE, 0);
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   106
}
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   107
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   108
static void
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   109
lm_feature_ping_init (LmFeaturePing *feature_ping)
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   110
{
624
a94013a4555d Fix some gcc warnings
Mikael Berthe <mikael@lilotux.net>
parents: 621
diff changeset
   111
    (void) GET_PRIV (feature_ping);
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   112
}
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   113
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   114
static void
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   115
feature_ping_finalize (GObject *object)
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   116
{
624
a94013a4555d Fix some gcc warnings
Mikael Berthe <mikael@lilotux.net>
parents: 621
diff changeset
   117
    (void) GET_PRIV (object);
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   118
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
   119
    (G_OBJECT_CLASS (lm_feature_ping_parent_class)->finalize) (object);
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   120
}
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   121
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   122
static void
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   123
feature_ping_get_property (GObject    *object,
506
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   124
                           guint       param_id,
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   125
                           GValue     *value,
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   126
                           GParamSpec *pspec)
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   127
{
725
05fa3e01e5b1 Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents: 690
diff changeset
   128
    LmFeaturePingPrivate *priv;
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   129
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
   130
    priv = GET_PRIV (object);
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   131
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
   132
    switch (param_id) {
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
   133
    case PROP_RATE:
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
   134
        g_value_set_uint (value, priv->keep_alive_rate);
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
   135
        break;
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
   136
    default:
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
   137
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
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
   138
        break;
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
   139
    };
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   140
}
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   141
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   142
static void
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   143
feature_ping_set_property (GObject      *object,
506
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   144
                           guint         param_id,
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   145
                           const GValue *value,
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   146
                           GParamSpec   *pspec)
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   147
{
725
05fa3e01e5b1 Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents: 690
diff changeset
   148
    LmFeaturePingPrivate *priv;
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   149
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
   150
    priv = GET_PRIV (object);
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   151
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
   152
    switch (param_id) {
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
   153
    case PROP_CONNECTION:
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
   154
        priv->connection = g_value_get_pointer (value);
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
   155
        break;
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
   156
    case PROP_RATE:
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
   157
        priv->keep_alive_rate = g_value_get_uint (value);
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
   158
        /* Restart the pings */
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
   159
        break;
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
   160
    default:
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
   161
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
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
   162
        break;
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
   163
    };
505
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   164
}
ba6f96b3e4a8 Added stubs for LmFeaturePing which will hold the XMPP Ping feature.
Mikael Hallendal <micke@imendio.com>
parents:
diff changeset
   165
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   166
static LmHandlerResult
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   167
feature_ping_keep_alive_reply (LmMessageHandler *handler,
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   168
                               LmConnection     *connection,
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   169
                               LmMessage        *m,
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   170
                               gpointer          user_data)
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   171
{
725
05fa3e01e5b1 Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents: 690
diff changeset
   172
    LmFeaturePingPrivate *priv;
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   173
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
   174
    priv = GET_PRIV (user_data);
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   175
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
   176
    priv->keep_alive_counter = 0;
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 521
diff changeset
   177
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
   178
    return LM_HANDLER_RESULT_REMOVE_MESSAGE;
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   179
}
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   180
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   181
static gboolean
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   182
feature_ping_send_keep_alive (LmFeaturePing *fp)
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   183
{
725
05fa3e01e5b1 Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents: 690
diff changeset
   184
    LmFeaturePingPrivate *priv;
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
   185
    LmMessage         *ping;
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
   186
    LmMessageNode     *ping_node;
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
   187
    LmMessageHandler  *keep_alive_handler;
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
   188
    gchar             *server;
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   189
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
   190
    priv = GET_PRIV (fp);
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   191
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
   192
    priv->keep_alive_counter++;
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
   193
    if (priv->keep_alive_counter > 3) {
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
   194
        g_signal_emit (fp, signals[TIMED_OUT], 0);
621
2313363bd272 Give up unneeded ping request on connection timeout
Hermitifier <quantifier666@gmail.com>
parents: 607
diff changeset
   195
       return FALSE;
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
   196
    }
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   197
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
   198
    server = _lm_connection_get_server (priv->connection);
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 521
diff changeset
   199
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
   200
    ping = lm_message_new_with_sub_type (server,
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
   201
                                         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
   202
                                         LM_MESSAGE_SUB_TYPE_GET);
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   203
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
   204
    ping_node = lm_message_node_add_child (ping->node, "ping", NULL);
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   205
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
   206
    lm_message_node_set_attribute (ping_node, "xmlns", XMPP_NS_PING);
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   207
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
   208
    keep_alive_handler =
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
   209
        lm_message_handler_new (feature_ping_keep_alive_reply,
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
   210
                                fp,
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
   211
                                FALSE);
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   212
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
   213
    if (!lm_connection_send_with_reply (priv->connection,
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
   214
                                        ping,
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
   215
                                        keep_alive_handler,
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
   216
                                        NULL)) {
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
   217
        lm_verbose ("Error while sending XMPP ping!\n");
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
   218
    }
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   219
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
   220
    lm_message_handler_unref (keep_alive_handler);
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
   221
    lm_message_unref (ping);
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
   222
    g_free (server);
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   223
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
   224
    return TRUE;
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   225
}
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   226
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   227
506
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   228
void
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   229
lm_feature_ping_start (LmFeaturePing *fp)
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   230
{
725
05fa3e01e5b1 Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents: 690
diff changeset
   231
    LmFeaturePingPrivate *priv;
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   232
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
   233
    g_return_if_fail (LM_IS_FEATURE_PING (fp));
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   234
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
   235
    priv = GET_PRIV (fp);
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   236
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
   237
    if (priv->keep_alive_source) {
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
   238
        lm_feature_ping_stop (fp);
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
   239
    }
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   240
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
   241
    if (priv->keep_alive_rate > 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
   242
        priv->keep_alive_counter = 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
   243
        priv->keep_alive_source =
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
   244
            lm_misc_add_timeout (_lm_connection_get_context (priv->connection),
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
   245
                                 priv->keep_alive_rate * 1000,
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
   246
                                 (GSourceFunc) feature_ping_send_keep_alive,
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
   247
                                 fp);
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
   248
    }
506
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   249
}
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   250
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   251
void
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   252
lm_feature_ping_stop (LmFeaturePing *fp)
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   253
{
725
05fa3e01e5b1 Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents: 690
diff changeset
   254
    LmFeaturePingPrivate *priv;
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   255
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
   256
    g_return_if_fail (LM_IS_FEATURE_PING (fp));
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   257
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
   258
    priv = GET_PRIV (fp);
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   259
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
   260
    if (priv->keep_alive_source) {
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
   261
        g_source_destroy (priv->keep_alive_source);
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
   262
    }
507
06e7b24dbcb3 Added the code from LmConnection to send and receive the XMPP Ping to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 506
diff changeset
   263
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
   264
    priv->keep_alive_source = NULL;
506
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   265
}
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   266
9d9be7000667 Added properties, signals and start/stop calls to LmFeaturePing.
Mikael Hallendal <micke@imendio.com>
parents: 505
diff changeset
   267