Commit Graph

30 Enmetoj

Author SHA1 Message Date
Jaidyn Ann a49e957b16 Re-enabling of accounts after disable
Accounts can now be toggled on-and-off freely.
Fixes #42
2021-08-05 19:31:26 -05:00
Jaidyn Ann 82f920798f Auto-completion for commands 2021-07-31 20:18:36 -05:00
Jaidyn Ann 89ff195c8d Set room topic/name through conversation view
If the user has permission to change a room's subject or name, they can
now edit the text views displaying them (toward the top of the window).
When enter is pressed, the changes will be sent to the protocol.

To do this, a BTextView subclass was added to libinterface
(splitting somewhat from SendTextView)― EnterTextView sends a message
containing the text to the given target when the user hits enter sans
modifiers.
2021-07-29 22:00:01 -05:00
Jaidyn Ann 0ffe3e5ce8 Replace CreateAccountMenu() with dedicated class
CreateAccountMenu() is used to populate a BMenu with items corresponding
to the map of accounts provided to it― but when an account is disabled
or enabled, it can't update automatically.

A dedicated class, fAccountsMenu, now replaces it― it'll automatically
repopulate the list whenever the active accounts update.
2021-07-21 12:14:25 -05:00
Jaidyn Ann 4905dbbe6c 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
Jaidyn Ann 6dcb6f4405 Notify on account disabling, more detailed alerts
Like the notification sent when accounts are ready (IM_PROTOCOL_READY),
one's been added for when accounds have disconnected/are disabled:
IM_PROTOCOL_DISABLED.

Also, error BAlerts (created with IM_ERROR messages) are now more
detailed, showing the associated accounts' name in the header.
2021-07-18 15:39:30 -05:00
Jaidyn Ann 5ec79ebbf5 Fix status view's avatar icon
The StatusView (below the roomlist) now shows a default icon if no
accounts have associated avatars, and will use an account's cached avatar
if available.
2021-07-13 14:43:48 -05:00
Jaidyn Ann fbe6e66743 Change class names 2021-06-20 12:44:20 -05:00
Jaidyn Ann d5aebac5c5 Custom chatlist pop-up items 2021-06-16 04:33:06 -05:00
Jaidyn Ann 66b8150eeb Basis for custom userlist pop-up menu items 2021-06-15 21:05:21 -05:00
Jaidyn Ann dd77f246f8 Per-protocol commands, precedence over default commands
Fixes #10
2021-06-15 00:59:00 -05:00
Jaidyn Ann 46d6d0a0b0 Basic command storage and parsing
A new class was added (ChatCommand) to represent commands, which are
all stored in the Server iself.

A command can be assigned any arbitrary BMessage, and can be given
arguments with some semantic meaning (so far just "string" or "room
participant," etc).

"invite" and moderation commands were added (ban/kick/mute etc).
2021-06-15 00:22:35 -05:00
Jaidyn Ann dcc5e443d3 Support temporary disabling of accounts
Accounts can now be temporarily disabled (in a Pidgin-like style)
through Preferences->Accounts. Work is still required to allow
enabling/re-enabling of accounts on-the-fly, and for keeping an
account's disabled state persistent.
2021-06-11 20:33:28 -05:00
Jaidyn Ann 5b5840a79e Explicitly tie Conversations, Contacts, and Users to their ProtocolLoopers
Previously, all Conversations/Contacts/Users were stored in the Server,
each in their respective KeyMaps, identified solely by their
identifiers. This leads to the glaring problem of overlap― if the user
has multiple accounts, some users/rooms might be used or present in multiple
accounts at the same time.

Now, each accounts' Contacts, Conversations, and Users are stored in
its ProtocolLooper, making this overlap impossible. An oversight of only
allowing one user identifier to be stored (fMySelf) in Server was also fixed
this way.

This is the bulk of the work required for multi-account support― now,
the user can join the same XMPP room on two seperate accounts, and it
works perfectly.
2021-06-10 15:16:43 -05:00
Jaidyn Ann 6e1ca87890 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:59:07 -05:00
Jaidyn Ann effd010b46 Allow leaving/getting booted from rooms
Now the user can leave or be forced to leave a chat.
For this, two protocol API messages were added: IM_LEAVE_ROOM, and IM_ROOM_LEFT.

Aside from that, IM_ROOM_BAN_PARTICIPANT and IM_ROOM_KICK_PARTICIPANT
were added, though they aren't used yet.
2021-06-04 16:32:18 -05:00
Jaidyn Ann ad1c7b5782 Receive lists and changes in room participants from protocols
Two new messages were added to the protocol API to do this:
M_ROOM_PARTICIPANTS, which can be used when someone joins a room, or
on joining a room to send a full list of users, and IM_ROOM_PARTICIPANT_LEFT,
for when a user has left the room/disconnected.

IM_SET_STATUS no longer assumes received data comes from contacts, but
any general user.

UserItem was made to reflect changes in the User's name.

Chat messages can now be reliably received in a given room. :)
2021-06-02 16:53:03 -05:00
Jaidyn Ann 75de08a18b Create JoinWindow and protocol messages for joining rooms
Protocol messages was added to the API to allow joining abstract rooms
by their chat_id― IM_JOIN_ROOM and IM_ROOM_JOINED. To make room in
anticipation of future room-related calls, some messages' values have
been shifted.

A JoinWindow was created (found through [Chat→Join Room] or [Alt-J] in
the main window), to allow joining a room with this protocol message.
The user can select which account the room should be joined from through
a drop-down menu in the lower left-hand corner― a design I think could
be replicated in other parts of Caya well.

Path() and SetPath() in CayaProtocol were renamed to AddOnPath() and
SetAddOnPath() respectively. GetName() and SetName() were also added,
where "name" is the account name (aka the leaf of the protocols settings
path).

To Server, a new KeyMap was added for convenience (AccountInstances), to
associate these account names with their instance IDs.
2021-06-01 21:50:17 -05:00
Jaidyn Ann 91d5b4e0dc Add own user to conversations' user lists
Really, only one line changed in _EnsureConversation()― the rest is
re-organizing the file.
2021-05-31 13:18:07 -05:00
Jaidyn Ann 0581bf1df9 Use 'User' over 'Contact' where appropriate 2021-05-31 11:56:45 -05:00
Jaidyn Ann 13ea8fecdf Write conversation list, put it in main window
Now all active conversations will be listed in the main window, in a
ConversationListView. Clicking one of the items will open its
conversation window as you'd expect, etc.
2021-05-27 11:15:30 -05:00
Jaidyn Ann 48d0b7bc96 Create Conversation class, use it instead of Contact for chats
This is a commit with it's foot in a lot of places, but:

The Conversation class was created as the abstraction of chats: All
ImMessages that are relevant to a conversation get routed through it,
meta-data on chats is stored in it (even if right now that's basically
limited to the user list and ID).

Server was given more methods to help accessing contacts―
ContactById(BString) and AddContact(Contact*). This better allows
Conversations to add and fetch Contacts as necessary. Right now, all
users in chats are treated as Contacts, so in the future creating an
independent userlist for Server (fUserMap?) would be useful.

Server also now stores all Conversations (fChatMap) and has some
convenience methods like for Contacts: Conversations(),
ConversationById(BString), and AddConversation(Conversation*).

CayaRenderView has been changed to not store user nicks, and will use
the appropriate nick of any arbitrarily-numbered user.

Users also have a map of all Conversations they are a part of
(fChatMap).

The Remove* methods of KeyMap now return the removed item.
2021-05-24 01:47:21 -05:00
Jaidyn Ann fc16b9b090 Rename ContactLinker to Contact 2021-05-23 14:39:07 -05:00
barrett f51f924b89 Fixed replicant issue, it's working as well, but only under a gcc4 Haiku atm. Modified disposition of the main gui widgets, now they are placed better. 2012-02-28 00:46:15 +00:00
barrett 4aff3e3422 Added a new deskbar replicant with related classes and icons, disabled libdownload and curl depencency, fixed some warnings and style violations around the code 2011-12-14 23:36:27 +00:00
plfiorini 98dd89fb55 Update copyright year. 2011-12-03 22:38:03 +00:00
plfiorini 88c5eedc9b Some style violations fixed. 2010-05-20 21:31:55 +00:00
plfiorini 4bdc37a60e Merged multiprotocol branch with trunk. 2010-05-16 21:02:50 +00:00
plfiorini 454762c7eb Preferences dialog is progressing... 2010-05-08 19:35:28 +00:00
plfiorini 0bf4b59922 Usual SVN tree (branches, tags, trunk). 2010-05-07 09:47:10 +00:00