Add CallsAccountInterface
This interface should be implemented by origins which represent an online account. This means they must have a implement a property representing the credentials and another representing the account state (online, offline, etc).
This commit is contained in:
70
src/calls-account.h
Normal file
70
src/calls-account.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Purism SPC
|
||||
*
|
||||
* This file is part of Calls.
|
||||
*
|
||||
* Calls is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calls 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calls. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Evangelos Ribeiro Tzaras <evangelos.tzaras@puri.sm>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "calls-origin.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define CALLS_TYPE_ACCOUNT (calls_account_get_type ())
|
||||
|
||||
G_DECLARE_INTERFACE (CallsAccount, calls_account, CALLS, ACCOUNT, CallsOrigin);
|
||||
|
||||
|
||||
struct _CallsAccountInterface
|
||||
{
|
||||
GTypeInterface parent_iface;
|
||||
|
||||
void (*go_online) (CallsAccount *self,
|
||||
gboolean online);
|
||||
};
|
||||
/**
|
||||
* CallsAccountState:
|
||||
* @CALLS_ACCOUNT_NULL: Not initialized
|
||||
* @CALLS_ACCOUNT_OFFLINE: Account considered offline (not ready for placing or receiving calls)
|
||||
* @CALLS_ACCOUNT_CONNECTING: Trying to connect to server
|
||||
* @CALLS_ACCOUNT_CONNECTION_FAILURE: Could not connect to server (f.e. DNS error, unreachable)
|
||||
* @CALLS_ACCOUNT_AUTHENTICATING: Authenticating using web-auth/proxy-auth
|
||||
* @CALLS_ACCOUNT_AUTHENTICATION_FAILURE: Could not authenticate to server (f.e. wrong credentials)
|
||||
* @CALLS_ACCOUNT_ONLINE: Account considered online (can place and receive calls)
|
||||
*/
|
||||
typedef enum {
|
||||
CALLS_ACCOUNT_NULL = 0,
|
||||
CALLS_ACCOUNT_OFFLINE,
|
||||
CALLS_ACCOUNT_CONNECTING,
|
||||
CALLS_ACCOUNT_CONNECTION_FAILURE,
|
||||
CALLS_ACCOUNT_AUTHENTICATING,
|
||||
CALLS_ACCOUNT_AUTHENTICATION_FAILURE,
|
||||
CALLS_ACCOUNT_ONLINE
|
||||
} CallsAccountState;
|
||||
|
||||
|
||||
void calls_account_go_online (CallsAccount *self,
|
||||
gboolean online);
|
||||
|
||||
G_END_DECLS
|
||||
Reference in New Issue
Block a user