2021-06-23 23:57:27 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
|
|
|
|
*
|
|
|
|
* This program 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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PURPLE_MESSAGES_H
|
|
|
|
#define _PURPLE_MESSAGES_H
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
enum purple_message {
|
|
|
|
/*
|
|
|
|
* Messages between the Purple add-on and server
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*! Request a count of protocols. →Server
|
2021-07-04 11:31:32 -05:00
|
|
|
Response is sent directly to the requesting thread
|
|
|
|
as a message's code, use receive_data() to catch it.
|
|
|
|
Requires: int64 thread_id */
|
2021-06-26 20:40:39 -05:00
|
|
|
PURPLE_REQUEST_PROTOCOL_COUNT = 'PApc',
|
2021-06-23 23:57:27 -05:00
|
|
|
|
|
|
|
/*! Request protocol metadata. →Server
|
2021-07-04 11:31:32 -05:00
|
|
|
Response is sent directly to the requesting thread
|
|
|
|
with two subsquent messages (using receive_data())―
|
|
|
|
the first sending the size of the subsequently sent
|
|
|
|
flattened BMessage.
|
|
|
|
Requires: int32 protocol_index, int64 thread_id */
|
2021-06-26 20:40:39 -05:00
|
|
|
PURPLE_REQUEST_PROTOCOL_INFO = 'PApi',
|
|
|
|
|
|
|
|
/*! Load/start connecting the account →Server
|
2021-07-04 11:31:32 -05:00
|
|
|
Just the account's settings message from Cardie's end.
|
|
|
|
It's the server's job to tie the Cardie account name
|
|
|
|
to the PurpleAccount. */
|
2021-06-27 17:33:09 -05:00
|
|
|
PURPLE_CONNECT_ACCOUNT = 'PAla',
|
2021-06-27 16:46:38 -05:00
|
|
|
|
|
|
|
/*! Associate account with thread →Server
|
2021-07-04 11:31:32 -05:00
|
|
|
Makes the server associate the given account with
|
|
|
|
the given thread. All subsequent Server→Add-On
|
|
|
|
messages related to the account will be sent to this
|
|
|
|
thread.
|
|
|
|
Requires: String account_name, int64 thread_id */
|
2021-06-27 17:33:09 -05:00
|
|
|
PURPLE_REGISTER_THREAD = 'PArl',
|
|
|
|
|
|
|
|
/*! Disconnect add-on's account →Server
|
2021-07-04 11:31:32 -05:00
|
|
|
Requires: String account_name */
|
Redesign add-on disconnection
Currently, add-ons are disconnected when ChatProtocol::Shutdown() is
called, which the add-on can do by itself― but there is no standard way
for add-ons to notify the app about their Shutdown. Because of this,
they tend to not call Shutdown()― instead (as in the case of the Jabber
add-on), they display a BAlert (IM_ERROR) notifying the user of the
connection error, but the account is considered active by Cardie (and
its threads are still existant, including its ProtocolLooper).
Zombies are bad, so this is redesigned somewhat with this commit:
Protocols should no longer call ChatProtocol::Shutdown() themselves,
they must send an IM_MESSAGE of IM_PROTOCOL_DISABLE to the app.
This will delete its ProtocolLooper, which in turn will send a
notification to the user and delete the ChatProtocol, and so
calling ChatProtocol::Shutdown().
In the included protocols, an IM_ERROR is sent right before
IM_PROTOCOL_DISABLE is sent if due to a connection error. This is not
required, but it is courteous to inform your user about the "why." :)
2021-07-18 17:52:36 -05:00
|
|
|
PURPLE_DISCONNECT_ACCOUNT = 'Axwx',
|
|
|
|
|
|
|
|
/*! Shutdown an add-on instance →Protocol
|
|
|
|
Send from server after an account is disabled
|
|
|
|
or errors out; sent so an add-on instance
|
|
|
|
won't run for an unconnected account. */
|
|
|
|
PURPLE_SHUTDOWN_ADDON = 'Pxwx',
|
2021-07-05 23:56:59 -05:00
|
|
|
|
|
|
|
/*! Register chat commands with proto →Protocol */
|
|
|
|
PURPLE_REGISTER_COMMANDS = 'Scmd',
|
|
|
|
|
|
|
|
/*! User has typed a command, process! →Server
|
|
|
|
Forwarded from Cardie.
|
|
|
|
Requires: String chat_id, String cmd_name, String misc_str */
|
|
|
|
PURPLE_CHAT_COMMAND = 'Pcmd'
|
2021-06-23 23:57:27 -05:00
|
|
|
};
|
|
|
|
|
2021-06-26 20:40:39 -05:00
|
|
|
#endif // _PURPLE_MESSAGES_H
|