2010-05-19 15:37:26 -05:00
|
|
|
|
/*
|
2011-12-03 16:38:03 -06:00
|
|
|
|
* Copyright 2009-2011, Andrea Anzani. All rights reserved.
|
|
|
|
|
* Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved.
|
2021-06-13 01:16:30 -05:00
|
|
|
|
* Copyright 2021, Jaidyn Levesque. All rights reserved.
|
2010-05-19 15:37:26 -05:00
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
|
*/
|
2021-06-20 12:44:20 -05:00
|
|
|
|
#ifndef _CHAT_PROTOCOL_MESSAGES_H
|
|
|
|
|
#define _CHAT_PROTOCOL_MESSAGES_H
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* What-codes for messages.
|
|
|
|
|
*/
|
|
|
|
|
enum message_what_codes {
|
2021-06-08 15:32:04 -05:00
|
|
|
|
//! All client <> protocol communication uses this what-code
|
2010-05-19 15:37:26 -05:00
|
|
|
|
IM_MESSAGE = 'IMme',
|
|
|
|
|
|
2021-06-08 15:32:04 -05:00
|
|
|
|
//! Used for very important (blocking) error messages
|
2010-05-19 15:37:26 -05:00
|
|
|
|
IM_ERROR = 'IMer',
|
|
|
|
|
|
2021-06-08 15:32:04 -05:00
|
|
|
|
//! Returned after a request has succeded
|
2010-05-30 13:56:24 -05:00
|
|
|
|
IM_ACTION_PERFORMED = 'IMap'
|
2010-05-19 15:37:26 -05:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Valid codes for im_what field.
|
|
|
|
|
*/
|
|
|
|
|
enum im_what_code {
|
|
|
|
|
/*
|
|
|
|
|
* Messages that involves server-side contact list.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-06-08 15:32:04 -05:00
|
|
|
|
//! Request a server-side contact list from protocol →Protocol
|
2021-08-08 21:01:42 -05:00
|
|
|
|
IM_GET_ROSTER = 1,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Server-side contact list received →App
|
|
|
|
|
Requires: Stringlist "user_id" */
|
2021-08-08 21:01:42 -05:00
|
|
|
|
IM_ROSTER = 2,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Add a contact to the roster →Protocol
|
|
|
|
|
The slots for this message are determined by the protocol's
|
|
|
|
|
"roster" template (ChatProtocol::SettingsTemplate("roster")) */
|
2021-08-08 21:01:42 -05:00
|
|
|
|
IM_ROSTER_ADD_CONTACT = 3,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Remove a contact →Protocol
|
|
|
|
|
Requires: String "user_id" */
|
2021-08-08 21:01:42 -05:00
|
|
|
|
IM_ROSTER_REMOVE_CONTACT = 4,
|
2021-06-19 18:25:58 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Contact(s) removed from the server-side list →App
|
|
|
|
|
Requires: String "user_id" */
|
2021-08-08 21:01:42 -05:00
|
|
|
|
IM_ROSTER_CONTACT_REMOVED = 5,
|
2021-06-19 22:03:02 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Edit some data on contact →Protocol
|
|
|
|
|
The slots for this message are determined by the protocol's
|
|
|
|
|
"roster" template (ChatProtocol::SettingsTemplate("roster")) */
|
2021-08-08 21:01:42 -05:00
|
|
|
|
IM_ROSTER_EDIT_CONTACT = 6,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-01 21:43:19 -05:00
|
|
|
|
|
2010-05-19 15:37:26 -05:00
|
|
|
|
/*
|
|
|
|
|
* Messages related to text chat.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Send a chat message →Protocol
|
|
|
|
|
Requires: String "user_id", String "body" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_SEND_MESSAGE = 20,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Chat message has been sent →App
|
|
|
|
|
If no user_id is specified, it's treated as a system message
|
|
|
|
|
Requires: String "chat_id", String "body"
|
|
|
|
|
Allows: String "user_id" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_MESSAGE_SENT = 21,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Chat message received →App
|
2021-08-12 15:43:52 -05:00
|
|
|
|
To send a normal chat message, specify chat_id and user_id― if
|
|
|
|
|
user_id is ommitted, the message is treated as a "system message"
|
|
|
|
|
printed in chat.
|
|
|
|
|
If chat_id is ommitted, the message is sent to the protocol's system
|
|
|
|
|
buffer, rather than a specific conversation.
|
2021-08-13 12:39:47 -05:00
|
|
|
|
face_start and face_length specify the location of formatted text in
|
2021-08-17 13:22:20 -05:00
|
|
|
|
the body, and "face" is the desired font face.
|
2021-08-16 21:50:43 -05:00
|
|
|
|
color_* works much the same, but with colors. Not much else to say.
|
2021-08-12 15:43:52 -05:00
|
|
|
|
Requires: String "body"
|
2021-08-13 12:39:47 -05:00
|
|
|
|
Allows: String "chat_id", String "user_id", String "user_name",
|
2021-08-16 21:50:43 -05:00
|
|
|
|
int32s "face_start", int32s "face_length", uint16s "face"
|
|
|
|
|
int32s "color_start", int32s "color_length",
|
|
|
|
|
rgb_colors "color" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_MESSAGE_RECEIVED = 22,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Logs received →App
|
2021-08-17 13:22:20 -05:00
|
|
|
|
Should be a message with several sub-messages of IM_MESSAGE_RECEIVED.
|
|
|
|
|
Requires: Messages "message" */
|
2021-06-07 11:45:30 -05:00
|
|
|
|
IM_LOGS_RECEIVED = 23,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-05-24 19:12:42 -05:00
|
|
|
|
|
2010-05-19 15:37:26 -05:00
|
|
|
|
/*
|
2021-08-08 21:01:42 -05:00
|
|
|
|
* Messages related changes in general users.
|
2010-05-19 15:37:26 -05:00
|
|
|
|
*/
|
|
|
|
|
|
2021-08-10 18:03:32 -05:00
|
|
|
|
/*! User's nick has changed →App
|
|
|
|
|
Requires: String "user_id", String "user_name" */
|
2021-08-08 21:01:42 -05:00
|
|
|
|
IM_USER_NICKNAME_SET = 40,
|
|
|
|
|
|
|
|
|
|
/*! Received new status for user →App
|
|
|
|
|
Requires: String "user_id", int32/UserStatus "status" */
|
|
|
|
|
IM_USER_STATUS_SET = 41,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
/*! User's avatar icon was changed →App
|
|
|
|
|
Requires: String "user_id", Ref "ref" */
|
|
|
|
|
IM_USER_AVATAR_SET = 42,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-01 21:43:19 -05:00
|
|
|
|
|
2010-05-19 15:37:26 -05:00
|
|
|
|
/*
|
|
|
|
|
* Messages related to contact's information received from protocols.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
/*! Get contact information →Protocol
|
|
|
|
|
Requires: String "user_id" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_GET_CONTACT_INFO = 62,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Received contact information →App
|
|
|
|
|
Requires: String "user_id"
|
|
|
|
|
Accepts: String "user_name", String "message",
|
|
|
|
|
int32/UserStatus "status" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_CONTACT_INFO = 63,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
/*! Request contact information →Protocol
|
|
|
|
|
Requires: String "user_id" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_GET_EXTENDED_CONTACT_INFO = 64,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Received contact information →App
|
|
|
|
|
Requires: String "user_id",
|
|
|
|
|
non-standard slots used by "roster" template
|
2021-08-08 21:01:42 -05:00
|
|
|
|
Accepts: String "user_name" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_EXTENDED_CONTACT_INFO = 65,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-01 21:43:19 -05:00
|
|
|
|
|
2010-05-19 15:37:26 -05:00
|
|
|
|
/*
|
|
|
|
|
* Messages that involve changing own information.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Change own nickname →Protocol
|
|
|
|
|
Requires: String "user_name" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_SET_OWN_NICKNAME = 80,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-08-03 16:05:57 -05:00
|
|
|
|
/*! Own nickname was changed →App
|
|
|
|
|
Requires: String "user_name" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_OWN_NICKNAME_SET = 81,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Change own status →Protocol
|
|
|
|
|
Requires: int32/UserStatus "status" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_SET_OWN_STATUS = 82,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Own status was changed →App
|
|
|
|
|
Requires: int32/UserStatus "status" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_OWN_STATUS_SET = 83,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Get own contact information →App
|
|
|
|
|
Must be send right after connection is established,
|
|
|
|
|
before any room events, etc.
|
|
|
|
|
Requires: String "user_id"
|
|
|
|
|
Allows: String "user_name" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_OWN_CONTACT_INFO = 84,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-08 15:32:04 -05:00
|
|
|
|
//! Change own avatar icon
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_SET_OWN_AVATAR = 85,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Own avatar icon was changed
|
|
|
|
|
Requires: Ref "ref" */
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_OWN_AVATAR_SET = 86,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-01 21:43:19 -05:00
|
|
|
|
|
2010-05-19 15:37:26 -05:00
|
|
|
|
/*
|
|
|
|
|
* Contacts registration.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
//! Start listening to changes in these contact's statuses [unused]
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_REGISTER_CONTACTS = 100,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
//! Stop listening to status changes from these contacts [unused]
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_UNREGISTER_CONTACTS = 101,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-01 21:43:19 -05:00
|
|
|
|
|
2010-05-19 15:37:26 -05:00
|
|
|
|
/*
|
|
|
|
|
* Authorization.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
//! Ask authorization to contact [unused]
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_ASK_AUTHORIZATION = 120,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
//! Authorization response received from contact [unused]
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_AUTHORIZATION_RECEIVED = 121,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
//! Authorization request received from contact [unused]
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_AUTHORIZATION_REQUEST = 122,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
//! Authorization response given to contact [unused]
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_AUTHORIZATION_RESPONSE = 123,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
//! Contact has been authorized [unused]
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_CONTACT_AUTHORIZED = 124,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-01 21:43:19 -05:00
|
|
|
|
|
2010-05-19 15:37:26 -05:00
|
|
|
|
/*
|
|
|
|
|
* Miscellaneous.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
//! Progress message received, could be login sequence, file transfer etc
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_PROGRESS = 140,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-06-08 15:32:04 -05:00
|
|
|
|
//! Notifications
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_NOTIFICATION = 141,
|
2010-05-30 13:56:24 -05:00
|
|
|
|
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Room membership
|
|
|
|
|
*/
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Create an individual chat →Protocol
|
|
|
|
|
Individual chats and rooms are really the same thing (at least according
|
|
|
|
|
to App)― the only difference is in how they're created and joined.
|
|
|
|
|
A "chat" should be uniquely tied to a single user, and its chat_id
|
|
|
|
|
should be derivable from the user's ID (when sent back from
|
|
|
|
|
CHAT_CREATED). It doesn't matter how you get this done, really.
|
|
|
|
|
Requires: String "user_id" */
|
2021-06-04 13:57:04 -05:00
|
|
|
|
IM_CREATE_CHAT = 150,
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Chat has been created →App
|
|
|
|
|
Requires: String "chat_id", String "user_id" */
|
2021-06-04 13:57:04 -05:00
|
|
|
|
IM_CHAT_CREATED = 151,
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Create a room →Protocol
|
|
|
|
|
The required slots for this message are completely determined by the
|
|
|
|
|
protocol itself― the protocol will just receive data from the
|
2021-07-05 13:40:59 -05:00
|
|
|
|
"create_room" template (which is fetched via
|
|
|
|
|
ChatProtocol::SettingsTemplate("create_room") */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_CREATE_ROOM = 152,
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Inform App room was created →App
|
|
|
|
|
Just a semantically-dressed IM_ROOM_JOINED
|
|
|
|
|
Requires: String "chat_id" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_CREATED = 153,
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Join a room →Protocol
|
2021-07-05 13:40:59 -05:00
|
|
|
|
The required slots for this message are completely determined by the
|
|
|
|
|
protocol itself― like IM_CREATE_ROOM― with the "join_room" template. */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_JOIN_ROOM = 154,
|
2021-06-13 01:16:30 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Confirm the room's been joined →App
|
|
|
|
|
Requires: String "chat_id" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_JOINED = 155,
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! User wants to leave the room →Protocol
|
|
|
|
|
Requires: String "chat_id" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_LEAVE_ROOM = 156,
|
2021-06-04 16:32:18 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! User left the room →App
|
|
|
|
|
Requires: String "chat_id" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_LEFT = 157,
|
2021-06-04 16:32:18 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Request a room's userlist →Protocol
|
|
|
|
|
Requires: String "chat_id" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_GET_ROOM_PARTICIPANTS = 158,
|
2021-06-13 01:16:30 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Quietly add user(s) to the chat →App
|
|
|
|
|
Shouldn't be sent automatically on joining a room.
|
|
|
|
|
Requires: String "chat_id", StringList "user_id"
|
|
|
|
|
Accepts: StringList "user_name" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_PARTICIPANTS = 159,
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! User has explicitly joined →App
|
|
|
|
|
Requires: String "chat_id", String "user_id"
|
2021-08-10 18:03:32 -05:00
|
|
|
|
Accepts: String "body", String "user_name" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_PARTICIPANT_JOINED = 160,
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! A user left the room →App
|
|
|
|
|
Requires: String "chat_id", String "user_id"
|
|
|
|
|
Accepts: String "user_name", String "body" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_PARTICIPANT_LEFT = 161,
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Invite a user to a room →Protocol
|
|
|
|
|
You can tell it succeded with IM_ROOM_PARTICIPANT_JOINED.
|
|
|
|
|
Requires: String "chat_id", String "user_id"
|
|
|
|
|
Accepts: String "body" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_SEND_INVITE = 162,
|
2021-06-08 15:32:04 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Invitee explicitly refused →App
|
|
|
|
|
Requires: String "chat_id", String "user_id"
|
|
|
|
|
Accepts: String "user_name", String "body" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_INVITE_REFUSED = 163,
|
2021-06-08 15:32:04 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! User was invited to a room →App
|
|
|
|
|
Requires: String "chat_id"
|
|
|
|
|
Accepts: String "user_id", String "chat_name", String "body" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_INVITE_RECEIVED = 164,
|
2021-06-08 15:32:04 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! User accepted an invite →Protocol
|
|
|
|
|
Requires: String "chat_id" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_INVITE_ACCEPT = 165,
|
2021-06-08 15:32:04 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! User denies an invite →Protocol
|
|
|
|
|
Requires: String "chat_id" */
|
2021-06-18 01:13:02 -05:00
|
|
|
|
IM_ROOM_INVITE_REFUSE = 166,
|
2021-06-08 15:32:04 -05:00
|
|
|
|
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Room metadata
|
|
|
|
|
*/
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Request a room's metadata →Protocol
|
|
|
|
|
Requires: String "chat_id" */
|
2021-06-13 01:16:30 -05:00
|
|
|
|
IM_GET_ROOM_METADATA = 170,
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Receive room metadata →App
|
|
|
|
|
The idea is that all other metadata-related messages should only be
|
|
|
|
|
called either from a request, or from a change.
|
|
|
|
|
This shouldn't be sent automatically upon joining a room.
|
2021-07-05 13:40:59 -05:00
|
|
|
|
|
|
|
|
|
Recommendations on default room flags: Unless your protocol has remote
|
|
|
|
|
logs, ROOM_LOG_LOCALLY and ROOM_POPULATE_LOGS should be enabled; and for
|
|
|
|
|
multi-user rooms, ROOM_AUTOJOIN should be enabled by default (again,
|
|
|
|
|
unless the protocol manages auto-joins).
|
2021-06-29 11:41:26 -05:00
|
|
|
|
Requires: String "chat_id"
|
|
|
|
|
Allows: String "chat_name", String "subject",
|
|
|
|
|
int32 "room_default_flags", int32 "room_disallowed_flags" */
|
2021-06-13 01:16:30 -05:00
|
|
|
|
IM_ROOM_METADATA = 171,
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Set the room name →Protocol
|
|
|
|
|
Requires: String "chat_id", String "chat_name" */
|
2021-06-13 01:16:30 -05:00
|
|
|
|
IM_SET_ROOM_NAME = 172,
|
2021-06-07 11:45:30 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Room name has changed →Protocol
|
|
|
|
|
Requires: String "chat_id", String "chat_name" */
|
2021-06-13 01:16:30 -05:00
|
|
|
|
IM_ROOM_NAME_SET = 173,
|
2021-06-07 11:45:30 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Set the room subject →App
|
|
|
|
|
Requires: String "chat_id", String "subject" */
|
2021-06-13 01:16:30 -05:00
|
|
|
|
IM_SET_ROOM_SUBJECT = 174,
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Subject has been changed →App
|
|
|
|
|
Requires: String "chat_id", String "subject" */
|
2021-06-13 01:16:30 -05:00
|
|
|
|
IM_ROOM_SUBJECT_SET = 175,
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
|
|
|
|
|
2021-06-04 16:32:18 -05:00
|
|
|
|
/*
|
|
|
|
|
* Room moderation
|
|
|
|
|
*/
|
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! A user's role has been changed →App
|
|
|
|
|
Requires: String "role_title", int32 "role_perms",
|
|
|
|
|
int32 "role_priority" */
|
2021-06-08 15:32:04 -05:00
|
|
|
|
IM_ROOM_ROLECHANGED = 190,
|
Support for "Roles" (user, moderator, admin, etc.)
Add scaffodling support for arbitrary roles and permission-based (and
varying!) UI.
A new class, Role, represents a user's role in a given room, with three
values:
* The role's title
* The role's permission-set
* The role's priority
The permission set is a bitmask value for various permissions (e.g.,
PERM_WRITE, PERM_BAN, etc), and priority is position in the hierarchy.
A user with higher priority (and PERM_BAN) can ban a user with lower
priority, but not vice-versa. Two users with the same priority can't
ban/kick/mute each other, etc.
These permissions should be used to determine what UI elements are
displayed― if the user doesn't have permission to ban users, then a
"Ban" button shouldn't exist. If the user is muted, they shouldn't be
able to type. So on and so forth.
For now, permissions are sent with a IM_ROLECHANGE message and stored
by the Conversation, but aren't really in use yet.
This system should be flexible groundwork to account for the varying
administrative hierarchies and norms of different protocols.
2021-06-06 00:41:45 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Kick user →Protocol
|
|
|
|
|
Requires: String "chat_id", String "user_id" */
|
2021-06-08 15:32:04 -05:00
|
|
|
|
IM_ROOM_KICK_PARTICIPANT = 191,
|
2021-06-06 16:31:25 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! A user was kicked →App
|
|
|
|
|
Requires: String "chat_id", String "user_id"
|
|
|
|
|
Accepts: String "user_name", String "body" */
|
2021-06-08 15:32:04 -05:00
|
|
|
|
IM_ROOM_PARTICIPANT_KICKED = 192,
|
2021-06-07 00:03:15 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Ban user →Protocol
|
|
|
|
|
Requires: String "chat_id", String "user_id" */
|
2021-06-08 15:32:04 -05:00
|
|
|
|
IM_ROOM_BAN_PARTICIPANT = 193,
|
2021-06-07 00:03:15 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! A user was banned →App
|
|
|
|
|
Requires: String "chat_id", String "user_id"
|
|
|
|
|
Accepts: String "user_name", String "body" */
|
2021-06-08 15:32:04 -05:00
|
|
|
|
IM_ROOM_PARTICIPANT_BANNED = 194,
|
2021-06-04 16:32:18 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Unban user →Protocol */
|
2021-06-08 15:32:04 -05:00
|
|
|
|
IM_ROOM_UNBAN_PARTICIPANT = 195,
|
2021-06-06 16:31:25 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Mute user →Protocol
|
|
|
|
|
The result of this can be seen with IM_ROOM_ROLECHANGED.
|
|
|
|
|
Requires: String "chat_id", String "user_id" */
|
2021-06-08 15:32:04 -05:00
|
|
|
|
IM_ROOM_MUTE_PARTICIPANT = 196,
|
2021-06-06 16:31:25 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Unmute user →Protocol
|
|
|
|
|
The result of this can be seen with IM_ROOM_ROLECHANGED.
|
|
|
|
|
Requires: String "chat_id", String "user_id" */
|
2021-06-08 15:32:04 -05:00
|
|
|
|
IM_ROOM_UNMUTE_PARTICIPANT = 197,
|
2021-06-06 16:31:25 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Deafen →Protocol
|
|
|
|
|
The result of this can be seen with IM_ROOM_ROLECHANGED.
|
|
|
|
|
Requires: String "chat_id", String "user_id" */
|
2021-06-08 15:32:04 -05:00
|
|
|
|
IM_ROOM_DEAFEN_PARTICIPANT = 198,
|
2021-06-06 16:31:25 -05:00
|
|
|
|
|
2021-06-29 11:41:26 -05:00
|
|
|
|
/*! Allow to read messages →Protocol
|
|
|
|
|
The result of this can be seen with IM_ROOM_ROLECHANGED.
|
|
|
|
|
Requires: String "chat_id", String "user_id" */
|
2021-06-08 15:32:04 -05:00
|
|
|
|
IM_ROOM_UNDEAFEN_PARTICIPANT = 199,
|
2021-06-04 16:32:18 -05:00
|
|
|
|
|
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
/*
|
|
|
|
|
* Misc. room-related messages
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*! User started typing →App [unused]
|
|
|
|
|
Requires: String "chat_id", String "user_id" */
|
|
|
|
|
IM_ROOM_PARTICIPANT_STARTED_TYPING = 210,
|
|
|
|
|
|
|
|
|
|
/*! User stopped typing →App [unused]
|
|
|
|
|
Requires: String "chat_id", String "user_id" */
|
|
|
|
|
IM_ROOM_PARTICIPANT_STOPPED_TYPING = 211,
|
|
|
|
|
|
|
|
|
|
|
2021-07-05 23:53:46 -05:00
|
|
|
|
/*
|
|
|
|
|
* Misc. UI messages
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*! Reload commands from proto →App
|
|
|
|
|
If a protocol's command-list is dynamic (i.e., determined by its own
|
|
|
|
|
add-ons and preferences), it makes sense to relaod commands from time
|
|
|
|
|
to time. This forces that. */
|
|
|
|
|
IM_PROTOCOL_RELOAD_COMMANDS = 900,
|
|
|
|
|
|
|
|
|
|
|
2010-05-19 15:37:26 -05:00
|
|
|
|
/*
|
|
|
|
|
* Special messages
|
|
|
|
|
*/
|
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
//! Special message forwarded to protocol [unused]
|
2010-10-24 01:26:01 -05:00
|
|
|
|
IM_SPECIAL_TO_PROTOCOL = 1000,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
2021-08-08 21:01:42 -05:00
|
|
|
|
//! Special message forwarded from protocol [unused]
|
2021-06-12 16:13:52 -05:00
|
|
|
|
IM_SPECIAL_FROM_PROTOCOL = 1001,
|
|
|
|
|
|
2021-07-18 13:52:24 -05:00
|
|
|
|
/*! Protocol is ready →App
|
|
|
|
|
Should be sent after connection is established, initialization done */
|
2021-06-15 23:29:38 -05:00
|
|
|
|
IM_PROTOCOL_READY = 1002,
|
2021-07-18 13:52:24 -05:00
|
|
|
|
|
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
|
|
|
|
/*! Deletion of protocol requested →App
|
|
|
|
|
This requests that the app delete the ChatProtocol and its
|
|
|
|
|
ProtocolLooper― so invoking ChatProtocol::Shutdown().
|
|
|
|
|
This should be sent by the protocol after connection errors or a
|
2021-08-08 21:01:42 -05:00
|
|
|
|
disconnect, when the addon doesn't have anything left to do other
|
|
|
|
|
than yearn for the sweet hand of death. */
|
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
|
|
|
|
IM_PROTOCOL_DISABLE = 1003
|
2010-05-19 15:37:26 -05:00
|
|
|
|
};
|
|
|
|
|
|
2021-06-20 12:44:20 -05:00
|
|
|
|
#endif // _CHAT_PROTOCOL_MESSAGES_H
|