Commit Graph

309 Enmetoj

Author SHA1 Message Date
Jaidyn Ann 2e3742d4e1 Chat history in send textbox
History of sent messages is now saved― if the user presses the up or
down arrows, history will be traversed in the textbox.
2021-07-31 18:50:04 -05:00
Jaidyn Ann 8855464d02 Set default room icon based on user-count
If a room doesn't have a set icon (and it isn't a one-on-one chat, for
which the icon'll come from the other user's avatar), the default icon
is now determined based on user count.

If there's X users, an icon with X people will be displayed, up to four.
After that, a "+" is overlayed on the icon.

Not really necessary… but I think it's cute. :-)
2021-07-31 15:01:04 -05:00
Jaidyn Ann 9309562cfb Prevent false-positives for mentions 2021-07-31 11:43:09 -05:00
Jaidyn Ann 51dc12236c Save weights of the chat view's SplitViews 2021-07-31 11:15:51 -05:00
Jaidyn Ann 7ec20a45ad Save weights of main window's SplitViews 2021-07-30 16:14:21 -05:00
Jaidyn Ann ebc9d4041f Remove unused NotifyingTextView class 2021-07-29 22:47:30 -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 909a68e595 Keep room subject to one line, bold room title 2021-07-29 19:39:22 -05:00
Jaidyn Ann 924f628c75 Add 'Create Account' message for first-time start-up 2021-07-28 22:18:00 -05:00
Jaidyn Ann c339587b06 Disable 'Roster' and 'Window' menus as appropriate 2021-07-28 19:33:39 -05:00
Jaidyn Ann 0abdd9e0f9 Save window's frame
Fixes #51
2021-07-28 19:25:55 -05:00
Jaidyn Ann f038c492f7 Refactor preference saving/loading 2021-07-28 19:10:09 -05:00
Jaidyn Ann 37453ba2af Allow selection of non-contacts in roster windows
Windows using RosterView (like for the invitiation/new chat dialogues)
have a search-box for filtering between contacts. This allows the user
to type a user ID into this search-box that isn't a contact's ID, which
can then be selected as the user.

This makes common operations (inviting a user/adding a new contact)
a little easier.
2021-07-28 16:53:59 -05:00
Jaidyn Ann e33dd92375 Save account selection in account menus 2021-07-28 10:13:31 -05:00
Jaidyn Ann 758bbb072a (libinterface) Add 'square' scaling option to BitmapView
When toggled, this option disallows the scaled-to view rect being
uneven.
2021-07-27 20:48:03 -05:00
Jaidyn Ann 7df377d996 Default chat icon, use other user's avatar
For one-on-one chats without a custom icon, the other user's avatar will
be used as the chat's icon.

A default chat icon was also added
(haiku/data/artwork/icons/WebsiteComments).
2021-07-27 19:51:55 -05:00
Jaidyn Ann 6c1c5ccf18 Move avatar cache from 'Buddies' to 'Contacts' 2021-07-26 16:07:55 -05:00
Jaidyn Ann 96af3e6992 Move avatar cache from 'Contacts' to 'Buddies' 2021-07-26 13:47:23 -05:00
Jaidyn Ann bea52c14be Roster list tweaks, auto-deselect 2021-07-25 17:27:04 -05:00
Jaidyn Ann bba3d3d866 Sort conversation and user lists 2021-07-25 14:42:38 -05:00
Jaidyn Ann 5966df1a34 Print a 'date divider' when the day changes
I.E., if one message is sent on 2021-05-02 and the next on 2021-05-03, a
divider displaying the new date is printed before the second message.
2021-07-25 11:28:07 -05:00
Jaidyn Ann fff36dff6f Add 'when' to queued messages 2021-07-25 10:15:21 -05:00
Jaidyn Ann 987dc252d5 Translate more strings, update catkeys 2021-07-24 21:11:34 -05:00
Jaidyn Ann 4934660da3 Redesign/scalability of UserInfoWindow 2021-07-24 20:55:02 -05:00
Jaidyn Ann dfa92a8d9e Roster-windows scaling, truncate account names
In the AccountsMenu, item labels are now truncated to ~15 characters,
appending an ellipsis if the string is longer.
2021-07-24 15:45:20 -05:00
Jaidyn Ann c7c02e79c9 Preferences window-sizing, BBoxes for settings 2021-07-24 13:25:44 -05:00
Jaidyn Ann 43a7e7111d Auto-focus send textbox 2021-07-23 23:58:09 -05:00
Jaidyn Ann 33ad4d8acf More scalable ToolButton
Replaces libinterface's ToolButton, a custom button that can display
a pop-up menu on click (along with a custom image). It didn't scale well
with different themes and font-sizes compared to BButtons― which
ToolButton is supposed to look like to begin with.

A BButton-derived class is used instead, so these buttons look more
in-place among other buttons.
2021-07-23 23:43:42 -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 9245dc7135 Auto-scroll ConversationView, fix RunView append 2021-07-21 12:10:20 -05:00
Jaidyn Ann 1900b7c5ab Esperanto translation of app 2021-07-19 12:10:18 -05:00
Jaidyn Ann 82c06bba25 Localization, init catkeys 2021-07-19 09:54:27 -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 8d47983c47 (purple) Send errors to Cardie; IM_PROTOCOL_DISABLED
Connection errors are now sent to Cardie through an IM_ERROR message
(which appear in a BAlert), and an IM_PROTOCOL_DISABLED IM_MESSAGE is
sent to Cardie when the account is disabled/connection fails.
2021-07-18 13:54:31 -05:00
Jaidyn Ann 6f73db12b7 Highlight room list-items, auto-scroll in chat
When a new message is posted (or the user is messaged), the room's item
in the roomlist is now highlighted, like Vision.

Chat also auto-scrolls when new messages are posted.
2021-07-17 00:23:56 -05:00
Jaidyn Ann fe4d0661a7 Move notifications from ConversationView to Conversation itself 2021-07-16 16:28:58 -05:00
Jaidyn Ann e1ec602be8 Message/mention notifications
If the user's in a one-on-one chat, notify on every message― otherwise,
only notify when the user's name/ID is mentioned by another user.

Notifications should be managed by roomflags, but that's for another
time.
2021-07-15 18:01:58 -05:00
Jaidyn Ann e760818007 (librunview) Init new RenderView/RunView
Base-level replacement of the Vision-derived text RunView― a couple
important features supported by the replacee haven't been implemented yet,
including:
	* Right-click menu
	* URL-highlighting/selection
	* Emote support
2021-07-14 15:12:04 -05:00
Jaidyn Ann 7f30571703 Fix SmileTextRender crash
Fixes #22
2021-07-13 17:11:49 -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 2415be542e Update README and Contributors 2021-07-11 15:31:37 -05:00
Jaidyn Ann f4df6d0d3b Typing auto-complete for usernames 2021-07-09 11:52:57 -05:00
Jaidyn Ann 8a3f22d5e9 Move sendbox to conversation view, replace filter
The BTextBox used for sending messages has been moved from the main
window to individual ConversationViews, allowing seperate histories,
texts, etc., to exist in different conversations.

EditingFilter (a filter that hooked into MainWindow) was previously used
to field special key combos with this textbox, including "ENTER" for
sending, but this has been replaced with a new textview subclass
(SendTextView).
2021-07-08 16:07:03 -05:00
Jaidyn Ann 352a6751da Slight UserInfoWindow redesign 2021-07-07 22:35:44 -05:00
Jaidyn Ann 2bd9ecb6a8 Reformat ChatProtocol, default own contact to null 2021-07-07 10:59:56 -05:00
Jaidyn Ann 52a580e03d Remove own user from contacts; fix roster bitmaps
It doesn't make sense to lump the user themself with their contacts
list― their Contact object is now stored seperately.

BBitmap loading for RosterItems are fixed, as well.

Fixes #33
2021-07-06 14:46:28 -05:00
Jaidyn Ann 1515ab0d00 Tweak permissions handling in UserListView 2021-07-06 13:47:37 -05:00
Jaidyn Ann d9051766d9 Reloading of protocol's commands on request
Sometimes a protocol's commands are dynamic, or change based on certain
events― and it's necessary in these cases that commands be reloaded.

The IM_PROTOCOL_RELOAD_COMMANDS message is now added to the API, which
will force Cardie to reload commands from the protocol.
2021-07-05 23:53:46 -05:00
Jaidyn Ann c0f126206a Include default templates, split "room"
The "room" template has been split into two seperate
templates― "join_room" and "create_room". Before, "room" was used in the
room creation window, but now that's delegated to "create_room".

"join_room" is used with the join window― so now, the add-on has total
control over the slots used to join/create rooms generally, if they
specify the templates. Even a "/join" command could be overriden by the
add-on.

Also, default templates are now in use. Rather than add-ons being
required to specify templates, there are sensible defaults included with
Cardie for each one.
2021-07-05 13:48:33 -05:00
Jaidyn Ann 7db93bf596 Fix roster crash w/o protocol icon 2021-07-02 13:47:01 -05:00
Jaidyn Ann d883c23d18 Reorganize settings directory, custom purple paths
The settings file-hierarchy has been changed a bit:
	* Cardie/
		* preferences
		* Accounts/
		* Cache/
			* Accounts/
			* Add-Ons/

`Cardie/Protocols` is now `Cardie/Accounts`, and the cache directory
has been split into two. `Cache/Accounts/` is for account-specific
cached data (e.g., cached roster icons, data, etc.), and
`Cache/Protocols` is for protocol-wide settings/data.

For purple, this will be used as the user's libpurple directory,
which has been moved from the default of `~/.purple` (yikes!)

Some plugin search-paths have been given to purple, too― lib
directories + "/purple2/", and Cardie/Cache/Add-Ons/purple/plugins/.
2021-06-30 21:05:43 -05:00
Jaidyn Ann f5b90ecc5e Include BString in Role.h 2021-06-30 18:05:22 -05:00
Jaidyn Ann 8d2ecfd853 Include BPath in ChatProtocol 2021-06-30 15:35:48 -05:00
Jaidyn Ann fb070e841a Store default commands/menu items in resources 2021-06-30 14:27:58 -05:00
Jaidyn Ann f6a006dddc librunview/libsupport x86_gcc2 fixes 2021-06-30 14:25:58 -05:00
Jaidyn Ann 48db626672 Accept IM_ROOM_PARTICIPANTS without user_names 2021-06-29 15:19:43 -05:00
Jaidyn Ann 41b6164bbc Reformat ChatProtocolMessages 2021-06-29 11:41:26 -05:00
Jaidyn Ann 9a75767faa Change default user status, replicant settings 2021-06-29 11:40:58 -05:00
Jaidyn Ann 543986f281 Allow embedding of 'hidden' message by protocol in account settings 2021-06-26 20:39:05 -05:00
Jaidyn Ann 6f3b375232 Consolidate Main and TheApp 2021-06-23 14:15:22 -05:00
Jaidyn Ann de09ff9ad6 Rename Caya to Cardie 2021-06-22 01:06:00 -05:00
Jaidyn Ann 4ee453d0d6 Update room subject; accept user_name in OWN_CONTACT_INFO 2021-06-21 02:32:49 -05:00
Jaidyn Ann fbe6e66743 Change class names 2021-06-20 12:44:20 -05:00
Jaidyn Ann 4905d95787 Remove Caya icons 2021-06-20 11:44:16 -05:00
Jaidyn Ann b1920dad47 Move command/menu-item registration to call
Registration of custom chat commands and menu-items for protocols was
done by the IM_REGISTER_* messages, and is now done through direct calls
to the CayaProtocol object.

The new model for call/message for protocols is this: Temporary
information (chat messages, roster members, etc.) should be accessed
through messages. Relatively static data (protocol name, commands)
should be accessed through direct calls to the protocol object.
2021-06-20 01:24:34 -05:00
Jaidyn Ann d4f82dccc6 Removal of roster members
Now roster members can be deleted through the RosterEditWindow.

IM_CONTACT_LIST_REMOVED_CONTACT was renamed to
IM_CONTACT_LIST_CONTACT_REMOVED to fit style of other API messages.

Fixes #1.
2021-06-20 01:22:59 -05:00
Jaidyn Ann a21c8f7601 Editing of roster members
Roster members' can now be edited (through Roster->Edit Roster / CMD+R)

TemplateWindows can now be populated through sending any IM_MESSAGE to
it (it will assume the slots of the message correspond to the
template's).

IM_CONTACT_LIST_ADDED_CONTACT was removed (for redundancy), and
IM_CONTACT_LIST_EDIT_CONTACT was added.
2021-06-19 22:03:02 -05:00
Jaidyn Ann b1254494cb Replace JoinWindow with a TemplateWindow 2021-06-19 18:51:45 -05:00
Jaidyn Ann f4342d9310 Roster management, adding new contacts
The base for roster management (RosterEditWindow) has been made, and
adding new contacts works. Up next is contact removal and editing.

This leverages a new template (as defined in a protocol's
CayaProtocol::SettingsTemplate()), "roster," which should contain all
slots pertinent to editing/adding a contact member.

Two new API messages were added for this― IM_CONTACT_LIST_CONTACT_ADDED
and IM_CONTACT_LIST_CONTACT_REMOVED. The former will functionally just
be IM_CONTACT_INFO, but with some semantical meaning.

A new CayaMessage (CAYA_EDIT_ROSTER) was also added.

TemplateWindow was also edited to this end: Now, like RosterWindow/View,
it can be given a specific accounts' instance id, and it will prevent
the selection of another account. A new constructor was also added, to
allow a ProtocolTemplate to be explicitly passed to it― probably from
the program itself.
2021-06-19 18:25:58 -05:00
Jaidyn Ann 3d8942af60 When sending invites, filter the roster window 2021-06-19 00:11:02 -05:00
Jaidyn Ann fdeb533d6e Sorting of RosterWindow by accounts 2021-06-18 18:42:10 -05:00
Jaidyn Ann 9d72c53dd9 Split RosterWindow into per-account RosterView
Most of RosterWindow's special functions have been split into a special
BGroupView (including both the roster search-box and roster list),
RosterView.

This will give some more flexibility in other uses of the roster list.

In addition, RosterViews can be tied to a specific account by its
looper's instance ID, allowing it to either show all contacts (globally;
if the ID is set to -1) or only those of the specified account.

This can be useful, for example, when inviting contacts to a room―
you can only invite contacts that use the same protocol, and are
associated with your account, so showing all contacts doesn't make
sense.

The SearchBarTextControl class was removed, as it isn't particularly
necessary.
2021-06-18 16:41:09 -05:00
Jaidyn Ann 84eb2d68ba Slight template window tweaks 2021-06-18 14:18:45 -05:00
Jaidyn Ann 4f8aaf7957 Add 'error' slot for templates 2021-06-18 12:49:30 -05:00
Jaidyn Ann 077a01e8bf Print room 'join' and 'create' messages 2021-06-18 01:39:34 -05:00
Jaidyn Ann 48f84377fc Room-creation for XMPP 2021-06-18 01:30:59 -05:00
Jaidyn Ann 7c002d8fcc Room creation window; Catch-all template window
Explicit room-creation using protocol's own "room" template is now
supported.

Two new protocol API messages were added― IM_CREATE_ROOM and
IM_ROOM_CREATED, which are parallels to IM_CREATE_CHAT and
IM_CHAT_CREATED. Rather than the latter two, though, these are wholy
based on the "room" template― their slots are completely determined by
the protocol.

A generic "TemplateWindow" was created, which allows catch-all creation
of windows that leverage protocols' templates. It's used for the
room-creation window (Chat->New Room / Alt+N), for example.

At some point, it ideally should replace even the JoinRoom window, and
maybe others.
2021-06-18 01:13:02 -05:00
Jaidyn Ann 3fbe072d42 Generalize protocol settings' GUI templating
A nice templating system is used for account settings dialogues― the
required slots are specified by the protocol, and are reflected in the
settings dialogue.

To generalize this templating system (and eventually use elsewhere),
ProtocolSettings was split into two classes― ProtocolSettings and
ProtocolTemplate.

The CayaProtocol::SettingsTemplate() call was also edited to require a
string parameter, naming the specific template that should be returned.

"account" is used for the account settings dialogue, and other values
are TBA.
2021-06-17 17:02:29 -05:00
Jaidyn Ann 9eaeac24e6 Split icons into seperate RDEF files 2021-06-17 11:49:42 -05:00
Jaidyn Ann 560be5a810 Base for custom menubar items
Fixes #8
2021-06-16 05:03:30 -05:00
Jaidyn Ann d5aebac5c5 Custom chatlist pop-up items 2021-06-16 04:33:06 -05:00
Jaidyn Ann 8a9cb9effd Register commands & pop-up items through messages
Use IM_MESSAGEs, IM_REGISTER_COMMAND and IM_REGISTER_USER_ITEM, for
registering commands and user-list pop-up items.

The former replaces CayaProtocol::Commands(), which was a real bad idea
in the first place. Just awful. No idea why I did that instead of this,
which is nicer and significantly easier anyway.
2021-06-15 23:29:38 -05:00
Jaidyn Ann a03746c034 Make ChatCommands archivable 2021-06-15 22:03:11 -05:00
Jaidyn Ann 66b8150eeb Basis for custom userlist pop-up menu items 2021-06-15 21:05:21 -05:00
Jaidyn Ann 83e98bd5a8 Remove obselete CayaProtocol::SaveLogs(), add ::Commands()
With the new use of RoomFlags for signifying whether or not a room's
chat should be populated with local logs (ROOM_POPULATE_LOGS),
SaveLogs() is redundant.

A Commands() method was added to the CayaProtocol class returning a
CommandMap, which will be used by Caya when searching for commands.

KeyList::AddList() and List::AddList() were also added to libsupport,
for convenience.
2021-06-15 14:40:28 -05:00
Jaidyn Ann dd77f246f8 Per-protocol commands, precedence over default commands
Fixes #10
2021-06-15 00:59:00 -05:00
Jaidyn Ann 7d72b5152c Add '/help' command 2021-06-15 00:48: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 a4e2b1dc5a Log receive-dates of messages
Fixes #15
2021-06-14 16:41:25 -05:00
Jaidyn Ann 577cfd1ae0 Show timestamps in RunView, with custom values
This makes it so RunView's built-in timestamps are used― but requires
that a time_t be sent with each newly-appended line. This allows for lines to
be backdated or forward-dated.
2021-06-14 14:42:38 -05:00
Jaidyn Ann 6c43311982 Program-wide avatar cache
Add a program-wide avatar cache― whenever a contact or user's avatar has
changed, it gets cached in ~/config/settings/Caya/Cache/$account/People
(for contacts) or $account/Users (for everyone else).

ImageCache is now used, only for caching the kPersonIcon resource image―
it might be useful later for other commonly used images (status
indicators, etc).

Fixes #4
2021-06-13 17:34:30 -05:00
Jaidyn Ann b2489a5551 Cache roomflags, autojoin/autocreate based on them
Fixes #3
2021-06-13 02:35:16 -05:00
Jaidyn Ann 1124e3cf2b Update ConversationView name when notified, resize JoinWindow 2021-06-13 01:25:28 -05:00
Jaidyn Ann 7c9d1d9eaa Rework communication of room metadata, add room flags
In the API, a firm distinction between initially fetching a room's
metadata and receiving further changes has been made:
IM_ROOM_METADATA will be sent to Caya on request (IM_GET_ROOM_METADATA)
with the room's name, subject, etc. The other metadata-related messages
should only be sent to Caya after the room is initialized, not as a
means of initially setting its metadata.

Basic room flags were added, though they aren't yet used― they should
allow the protocol/add-on/user to configure some room features. Logging,
auto-joining, etc.
2021-06-13 01:16:30 -05:00
Jaidyn Ann 07350b3a0a Auto-join cached rooms on log-in
Rooms are now cached in ~/config/settings/Caya/Cache/$account/Rooms/,
with each file representing a seperate room. The filename is used as the
identifier, and these files now also serve as log files. The log
attribute name has also changed from "logs" to "Caya:logs".

When a protocol has succesfuly connected, all cached rooms are
automatically joined.
2021-06-12 21:42:10 -05:00
Jaidyn Ann 9cd4ce18e1 Disable some menu items when no account is active
When no accounts are active, all items in the Menubar->Chat menu are
disabled, and some other menu items related to starting/managing chats
are disabled in other views.

One new message was added to the API― IM_PROTOCOL_READY, which tells
Caya that a given protocol has logged in and is ready to receive
messages (rather than just sending).

This is currently done in XMPP after the roster is loaded, which be a
process that stalls the protocol for a few seconds. IM_PROTOCOL_READY
should only be sent after those initial, potentially time-heavy
operations.
2021-06-12 16:13:52 -05:00
Jaidyn Ann fe2f2ecad2 Slight redesign of add-on loading 2021-06-11 21:43:50 -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 552e937e51 Group rooms in roomlist by account
The ConversationListView is now an BOutlineListView, and rooms are
added as subitems to the item of their associated account. Right now,
account items aren't selectable or useful.
2021-06-11 17:24:04 -05:00