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.
|
2010-05-19 15:37:26 -05:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _CAYA_PROTOCOL_MESSAGES_H
|
|
|
|
#define _CAYA_PROTOCOL_MESSAGES_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* What-codes for messages.
|
|
|
|
*/
|
|
|
|
enum message_what_codes {
|
|
|
|
//! All client <> protocol communication uses this what-code
|
|
|
|
IM_MESSAGE = 'IMme',
|
|
|
|
|
2010-05-30 13:56:24 -05:00
|
|
|
//! Used for very important (blocking) error messages
|
2010-05-19 15:37:26 -05:00
|
|
|
IM_ERROR = 'IMer',
|
|
|
|
|
|
|
|
//! 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Request a server-side contact list from protocol
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_GET_CONTACT_LIST = 1,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Server-side contact list received
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_CONTACT_LIST = 2,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Contact(s) was added to the server-side list
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_CONTACT_LIST_ADD_CONTACT = 3,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Contact(s) removed from the server-side list
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_CONTACT_LIST_REMOVED_CONTACT = 4,
|
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-01 21:43:19 -05:00
|
|
|
//! Send a chat message
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_SEND_MESSAGE = 20,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
2021-06-01 21:43:19 -05:00
|
|
|
//! Chat message has been sent
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_MESSAGE_SENT = 21,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
2021-06-01 21:43:19 -05:00
|
|
|
//! Chat message received
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_MESSAGE_RECEIVED = 22,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Contact started typing
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_CONTACT_STARTED_TYPING = 23,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Contact stopped typing
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_CONTACT_STOPPED_TYPING = 24,
|
|
|
|
|
|
|
|
//! Contact gone
|
|
|
|
IM_CONTACT_GONE = 25,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! User started typing
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_USER_STARTED_TYPING = 26,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! User stopped typing
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_USER_STOPPED_TYPING = 27,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
2021-05-24 19:12:42 -05:00
|
|
|
//! Logs received
|
|
|
|
IM_LOGS_RECEIVED = 28,
|
|
|
|
|
2021-06-01 21:43:19 -05:00
|
|
|
|
2010-05-19 15:37:26 -05:00
|
|
|
/*
|
|
|
|
* Messages related to contact changes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Change contact's status
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_SET_NICKNAME = 40,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Contact's status has changed
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_NICKNAME_SET = 41,
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Received contact new status
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_STATUS_SET = 60,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Contact's avatar icon was changed
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_AVATAR_SET = 61,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Get contact information
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_GET_CONTACT_INFO = 62,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Received contact information
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_CONTACT_INFO = 63,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Get extended contact information
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_GET_EXTENDED_CONTACT_INFO = 64,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Received extended contact information
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Change own nickname
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_SET_OWN_NICKNAME = 80,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Own nickname was changed
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_OWN_NICKNAME_SET = 81,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Change own status
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_SET_OWN_STATUS = 82,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
// Own status was chagned
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_OWN_STATUS_SET = 83,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Get own contact information
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_OWN_CONTACT_INFO = 84,
|
2010-05-19 15:37:26 -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
|
|
|
|
|
|
|
//! Own avatar icon was changed
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Start listening to changes in these contact's statuses
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_REGISTER_CONTACTS = 100,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Stop listening to status changes from these contacts
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Ask authorization to contact
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_ASK_AUTHORIZATION = 120,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Authorization response received from contact
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_AUTHORIZATION_RECEIVED = 121,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Authorization request received from contact
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_AUTHORIZATION_REQUEST = 122,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Authorization response given to contact
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_AUTHORIZATION_RESPONSE = 123,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Contact has been authorized
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! 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
|
|
|
|
2010-05-30 13:56:24 -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
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Create an individual chat
|
|
|
|
IM_CREATE_CHAT = 150,
|
|
|
|
|
|
|
|
//! Chat has been created
|
|
|
|
IM_CHAT_CREATED = 151,
|
|
|
|
|
|
|
|
//! Join a room
|
|
|
|
IM_JOIN_ROOM = 152,
|
|
|
|
|
|
|
|
//! Confirm the room's been joined
|
|
|
|
IM_ROOM_JOINED = 153,
|
|
|
|
|
2021-06-04 16:32:18 -05:00
|
|
|
//! User left the room
|
|
|
|
IM_LEAVE_ROOM = 154,
|
|
|
|
|
|
|
|
//! User left the room
|
|
|
|
IM_ROOM_LEFT = 155,
|
|
|
|
|
2021-06-04 13:57:04 -05:00
|
|
|
//! Quietly add a user(s) to the chat
|
2021-06-04 16:32:18 -05:00
|
|
|
IM_ROOM_PARTICIPANTS = 156,
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
|
|
//! User has newly and explicitly joined
|
2021-06-04 16:32:18 -05:00
|
|
|
IM_ROOM_PARTICIPANT_JOINED = 157,
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
|
|
//! A user left the room
|
2021-06-04 16:32:18 -05:00
|
|
|
IM_ROOM_PARTICIPANT_LEFT = 158,
|
2021-06-04 13:57:04 -05:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Room metadata
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Room name
|
|
|
|
IM_ROOM_NAME = 160,
|
|
|
|
|
|
|
|
//! Room subject
|
|
|
|
IM_ROOM_SUBJECT = 161,
|
|
|
|
|
|
|
|
|
2021-06-04 16:32:18 -05:00
|
|
|
/*
|
|
|
|
* Room moderation
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
//! A user's role has been changed
|
|
|
|
IM_ROOM_ROLECHANGE = 170,
|
|
|
|
|
2021-06-06 16:31:25 -05:00
|
|
|
//! Kick user
|
|
|
|
IM_ROOM_KICK_PARTICIPANT = 171,
|
|
|
|
|
2021-06-07 00:03:15 -05:00
|
|
|
//! A user was kicked
|
|
|
|
IM_ROOM_PARTICIPANT_KICKED = 172,
|
|
|
|
|
2021-06-04 16:32:18 -05:00
|
|
|
//! Ban user
|
2021-06-07 00:03:15 -05:00
|
|
|
IM_ROOM_BAN_PARTICIPANT = 173,
|
|
|
|
|
|
|
|
//! A user was banned
|
|
|
|
IM_ROOM_PARTICIPANT_BANNED = 174,
|
2021-06-04 16:32:18 -05:00
|
|
|
|
2021-06-06 16:31:25 -05:00
|
|
|
//! Unban user
|
2021-06-07 00:03:15 -05:00
|
|
|
IM_ROOM_UNBAN_PARTICIPANT = 175,
|
2021-06-06 16:31:25 -05:00
|
|
|
|
|
|
|
//! Mute user
|
2021-06-07 00:03:15 -05:00
|
|
|
IM_ROOM_MUTE_PARTICIPANT = 176,
|
2021-06-06 16:31:25 -05:00
|
|
|
|
|
|
|
//! Unmute user
|
2021-06-07 00:03:15 -05:00
|
|
|
IM_ROOM_UNMUTE_PARTICIPANT = 177,
|
2021-06-06 16:31:25 -05:00
|
|
|
|
|
|
|
//! Deafen
|
2021-06-07 00:03:15 -05:00
|
|
|
IM_ROOM_DEAFEN_PARTICIPANT = 178,
|
2021-06-06 16:31:25 -05:00
|
|
|
|
|
|
|
//! Allow to read messages
|
2021-06-07 00:03:15 -05:00
|
|
|
IM_ROOM_UNDEAFEN_PARTICIPANT = 179,
|
2021-06-04 16:32:18 -05:00
|
|
|
|
|
|
|
|
2010-05-19 15:37:26 -05:00
|
|
|
/*
|
|
|
|
* Special messages
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Special message forwarded to protocol
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_SPECIAL_TO_PROTOCOL = 1000,
|
2010-05-19 15:37:26 -05:00
|
|
|
|
|
|
|
//! Special message forwarded from protocol
|
2010-10-24 01:26:01 -05:00
|
|
|
IM_SPECIAL_FROM_PROTOCOL = 1001
|
2010-05-19 15:37:26 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _CAYA_PROTOCOL_MESSAGES_H
|