├── Contributors ├── License ├── Make.post ├── Make.pre ├── Makefile ├── README.md ├── application ├── Account.cpp ├── Account.h ├── AppConstants.h ├── AppMessages.h ├── AppResources.h ├── ChatCommand.cpp ├── ChatCommand.h ├── ChatOMatic.rdef ├── ChatProtocol.h ├── ChatProtocolAddOn.cpp ├── ChatProtocolAddOn.h ├── ChatProtocolMessages.h ├── Contact.cpp ├── Contact.h ├── Conversation.cpp ├── Conversation.h ├── Flags.h ├── ImageCache.cpp ├── ImageCache.h ├── Makefile ├── Maps.h ├── Notifier.cpp ├── Notifier.h ├── NotifyMessage.h ├── Observer.h ├── ProtocolLooper.cpp ├── ProtocolLooper.h ├── ProtocolManager.cpp ├── ProtocolManager.h ├── ProtocolSettings.cpp ├── ProtocolSettings.h ├── ProtocolTemplate.cpp ├── ProtocolTemplate.h ├── Role.h ├── Server.cpp ├── Server.h ├── StatusManager.cpp ├── StatusManager.h ├── TheApp.cpp ├── TheApp.h ├── User.cpp ├── User.h ├── UserStatus.h ├── Utils.cpp ├── Utils.h ├── preferences │ ├── AccountDialog.cpp │ ├── AccountDialog.h │ ├── AccountListItem.cpp │ ├── AccountListItem.h │ ├── AppPreferences.cpp │ ├── AppPreferences.h │ ├── PreferencesBehavior.cpp │ ├── PreferencesBehavior.h │ ├── PreferencesChatWindow.cpp │ ├── PreferencesChatWindow.h │ ├── PreferencesNotifications.cpp │ ├── PreferencesNotifications.h │ ├── PreferencesReplicant.cpp │ └── PreferencesReplicant.h ├── views │ ├── AccountMenuItem.cpp │ ├── AccountMenuItem.h │ ├── AccountsMenu.cpp │ ├── AccountsMenu.h │ ├── ConversationAccountItem.cpp │ ├── ConversationAccountItem.h │ ├── ConversationItem.cpp │ ├── ConversationItem.h │ ├── ConversationListView.cpp │ ├── ConversationListView.h │ ├── ConversationView.cpp │ ├── ConversationView.h │ ├── InviteDialogue.cpp │ ├── InviteDialogue.h │ ├── RenderView.cpp │ ├── RenderView.h │ ├── ReplicantMenuItem.cpp │ ├── ReplicantMenuItem.h │ ├── ReplicantStatusView.cpp │ ├── ReplicantStatusView.h │ ├── RoomListRow.cpp │ ├── RoomListRow.h │ ├── RosterItem.cpp │ ├── RosterItem.h │ ├── RosterListView.cpp │ ├── RosterListView.h │ ├── RosterView.cpp │ ├── RosterView.h │ ├── SendTextView.cpp │ ├── SendTextView.h │ ├── StatusMenuItem.cpp │ ├── StatusMenuItem.h │ ├── StatusView.cpp │ ├── StatusView.h │ ├── TemplateView.cpp │ ├── TemplateView.h │ ├── UserItem.cpp │ ├── UserItem.h │ ├── UserListView.cpp │ ├── UserListView.h │ ├── UserPopUp.cpp │ └── UserPopUp.h └── windows │ ├── AccountsWindow.cpp │ ├── AccountsWindow.h │ ├── ConversationInfoWindow.cpp │ ├── ConversationInfoWindow.h │ ├── MainWindow.cpp │ ├── MainWindow.h │ ├── PreferencesWindow.cpp │ ├── PreferencesWindow.h │ ├── RoomListWindow.cpp │ ├── RoomListWindow.h │ ├── RosterEditWindow.cpp │ ├── RosterEditWindow.h │ ├── RosterWindow.cpp │ ├── RosterWindow.h │ ├── TemplateWindow.cpp │ ├── TemplateWindow.h │ ├── UserInfoWindow.cpp │ └── UserInfoWindow.h ├── data ├── icons │ ├── AppIcon │ ├── AppIcon.png │ ├── AppIcon.rdef │ ├── misc │ │ ├── Asterisk │ │ ├── Asterisk.rdef │ │ ├── People-1 │ │ ├── People-1.rdef │ │ ├── People-2 │ │ ├── People-2.rdef │ │ ├── People-3 │ │ ├── People-3.rdef │ │ ├── People-4 │ │ ├── People-4+ │ │ ├── People-4+.rdef │ │ ├── People-4.rdef │ │ ├── Person │ │ ├── Person.rdef │ │ ├── Search │ │ ├── Search.rdef │ │ ├── Tool │ │ └── Tool.rdef │ ├── protocols │ │ ├── IRC │ │ ├── IRC.rdef │ │ ├── Jabber │ │ ├── Jabber.rdef │ │ ├── Matrix.png │ │ ├── Matrix.rdef │ │ ├── Purple.rdef │ │ └── Purple.svg │ ├── replicant │ │ ├── Away │ │ ├── Away.rdef │ │ ├── Busy │ │ ├── Busy.rdef │ │ ├── ExitMenu │ │ ├── ExitMenu.rdef │ │ ├── Icon │ │ ├── Icon.rdef │ │ ├── MessageReceived │ │ ├── MessageReceived.rdef │ │ ├── Offline │ │ ├── Offline.rdef │ │ ├── Online │ │ └── Online.rdef │ └── status │ │ ├── Away │ │ ├── Away.rdef │ │ ├── Busy │ │ ├── Busy.rdef │ │ ├── Offline │ │ ├── Offline.rdef │ │ ├── Online │ │ └── Online.rdef ├── misc │ └── Templates.rdef └── screenshots │ ├── update-1.png │ ├── update-2.png │ ├── update-3.png │ └── update-final.png ├── documentation ├── ADDON-WRITING.md ├── Documentation.html ├── img │ ├── AppIcon.png │ ├── chat-header.png │ ├── chat-input.og.png │ ├── chat-input.png │ ├── chat-list.og.png │ ├── chat-list.png │ ├── menu-bar.png │ ├── pref-behavior.og.png │ ├── pref-behavior.png │ ├── pref-notifications.og.png │ ├── pref-notifications.png │ ├── room-creation.png │ ├── room-directory.png │ ├── select-user.png │ ├── status-area.png │ ├── user-list.og.png │ ├── user-list.png │ ├── window.og.png │ └── window.png └── style.css ├── libs ├── Makefile ├── libinterface │ ├── BitmapMenuItem.cpp │ ├── BitmapMenuItem.h │ ├── BitmapUtils.cpp │ ├── BitmapUtils.h │ ├── BitmapView.cpp │ ├── BitmapView.h │ ├── Divider.cpp │ ├── Divider.h │ ├── EnterTextView.cpp │ ├── EnterTextView.h │ ├── Makefile │ ├── MenuButton.cpp │ ├── MenuButton.h │ ├── PictureView.cpp │ ├── PictureView.h │ ├── UrlTextView.cpp │ └── UrlTextView.h ├── librunview │ ├── Emoconfig.cpp │ ├── Emoconfig.h │ ├── Emoticor.cpp │ ├── Emoticor.h │ ├── Makefile │ ├── RunView.cpp │ └── RunView.h ├── libsupport │ ├── Base64.cpp │ ├── Base64.h │ ├── KeyMap.h │ ├── List.h │ ├── Makefile │ ├── SHA1.cpp │ ├── SHA1.h │ ├── Singleton.cpp │ └── Singleton.h └── private │ └── binary_compatibility │ ├── Global.h │ └── Interface.h ├── locales ├── en.catkeys ├── eo.catkeys ├── purple │ └── en.catkeys └── xmpp │ └── en.catkeys └── protocols ├── Makefile.common ├── irc ├── IrcConstants.h ├── IrcMain.cpp ├── IrcProtocol.cpp ├── IrcProtocol.h ├── Makefile └── irc.rdef ├── matrix ├── Makefile ├── Matrix.h ├── MatrixApp.cpp ├── MatrixApp.h ├── MatrixMain.cpp ├── MatrixMessages.h ├── MatrixProtocol.cpp ├── MatrixProtocol.h └── matrix.rdef ├── purple ├── Makefile ├── Purple.h ├── PurpleApp.cpp ├── PurpleApp.h ├── PurpleDialog.cpp ├── PurpleDialog.h ├── PurpleMessages.h ├── PurpleProtocol.cpp ├── PurpleProtocol.h └── purple.rdef └── xmpp ├── JabberHandler.cpp ├── JabberHandler.h ├── JabberMain.cpp ├── JabberProtocol.cpp ├── JabberProtocol.h ├── Makefile └── jabber.rdef /Contributors: -------------------------------------------------------------------------------- 1 | Contributors list 2 | ====================== 3 | 4 | If you are not in this list, just send us an email. 5 | We will add you! 6 | 7 | == Core developers == 8 | 9 | Chat-O-Matic mantainer(s): 10 | * Jaidyn Levesque 11 | 12 | Caya mantainer(s): 13 | * Dario Casalinuovo 14 | * Andrea Anzani 15 | * Pier Luigi Fiorini 16 | 17 | == Code == 18 | 19 | Contributors in alphabetical order: 20 | 21 | * Adrien Destgues 22 | * Alexander Botero-Lowry 23 | * Ivan Gualandri 24 | * Oliver Ruiz Dorantes 25 | * Maciej Janiszewski 26 | * Rene Gollent 27 | 28 | == Icons == 29 | 30 | Michele Frau 31 | 32 | * Caya 33 | * AIM protocol 34 | * ICQ protocol 35 | * GoogleTalk protocol 36 | * MSN protocol 37 | 38 | Mark Erben 39 | * Facebook protocol 40 | -------------------------------------------------------------------------------- /Make.post: -------------------------------------------------------------------------------- 1 | LIBPATHS = $(OBJ_DIR) 2 | PROTOCOL_DIR = $(OBJ_DIR)/chat-o-matic/ 3 | 4 | DEBUG_ENABLED ?= false 5 | DEFINES = VERSION="\"0.0.2\"" \ 6 | BUILD_DATE="\"$(shell date +"%Y-%m-%d %H:%M")\"" \ 7 | DEBUG_ENABLED=$(DEBUG_ENABLED) \ 8 | APP_NAME="\"$(APP_NAME)"\" \ 9 | APP_SIGNATURE="\"$(APP_SIGNATURE)"\" 10 | -------------------------------------------------------------------------------- /Make.pre: -------------------------------------------------------------------------------- 1 | APP_NAME ?= Chat-O-Matic 2 | APP_SIGNATURE ?= application/x-vnd.chat-o-matic 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .DEFAULT_GOAL := default 2 | 3 | app: 4 | $(MAKE) -f application/Makefile 5 | 6 | libs: 7 | $(MAKE) -f libs/Makefile 8 | 9 | irc: 10 | $(MAKE) -f protocols/irc/Makefile 11 | 12 | xmpp: 13 | $(MAKE) -f protocols/xmpp/Makefile 14 | 15 | matrix: 16 | $(MAKE) -f protocols/matrix/Makefile 17 | 18 | purple: 19 | ifneq ($(shell uname -m), x86_gcc2) 20 | $(MAKE) -f protocols/purple/Makefile 21 | endif 22 | 23 | protocols: irc xmpp purple 24 | 25 | all: libs protocols app 26 | 27 | clean: 28 | $(MAKE) -f application/Makefile clean 29 | 30 | .PHONY: libs protocols 31 | 32 | default: all 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ![Chat-O-Matic Icon](data/icons/AppIcon.png) Chat-O-Matic 2 | 3 | ![GSoC 2021](https://img.shields.io/badge/GSoC-2021-green.svg) 4 | 5 | Chat-O-Matic is a multi-protocol chat program based on [Caya](https://github.com/Augustolo/Caya). 6 | 7 | ![Screenshot](data/screenshots/update-final.png) 8 | 9 | It can use protocols through native add-ons as well as through libpurple, 10 | the library used by [Pidgin](https://pidgin.im/). 11 | 12 | Protocols natively supported include IRC and XMPP. 13 | 14 | Protocols generally supported through libpurple include GroupWise, Zephyr, and 15 | [others through plugins](https://pidgin.im/plugins/?type=Protocol). 16 | 17 | You can find the user documentation [here](http://htmlpreview.github.io/?https://github.com/JadedCtrl/Chat-O-Matic/master/documentation/Documentation.html). 18 | 19 | 20 | ## Building 21 | You can make Chat-O-Matic and its protocols with: 22 | 23 | `$ make` 24 | 25 | Or one-by-one: 26 | 27 | `$ make libs; make app; make protocols` 28 | 29 | Chat-O-Matic itself requires the `expat_devel` package, the XMPP protocol requires 30 | `gloox_devel`, and the libpurple add-on requires `libpurple_devel` and 31 | `glib2_devel`. 32 | 33 | 34 | ## Installation 35 | Protocol add-ons can be installed in any add-ons directory under `chat-o-matic` 36 | (i.e., `~/config/non-packaged/add-ons/chat-o-matic/`) or in the binary's CWD 37 | (`./chat-o-matic/`). 38 | 39 | libpurple plugins can be installed to any lib directory under `purple-2` 40 | (i.e., `~/config/non-packaged/lib/purple-2/`). 41 | 42 | 43 | ## License 44 | Chat-O-Matic is under the MIT license, but licenses vary for the included 45 | libraries and add-ons. 46 | 47 | The `xmpp` and `purple` add-ons are under the GPLv2+, and `irc` the MIT license. 48 | 49 | `libsupport` is under the MIT license, though containing some PD code. 50 | `librunview` contains code from Vision, and is under the MPL. 51 | `libinterface` is under the MIT license. 52 | -------------------------------------------------------------------------------- /application/Account.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | * 6 | * Authors: 7 | * Andrea Anzani, andrea.anzani@gmail.com 8 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 9 | */ 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "Account.h" 18 | #include "Utils.h" 19 | 20 | 21 | Account::Account(bigtime_t instanceId, ChatProtocol* cayap, 22 | const char* name, const char* addOnSignature, BHandler* target) 23 | : 24 | fIdentifier(instanceId), 25 | fName(name), 26 | fStatus(B_ERROR), 27 | fProtocol(cayap), 28 | fMessenger(target), 29 | fSettings(new BMessage()) 30 | { 31 | fProtocol->Init(this); 32 | 33 | // Find user's settings path 34 | BPath path = AccountPath(addOnSignature, fProtocol->Signature()); 35 | if (path.InitCheck() == B_OK) { 36 | path.Append(name); 37 | 38 | fProtocol->SetName(name); 39 | fProtocol->SetAccountCachePath(AccountCachePath(name)); 40 | fProtocol->SetAddOnCachePath(AddOnCachePath(addOnSignature)); 41 | 42 | // Load settings file 43 | BFile file(path.Path(), B_READ_ONLY); 44 | if (fSettings->Unflatten(&file) == B_OK) 45 | if (fSettings->GetBool("disabled", false) == false) 46 | fStatus = fProtocol->UpdateSettings(fSettings); 47 | else 48 | fStatus = B_DONT_DO_THAT; 49 | } 50 | } 51 | 52 | 53 | Account::~Account() 54 | { 55 | delete fSettings; 56 | } 57 | 58 | 59 | status_t 60 | Account::InitCheck() 61 | { 62 | return fStatus; 63 | } 64 | 65 | 66 | bigtime_t 67 | Account::Identifier() const 68 | { 69 | return fIdentifier; 70 | } 71 | 72 | 73 | const char* 74 | Account::Name() const 75 | { 76 | return fName.String(); 77 | } 78 | 79 | 80 | status_t 81 | Account::SendMessage(BMessage* message) 82 | { 83 | message->AddInt64("instance", fIdentifier); 84 | return fMessenger.SendMessage(message); 85 | } 86 | -------------------------------------------------------------------------------- /application/Account.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _ACCOUNT_H 7 | #define _ACCOUNT_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "ChatProtocol.h" 14 | 15 | class Account : public ChatProtocolMessengerInterface { 16 | public: 17 | Account(bigtime_t instanceId, ChatProtocol* cayap, 18 | const char* name, const char* addOnSignature, 19 | BHandler* target); 20 | virtual ~Account(); 21 | 22 | status_t InitCheck(); 23 | 24 | bigtime_t Identifier() const; 25 | const char* Name() const; 26 | 27 | virtual status_t SendMessage(BMessage* message); 28 | 29 | private: 30 | bigtime_t fIdentifier; 31 | ChatProtocol* fProtocol; 32 | BString fName; 33 | status_t fStatus; 34 | BMessenger fMessenger; 35 | BMessage* fSettings; 36 | }; 37 | 38 | #endif // _ACCOUNT_H 39 | -------------------------------------------------------------------------------- /application/AppConstants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _APP_CONSTANTS_H 7 | #define _APP_CONSTANTS_H 8 | 9 | #include 10 | 11 | /** 12 | * Color constants. 13 | */ 14 | const rgb_color APP_ORANGE_COLOR = {255, 186, 0, 255}; 15 | const rgb_color APP_GREEN_COLOR = {43, 134, 43, 255}; 16 | const rgb_color APP_RED_COLOR = {175, 1, 1, 255}; 17 | const rgb_color APP_WHITE_COLOR = {255, 255, 255, 255}; 18 | const rgb_color APP_BLACK_COLOR = {0, 0, 0, 255}; 19 | const rgb_color APP_SELSTART_COLOR = {254, 150, 57}; 20 | const rgb_color APP_SELEND_COLOR = {230, 113, 9}; 21 | 22 | #define APP_MENTION_BEEP "Chat-o-Matic mention" 23 | #define APP_MESSAGE_BEEP "Chat-o-Matic message" 24 | 25 | #endif // _APP_CONSTANTS_H 26 | -------------------------------------------------------------------------------- /application/AppMessages.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _APP_MESSAGES_H 6 | #define _APP_MESSAGES_H 7 | 8 | //! Show settings window 9 | const uint32 APP_SHOW_SETTINGS = 'RPST'; 10 | 11 | //! Show documentation 12 | const uint32 APP_SHOW_HELP = 'Rhlp'; 13 | 14 | //! Show accounts window 15 | const uint32 APP_SHOW_ACCOUNTS = 'RPac'; 16 | 17 | //! Chat messages 18 | const uint32 APP_CHAT = 'CYch'; 19 | 20 | //! Create a new chat 21 | const uint32 APP_NEW_CHAT = 'CYnc'; 22 | 23 | //! Create a new chat 24 | const uint32 APP_NEW_ROOM = 'CYnr'; 25 | 26 | //! Join a chat 27 | const uint32 APP_JOIN_ROOM = 'CYjr'; 28 | 29 | //! Room directory 30 | const uint32 APP_ROOM_DIRECTORY = 'CYrd'; 31 | 32 | //! Invite user to current chat 33 | const uint32 APP_SEND_INVITE = 'CYin'; 34 | 35 | //! Send replicant's messenger to the app 36 | const uint32 APP_REPLICANT_MESSENGER = 'RPme'; 37 | 38 | //! Status notification from the replicant 39 | const uint32 APP_REPLICANT_STATUS_SET = 'RPMS'; 40 | 41 | //! Exit notification from replicant 42 | const uint32 APP_REPLICANT_EXIT = 'RPEX'; 43 | 44 | //! Show main window replicant notification 45 | const uint32 APP_REPLICANT_SHOW_WINDOW = 'CYSW'; 46 | 47 | //! Select the upward conversation 48 | const uint32 APP_MOVE_UP = 'CYmu'; 49 | 50 | //! Select the downward conversation 51 | const uint32 APP_MOVE_DOWN = 'CYmd'; 52 | 53 | //! An account has been disabled 54 | const uint32 APP_ACCOUNT_DISABLED = 'Axwo'; 55 | 56 | //! An account's initial connection failed 57 | const uint32 APP_ACCOUNT_FAILED = 'Axwx'; 58 | 59 | //! Request a "help" message 60 | const uint32 APP_REQUEST_HELP = 'CYhm'; 61 | 62 | //! Display a "user info" window 63 | const uint32 APP_USER_INFO = 'CYuw'; 64 | 65 | //! Display a "room info" window 66 | const uint32 APP_ROOM_INFO = 'CYrw'; 67 | 68 | //! Open the room's logs with TextSearch 69 | const uint32 APP_ROOM_SEARCH = 'CYrs'; 70 | 71 | //! Toggle a specific flag for a room 72 | const uint32 APP_ROOM_FLAG = 'Rlag'; 73 | 74 | //! Edit the contact roster 75 | const uint32 APP_EDIT_ROSTER = 'CYer'; 76 | 77 | //! Edit a specific account 78 | const uint32 APP_EDIT_ACCOUNT = 'CYea'; 79 | 80 | //! Toggle a specific account 81 | const uint32 APP_TOGGLE_ACCOUNT = 'CYta'; 82 | 83 | #endif // _APP_MESSAGES_H 84 | -------------------------------------------------------------------------------- /application/AppResources.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _APP_RESOURCES_H 6 | #define _APP_RESOURCES_H 7 | 8 | enum { 9 | kOnlineIcon = 10, 10 | kAwayIcon = 11, 11 | kBusyIcon = 12, 12 | kOfflineIcon = 13, 13 | 14 | kToolIcon = 20, 15 | kSearchIcon = 21, 16 | kAsteriskIcon = 22, 17 | 18 | kProtocolSettingsTemplate = 1000, 19 | 20 | kOnlineReplicant = 1200, 21 | kIconReplicant = 1220, 22 | kOfflineReplicant = 1300, 23 | kBusyReplicant = 1333, 24 | kAwayReplicant = 1400, 25 | kExitMenuReplicant = 1401, 26 | kReplicantMessageReceived = 1402, 27 | 28 | kPersonIcon = 1500, 29 | kOnePersonIcon = 1501, 30 | kTwoPeopleIcon = 1502, 31 | kThreePeopleIcon = 1503, 32 | kFourPeopleIcon = 1504, 33 | kMorePeopleIcon = 1505 34 | }; 35 | 36 | #endif // _APP_RESOURCES_H 37 | -------------------------------------------------------------------------------- /application/ChatCommand.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef CHAT_COMMAND_H 6 | #define CHAT_COMMAND_H 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | #include "Maps.h" 16 | 17 | class Conversation; 18 | class User; 19 | 20 | 21 | 22 | enum cmd_arg_type 23 | { 24 | CMD_ROOM_PARTICIPANT = 'CArp', // "user_id" in message 25 | CMD_KNOWN_USER = 'CAku', // "user_id" in message 26 | CMD_ANY_USER = 'CAau', // "user_id" in message 27 | CMD_BODY_STRING = 'CAbs', // "body" in message 28 | CMD_MISC_STRING = 'CAms' // "misc_str" in message 29 | }; 30 | 31 | 32 | class ChatCommand : public BArchivable { 33 | public: 34 | ChatCommand(const char* name, BMessage msg, bool toProtocol, 35 | List argTypes); 36 | ChatCommand(BMessage* data); 37 | 38 | status_t Archive(BMessage* data, bool deep=true); 39 | ChatCommand* Instantiate(BMessage* data); 40 | 41 | 42 | const char* GetName() { return fName.String(); } 43 | 44 | void SetDesc(const char* description); 45 | const char* GetDesc() { return fDescription.String(); } 46 | 47 | bool Parse(BString args, BString* errorMsg, Conversation* chat); 48 | 49 | private: 50 | bool _ProcessArgs(BString args, BMessage* msg, BString* errorMsg, 51 | Conversation* chat); 52 | 53 | User* _FindUser(BString idOrName, UserMap users); 54 | 55 | bool _Send(BMessage* msg, Conversation* chat); 56 | 57 | BString fName; 58 | BString fDescription; 59 | BMessage fMessage; 60 | 61 | bool fToProto; 62 | List fArgTypes; 63 | }; 64 | 65 | #endif // CHAT_COMMAND_H 66 | -------------------------------------------------------------------------------- /application/ChatOMatic.rdef: -------------------------------------------------------------------------------- 1 | resource app_signature APP_SIGNATURE; 2 | 3 | resource app_version { 4 | major = 0, 5 | middle = 0, 6 | minor = 3, 7 | 8 | variety = B_APPV_ALPHA, 9 | internal = 0, 10 | 11 | short_info = APP_NAME, 12 | long_info = "©2009-2021 Chat-O-Matic, Caya, & IMKit Contributors" 13 | }; 14 | 15 | resource app_flags B_SINGLE_LAUNCH; 16 | 17 | resource file_types message; 18 | 19 | resource vector_icon { 20 | $"6E636966040500020106033D835C3C19B2BA8B0B3C20794769624A510E00FFFF" 21 | $"FFB4FFE405FFFFA405020106023D835C3C19B2BA8B0B3C20794769624A510E00" 22 | $"FFE405FFFFA405020106033D429E3C5148BB5ADA3C5C1B4A23AA46EC1800FFFF" 23 | $"FFB47FE583FF04B10C0902093F404644383C273F2E3A244122482245224D2755" 24 | $"245126572256245725582A5828592C5A315C2F5B345D3C5E385E425E4957475C" 25 | $"4D4E02043F4044433D3FBC95BE953B3D333D3D493844424E4A5148534A4A0403" 26 | $"3B2F4E2F4E2D4E2A4D2F532D522F530003334F334F364F345337533755325636" 27 | $"59325602085645C8FEC3AFCA30C0E55E3A5E405EBA4D52B58359B71B4AB38537" 28 | $"B51D3EB31FBA16B69933353130363E4A4641444D475346C657C27B554BCB01C6" 29 | $"35584F5A4F080239BA0539BA6B0802BD1CBC1DBD2FBCA908023E37423904032E" 30 | $"4535473C4739473F4540070A000100123FFFFE2FDACEAFDACE3FFFFE3AB6A5B8" 31 | $"4CC101178400040A010100000A020101000A000202031001178210040A000104" 32 | $"1001178400040A030104000A000407050608100117821004" 33 | }; 34 | -------------------------------------------------------------------------------- /application/ChatProtocolAddOn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _APP_PROTOCOL_ADDON_H 6 | #define _APP_PROTOCOL_ADDON_H 7 | 8 | #include 9 | 10 | #include 11 | 12 | class BBitmap; 13 | class ChatProtocol; 14 | 15 | 16 | class ChatProtocolAddOn { 17 | public: 18 | ChatProtocolAddOn(image_id image, const char* path, 19 | int32 subProto=0); 20 | ~ChatProtocolAddOn(); 21 | 22 | status_t InitCheck() const; 23 | 24 | const char* Path() const; 25 | 26 | ChatProtocol* Protocol() const; 27 | ChatProtocol* ProtocolAt(int32 i) const; 28 | 29 | int32 CountProtocols() const; 30 | 31 | const char* Signature() const; 32 | const char* FriendlySignature() const; 33 | BBitmap* Icon() const; 34 | 35 | const char* ProtoSignature() const; 36 | const char* ProtoFriendlySignature() const; 37 | BBitmap* ProtoIcon() const; 38 | 39 | uint32 Version() const; 40 | 41 | private: 42 | image_id fImage; 43 | BString fPath; 44 | ChatProtocol* (*fGetProtocol)(int32 i); 45 | int32 (*fCountProtocols)(); 46 | int32 fProtoIndex; 47 | uint32 fVersion; 48 | BString fSignature; 49 | BString fFriendlySignature; 50 | BBitmap* fIcon; 51 | status_t fStatus; 52 | 53 | void _Init(); 54 | }; 55 | 56 | #endif // _APP_PROTOCOL_ADDON_H 57 | -------------------------------------------------------------------------------- /application/Contact.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2012, Dario Casalinuovo. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | * 6 | * Authors: 7 | * Andrea Anzani, andrea.anzani@gmail.com 8 | * Dario Casalinuovo 9 | */ 10 | #include "Contact.h" 11 | 12 | #include "Utils.h" 13 | #include "ProtocolLooper.h" 14 | #include "RosterItem.h" 15 | 16 | 17 | Contact::Contact(BString id, BMessenger msgn) 18 | : 19 | User::User(id, msgn) 20 | { 21 | fRosterItem = new RosterItem(id.String(), this); 22 | RegisterObserver(fRosterItem); 23 | } 24 | 25 | 26 | RosterItem* 27 | Contact::GetRosterItem() const 28 | { 29 | return fRosterItem; 30 | } 31 | 32 | 33 | void 34 | Contact::_EnsureCachePath() 35 | { 36 | if (fCachePath.InitCheck() == B_OK) 37 | return; 38 | fCachePath = ContactCachePath(fLooper->Protocol()->GetName(), fID.String()); 39 | } 40 | -------------------------------------------------------------------------------- /application/Contact.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2012, Dario Casalinuovo. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _CONTACT_LINKER_H_ 7 | #define _CONTACT_LINKER_H_ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "AppConstants.h" 15 | #include "User.h" 16 | 17 | class BBitmap; 18 | 19 | class ProtocolLooper; 20 | class RosterItem; 21 | 22 | 23 | class Contact : public User { 24 | public: 25 | Contact(BString id, BMessenger msgn); 26 | 27 | RosterItem* GetRosterItem() const; 28 | 29 | private: 30 | virtual void _EnsureCachePath(); 31 | 32 | RosterItem* fRosterItem; 33 | }; 34 | 35 | #endif // _CONTACT_LINKER_H_ 36 | -------------------------------------------------------------------------------- /application/Flags.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef FLAGS_H 6 | #define FLAGS_H 7 | 8 | // AUTOJOIN, AUTOCREATE, LOG, POPULATE, NOTIFY 9 | // Auto-join on login, auto-create on login (non-persistent rooms), keep local 10 | // logs, populate chat with local logs on join, notify on direct message, 11 | // notify on all new messages… 12 | 13 | // JCLP 14 | // 0000 15 | 16 | #define ROOM_AUTOJOIN 1 17 | #define ROOM_AUTOCREATE 2 18 | #define ROOM_LOG_LOCALLY 4 19 | #define ROOM_POPULATE_LOGS 8 20 | #define ROOM_NOTIFY_DM 16 21 | #define ROOM_NOTIFY_ALL 32 22 | 23 | 24 | // NAME, SUBJECT, ROLECHANGE, BAN, KICK, DEAFEN, MUTE, NICK, READ, WRITE 25 | // Set name of room, set subject, change user's "role" (permission presets 26 | // defined by the protocol), etc… 27 | 28 | // NSRBKDMNRW 29 | // 0000000000 30 | 31 | #define PERM_WRITE 1 32 | #define PERM_READ 2 33 | #define PERM_NICK 4 34 | #define PERM_MUTE 8 35 | #define PERM_DEAFEN 16 36 | #define PERM_KICK 32 37 | #define PERM_BAN 64 38 | #define PERM_ROLECHANGE 128 39 | #define PERM_ROOM_SUBJECT 256 40 | #define PERM_ROOM_NAME 512 41 | #define PERM_ALL 1023 42 | 43 | #endif // FLAGS_H 44 | -------------------------------------------------------------------------------- /application/ImageCache.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | * 6 | * Authors: 7 | * Andrea Anzani, andrea.anzani@gmail.com 8 | */ 9 | 10 | #include "ImageCache.h" 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | #include "AppResources.h" 21 | #include "Utils.h" 22 | 23 | 24 | ImageCache* ImageCache::fInstance = NULL; 25 | 26 | 27 | ImageCache::ImageCache() 28 | { 29 | _LoadResource(kPersonIcon, "kPersonIcon"); 30 | _LoadResource(kOnePersonIcon, "kOnePersonIcon"); 31 | _LoadResource(kTwoPeopleIcon, "kTwoPeopleIcon"); 32 | _LoadResource(kThreePeopleIcon, "kThreePeopleIcon"); 33 | _LoadResource(kFourPeopleIcon, "kFourPeopleIcon"); 34 | _LoadResource(kMorePeopleIcon, "kMorePeopleIcon"); 35 | 36 | _LoadResource(kAwayReplicant, "kAwayReplicant"); 37 | _LoadResource(kBusyReplicant, "kBusyReplicant"); 38 | _LoadResource(kOfflineReplicant, "kOfflineReplicant"); 39 | _LoadResource(kOnlineReplicant, "kOnlineReplicant"); 40 | 41 | _LoadResource(kAsteriskIcon, "kAsteriskIcon"); 42 | } 43 | 44 | 45 | ImageCache::~ImageCache() 46 | { 47 | while (fBitmaps.CountItems()) { 48 | BBitmap* bit = fBitmaps.ValueFor(0); 49 | delete bit; 50 | } 51 | } 52 | 53 | 54 | ImageCache* 55 | ImageCache::Get() 56 | { 57 | if (fInstance == NULL) 58 | fInstance = new ImageCache(); 59 | return fInstance; 60 | } 61 | 62 | 63 | BBitmap* 64 | ImageCache::GetImage(const char* keyName) 65 | { 66 | // Loads the bitmap if found 67 | bool found; 68 | BBitmap* bitmap = fBitmaps.ValueFor(BString(keyName), &found); 69 | 70 | if (found == true) 71 | return bitmap; 72 | return NULL; 73 | } 74 | 75 | 76 | void 77 | ImageCache::AddImage(BString name, BBitmap* which) 78 | { 79 | fBitmaps.AddItem(name, which); 80 | } 81 | 82 | 83 | void 84 | ImageCache::DeleteImage(BString name) 85 | { 86 | BBitmap* bitmap = fBitmaps.ValueFor(name); 87 | if (bitmap) { 88 | fBitmaps.RemoveItemFor(name); 89 | delete bitmap; 90 | } 91 | } 92 | 93 | 94 | void 95 | ImageCache::Release() 96 | { 97 | if (fInstance != NULL) { 98 | delete fInstance; 99 | fInstance = NULL; 100 | } 101 | } 102 | 103 | 104 | void 105 | ImageCache::_LoadResource(int identifier, const char* key) 106 | { 107 | BResources res = ChatResources(); 108 | if (res.InitCheck() != B_OK) 109 | return; 110 | BBitmap* bitmap = IconFromResources(&res, identifier, B_LARGE_ICON); 111 | if (bitmap != NULL && bitmap->IsValid() == true) 112 | fBitmaps.AddItem(BString(key), bitmap); 113 | } 114 | -------------------------------------------------------------------------------- /application/ImageCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _IMAGE_CACHE_H 6 | #define _IMAGE_CACHE_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | class BBitmap; 14 | 15 | class ImageCache { 16 | public: 17 | static ImageCache* Get(); 18 | 19 | /* Returns the image corresponding to the which constant */ 20 | BBitmap* GetImage(const char* keyName); 21 | 22 | void AddImage(BString name, BBitmap* which); 23 | void DeleteImage(BString name); 24 | 25 | /* Frees the singleton instance of the cache, must be 26 | * called when the application quits. 27 | */ 28 | static void Release(); 29 | 30 | protected: 31 | ImageCache(); 32 | ~ImageCache(); 33 | 34 | private: 35 | void _LoadResource(int identifier, const char* key); 36 | 37 | static ImageCache* fInstance; 38 | KeyMap fBitmaps; 39 | }; 40 | 41 | 42 | #endif // _IMAGE_CACHE_H 43 | 44 | -------------------------------------------------------------------------------- /application/Maps.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _MAPS_H 6 | #define _MAPS_H 7 | 8 | #include 9 | 10 | #include "libsupport/KeyMap.h" 11 | 12 | class ChatCommand; 13 | class Command; 14 | class Contact; 15 | class Conversation; 16 | class User; 17 | 18 | 19 | // Defining some commonly-used KeyMaps 20 | typedef KeyMap AccountInstances; 21 | typedef KeyMap CommandMap; 22 | typedef KeyMap ChatMap; 23 | typedef KeyMap RosterMap; 24 | typedef KeyMap UserMap; 25 | 26 | #endif // _MAPS_H 27 | -------------------------------------------------------------------------------- /application/Notifier.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | * 5 | * Authors: 6 | * Andrea Anzani, andrea.anzani@gmail.com 7 | */ 8 | 9 | #include "Notifier.h" 10 | #include "Observer.h" 11 | 12 | 13 | void 14 | Notifier::RegisterObserver(Observer* obs) 15 | { 16 | if (!fObserverList.HasItem(obs)) 17 | fObserverList.AddItem(obs); 18 | } 19 | 20 | 21 | void 22 | Notifier::UnregisterObserver(Observer* obs) 23 | { 24 | if (fObserverList.HasItem(obs)) 25 | fObserverList.RemoveItem(obs, false); 26 | } 27 | 28 | 29 | void 30 | Notifier::NotifyString(int32 what, BString str) 31 | { 32 | for (int i = 0; i < fObserverList.CountItems(); i++) 33 | fObserverList.ItemAt(i)->ObserveString(what, str); 34 | } 35 | 36 | 37 | void 38 | Notifier::NotifyInteger(int32 what, int32 value) 39 | { 40 | for (int i = 0; i < fObserverList.CountItems(); i++) 41 | fObserverList.ItemAt(i)->ObserveInteger(what, value); 42 | } 43 | 44 | 45 | void 46 | Notifier::NotifyPointer(int32 what, void* ptr) 47 | { 48 | for (int i = 0; i < fObserverList.CountItems(); i++) 49 | fObserverList.ItemAt(i)->ObservePointer(what, ptr); 50 | } 51 | -------------------------------------------------------------------------------- /application/Notifier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef NOTIFIER_H 6 | #define NOTIFIER_H 7 | 8 | #include 9 | #include 10 | 11 | #include "Observer.h" 12 | 13 | 14 | class Notifier 15 | { 16 | public: 17 | void RegisterObserver(Observer*); 18 | void UnregisterObserver(Observer*); 19 | 20 | void NotifyString(int32 what, BString str); 21 | void NotifyInteger(int32 what, int32 value); 22 | void NotifyPointer(int32 what, void* ptr); 23 | 24 | private: 25 | BObjectList fObserverList; 26 | }; 27 | 28 | 29 | #endif // NOTIFIER_H 30 | 31 | -------------------------------------------------------------------------------- /application/NotifyMessage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _NOTIFY_MESSAGE_H 6 | #define _NOTIFY_MESSAGE_H 7 | 8 | enum { 9 | STR_CONTACT_NAME, 10 | STR_PERSONAL_STATUS, 11 | STR_ROOM_NAME, 12 | STR_ROOM_SUBJECT, 13 | 14 | PTR_AVATAR_BITMAP, 15 | PTR_ROOM_BITMAP, 16 | 17 | INT_ACCOUNT_STATUS, 18 | INT_CONTACT_STATUS, 19 | INT_USER_PERMS, 20 | INT_ROOM_MEMBERS, 21 | INT_NEW_MESSAGE, 22 | INT_NEW_MENTION, 23 | 24 | INT_CONV_VIEW_SELECTED, 25 | INT_ACCOUNTS_UPDATED 26 | }; 27 | 28 | #endif // _NOTIFY_MESSAGE_H 29 | -------------------------------------------------------------------------------- /application/Observer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef Observer_h_ 6 | #define Observer_h_ 7 | 8 | #include 9 | 10 | class Notifier; 11 | 12 | class Observer 13 | { 14 | public: 15 | virtual void ObserveString(int32 what, BString str) {}; 16 | virtual void ObserveInteger(int32 what, int32 value) {}; 17 | virtual void ObservePointer(int32 what, void* ptr) {}; 18 | }; 19 | #endif 20 | -------------------------------------------------------------------------------- /application/ProtocolLooper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | #ifndef _PROTOCOL_LOOPER_H 8 | #define _PROTOCOL_LOOPER_H 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "ChatProtocol.h" 15 | #include "ChatCommand.h" 16 | #include "Maps.h" 17 | 18 | class Contact; 19 | class Conversation; 20 | class ConversationAccountItem; 21 | class ConversationView; 22 | class User; 23 | 24 | 25 | class ProtocolLooper : public BLooper { 26 | public: 27 | ProtocolLooper(ChatProtocol* protocol, int64 instance); 28 | ~ProtocolLooper(); 29 | 30 | void MessageReceived(BMessage* msg); 31 | 32 | ConversationView* 33 | GetView(); 34 | void ShowView(); 35 | 36 | ChatProtocol* Protocol(); 37 | 38 | ChatMap Conversations() const; 39 | Conversation* ConversationById(BString id); 40 | void AddConversation(Conversation* chat); 41 | void RemoveConversation(Conversation* chat); 42 | 43 | RosterMap Contacts() const; 44 | Contact* ContactById(BString id); 45 | void AddContact(Contact* contact); 46 | void RemoveContact(Contact* contact); 47 | 48 | UserMap Users() const; 49 | User* UserById(BString id); 50 | void AddUser(User* user); 51 | 52 | CommandMap Commands() const; 53 | ChatCommand* CommandById(BString id); 54 | 55 | Contact* GetOwnContact(); 56 | void SetOwnContact(Contact* contact); 57 | 58 | int64 GetInstance(); 59 | 60 | ConversationAccountItem* 61 | GetListItem(); 62 | 63 | void LoadCommands(); 64 | 65 | private: 66 | void _InitChatView(); 67 | 68 | ChatProtocol* fProtocol; 69 | int64 fInstance; 70 | 71 | Contact* fMySelf; 72 | 73 | ChatMap fChatMap; 74 | RosterMap fRosterMap; 75 | UserMap fUserMap; 76 | CommandMap fCommands; 77 | 78 | ConversationView* 79 | fSystemChatView; 80 | ConversationAccountItem* 81 | fListItem; 82 | }; 83 | 84 | #endif // _PROTOCOL_LOOPER_H 85 | -------------------------------------------------------------------------------- /application/ProtocolManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | #ifndef _PROTOCOL_MANAGER_H 8 | #define _PROTOCOL_MANAGER_H 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | #include "ChatProtocol.h" 16 | #include "ChatProtocolAddOn.h" 17 | 18 | class BBitmap; 19 | class BDirectory; 20 | class BHandler; 21 | 22 | class MainWindow; 23 | class ProtocolSettings; 24 | class Server; 25 | 26 | 27 | class ProtocolManager { 28 | public: 29 | bool Init(BDirectory dir, BHandler* target); 30 | 31 | static ProtocolManager* Get(); 32 | 33 | uint32 CountProtocolAddOns() const; 34 | ChatProtocolAddOn* ProtocolAddOnAt(uint32 i) const; 35 | ChatProtocolAddOn* ProtocolAddOn(const char* signature); 36 | 37 | uint32 CountProtocolInstances() const; 38 | ChatProtocol* ProtocolInstanceAt(uint32 i) const; 39 | ChatProtocol* ProtocolInstance(bigtime_t identifier); 40 | 41 | void AddAccount(ChatProtocolAddOn* addOn, 42 | const char* account, BHandler* target); 43 | 44 | void EnableAccount(ProtocolSettings* settings, 45 | const char* account); 46 | void DisableAccount(ProtocolSettings* settings, 47 | const char* account); 48 | void ToggleAccount(ProtocolSettings* settings, 49 | const char* account); 50 | 51 | private: 52 | typedef KeyMap AddOnMap; 53 | typedef KeyMap ProtocolMap; 54 | 55 | ProtocolManager(); 56 | 57 | void _LoadAccounts(const char* image_path, 58 | ChatProtocolAddOn* addOn, int protoIndex, 59 | BHandler* target); 60 | void _LoadAccount(const char* imagePath, 61 | BEntry accountEntry, int protoIndex, 62 | BHandler* target); 63 | void _LoadAccount(ChatProtocolAddOn* addOn, 64 | BEntry accountEntry, BHandler* target); 65 | 66 | MainWindow* _MainWin(); 67 | 68 | AddOnMap fAddOnMap; 69 | ProtocolMap fProtocolMap; 70 | }; 71 | 72 | #endif // _PROTOCOL_MANAGER_H 73 | -------------------------------------------------------------------------------- /application/ProtocolSettings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 3 | * Copyright 2003-2009, IM Kit Team. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | #ifndef _PROTOCOL_SETTINGS_H 8 | #define _PROTOCOL_SETTINGS_H 9 | 10 | #include 11 | #include 12 | 13 | #include "ProtocolTemplate.h" 14 | 15 | class BMessage; 16 | class ChatProtocolAddOn; 17 | 18 | class ProtocolSettings { 19 | public: 20 | ProtocolSettings(ChatProtocolAddOn* addOn); 21 | 22 | status_t InitCheck() const; 23 | 24 | ChatProtocolAddOn* AddOn() const; 25 | BObjectList Accounts() const; 26 | 27 | status_t Load(const char* account, BView* parent); 28 | status_t Load(const char* account, BMessage** settings); 29 | 30 | status_t Save(const char* account, BView* parent, 31 | BString* errorText = NULL); 32 | status_t Save(const char* account, BMessage settings); 33 | 34 | status_t Rename(const char* from, const char* to); 35 | status_t Delete(const char* account); 36 | 37 | private: 38 | ChatProtocolAddOn* fAddOn; 39 | ProtocolTemplate fTemplate; 40 | status_t fStatus; 41 | }; 42 | 43 | #endif // _PROTOCOL_SETTINGS_H 44 | -------------------------------------------------------------------------------- /application/ProtocolTemplate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 3 | * Copyright 2003-2009, IM Kit Team. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | #ifndef _PROTOCOL_TEMPLATE_H 8 | #define _PROTOCOL_TEMPLATE_H 9 | 10 | #include 11 | 12 | class BMessage; 13 | class BString; 14 | class BView; 15 | class ChatProtocol; 16 | 17 | 18 | class ProtocolTemplate { 19 | public: 20 | ProtocolTemplate(ChatProtocol* protocol, 21 | const char* type); 22 | ProtocolTemplate(BMessage pTemplate); 23 | ~ProtocolTemplate(); 24 | 25 | status_t InitCheck() const; 26 | ChatProtocol* Protocol() const; 27 | 28 | status_t Load(BView* parent, BMessage* settings = NULL); 29 | status_t Save(BView* parent, BMessage* settings, 30 | BString* errorText = NULL); 31 | 32 | private: 33 | ChatProtocol* fProtocol; 34 | BMessage* fTemplate; 35 | }; 36 | 37 | #endif // _PROTOCOL_TEMPLATE_H 38 | -------------------------------------------------------------------------------- /application/Role.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _ROLE_H 6 | #define _ROLE_H 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "Flags.h" 13 | 14 | 15 | #undef B_TRANSLATION_CONTEXT 16 | #define B_TRANSLATION_CONTEXT "User role" 17 | 18 | 19 | class Role { 20 | public: 21 | Role() 22 | : fTitle(B_TRANSLATE("Default")), fPerms(0 | PERM_WRITE | PERM_READ), 23 | fPriority(0) 24 | { 25 | } 26 | 27 | Role(BString title, int32 perms, int32 priority) 28 | : fTitle(title), fPerms(perms), fPriority(priority) 29 | { 30 | } 31 | 32 | const char* fTitle; 33 | int32 fPerms; // Permissions afforded to role, as described above. 34 | int32 fPriority; // 'Rank' of role, with higher being greater priority. 35 | // I.E., a user with a priority of 11 can't kick a user 36 | // with a priority of 12, but can one with 10. 37 | // This sort of hierarchy might not be universal in 38 | // chat protocols, but I think it can be adequately 39 | // simulated in add-ons. 40 | }; 41 | 42 | #endif // _ROLE_H 43 | -------------------------------------------------------------------------------- /application/StatusManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | * 5 | * Authors: 6 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 7 | */ 8 | 9 | #include "StatusManager.h" 10 | 11 | #include 12 | 13 | #include "ChatProtocolMessages.h" 14 | #include "NotifyMessage.h" 15 | #include "Server.h" 16 | 17 | 18 | static StatusManager* fInstance = NULL; 19 | 20 | 21 | StatusManager::StatusManager() 22 | : 23 | fStatus(STATUS_OFFLINE), 24 | fReplicantMessenger(NULL) 25 | { 26 | } 27 | 28 | 29 | StatusManager::~StatusManager() 30 | { 31 | delete fReplicantMessenger; 32 | } 33 | 34 | 35 | StatusManager* 36 | StatusManager::Get() 37 | { 38 | if (fInstance == NULL) 39 | fInstance = new StatusManager(); 40 | return fInstance; 41 | } 42 | 43 | 44 | void 45 | StatusManager::SetNickname(BString nick, int64 instance) 46 | { 47 | // Create message 48 | BMessage* msg = new BMessage(IM_MESSAGE); 49 | msg->AddInt32("im_what", IM_SET_OWN_NICKNAME); 50 | msg->AddString("user_name", nick); 51 | 52 | // Send message 53 | if (instance > -1) { 54 | msg->AddInt64("instance", instance); 55 | Server::Get()->SendProtocolMessage(msg); 56 | } 57 | else 58 | Server::Get()->SendAllProtocolMessage(msg); 59 | } 60 | 61 | 62 | void 63 | StatusManager::SetReplicantMessenger(BMessenger* messenger) 64 | { 65 | fReplicantMessenger = messenger; 66 | } 67 | 68 | 69 | UserStatus 70 | StatusManager::Status() const 71 | { 72 | return fStatus; 73 | } 74 | 75 | 76 | void 77 | StatusManager::SetStatus(UserStatus status, const char* str, int64 instance) 78 | { 79 | if (fStatus == status && instance == -1) 80 | return; 81 | 82 | // Create status change message 83 | BMessage* msg = new BMessage(IM_MESSAGE); 84 | msg->AddInt32("im_what", IM_SET_OWN_STATUS); 85 | msg->AddInt32("status", (int32)status); 86 | if (str != NULL) 87 | msg->AddString("message", str); 88 | 89 | // Send message 90 | if (instance > -1) { 91 | msg->AddInt64("instance", instance); 92 | Server::Get()->SendProtocolMessage(msg); 93 | } 94 | else 95 | Server::Get()->SendAllProtocolMessage(msg); 96 | 97 | // Notify status change 98 | fStatus = status; 99 | NotifyInteger(INT_ACCOUNT_STATUS, (int32)fStatus); 100 | ReplicantStatusNotify((UserStatus)status); 101 | } 102 | 103 | 104 | void 105 | StatusManager::SetStatus(UserStatus status, int64 instance) 106 | { 107 | SetStatus(status, NULL, instance); 108 | } 109 | 110 | 111 | void 112 | StatusManager::ReplicantStatusNotify(UserStatus status, bool wait) 113 | { 114 | if(fReplicantMessenger != NULL && fReplicantMessenger->IsValid()) { 115 | printf("notification sent\n"); 116 | BMessage mess(IM_OWN_STATUS_SET); 117 | mess.AddInt32("status", status); 118 | fReplicantMessenger->SendMessage(&mess); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /application/StatusManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _STATUS_MANAGER_H 6 | #define _STATUS_MANAGER_H 7 | 8 | #include 9 | 10 | #include "Notifier.h" 11 | #include "UserStatus.h" 12 | 13 | 14 | class StatusManager : public Notifier { 15 | public: 16 | static StatusManager* Get(); 17 | 18 | void SetNickname(BString nick, int64 instance = -1); 19 | 20 | UserStatus Status() const; 21 | void SetStatus(UserStatus status, int64 instance = -1); 22 | void SetStatus(UserStatus status, const char* str, 23 | int64 instance = -1); 24 | 25 | void SetReplicantMessenger(BMessenger* messenger); 26 | void ReplicantStatusNotify(UserStatus status, 27 | bool wait = false); 28 | private: 29 | StatusManager(); 30 | ~StatusManager(); 31 | 32 | UserStatus fStatus; 33 | BMessenger* fReplicantMessenger; 34 | 35 | }; 36 | 37 | #endif // _STATUS_MANAGER_H 38 | -------------------------------------------------------------------------------- /application/TheApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | #ifndef _THE_APP_H 8 | #define _THE_APP_H 9 | 10 | #include 11 | #include 12 | 13 | class MainWindow; 14 | 15 | 16 | int main(int argc, char* argv[]); 17 | 18 | 19 | class TheApp : public BApplication { 20 | public: 21 | TheApp(); 22 | 23 | virtual void ReadyToRun(); 24 | virtual void AboutRequested(); 25 | 26 | virtual void MessageReceived(BMessage* message); 27 | 28 | MainWindow* GetMainWindow() const; 29 | 30 | private: 31 | bool _LoadProtocols(directory_which finddir); 32 | bool _LoadProtocols(BPath path); 33 | 34 | MainWindow* fMainWin; 35 | }; 36 | 37 | #endif // _THE_APP_H 38 | -------------------------------------------------------------------------------- /application/User.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2012, Dario Casalinuovo. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | #ifndef USER_H 8 | #define USER_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "Maps.h" 18 | #include "Notifier.h" 19 | #include "UserStatus.h" 20 | 21 | class BBitmap; 22 | 23 | class Conversation; 24 | class ProtocolLooper; 25 | class UserPopUp; 26 | 27 | 28 | class User : public Notifier { 29 | public: 30 | User(BString id, BMessenger msgn); 31 | 32 | void RegisterObserver(Conversation* chat); 33 | void RegisterObserver(Observer* obs) { Notifier::RegisterObserver(obs); } 34 | void UnregisterObserver(Conversation* chat); 35 | void UnregisterObserver(Observer* obs) { Notifier::UnregisterObserver(obs); } 36 | 37 | void ShowPopUp(BPoint where); 38 | void DeletePopUp(); 39 | void HidePopUp(); 40 | 41 | BString GetId() const; 42 | 43 | BMessenger Messenger() const; 44 | void SetMessenger(BMessenger messenger); 45 | 46 | ProtocolLooper* GetProtocolLooper() const; 47 | void SetProtocolLooper(ProtocolLooper* looper); 48 | BBitmap* ProtocolBitmap() const; 49 | 50 | BString GetName() const; 51 | BBitmap* AvatarBitmap() const; 52 | UserStatus GetNotifyStatus() const; 53 | BString GetNotifyPersonalStatus() const; 54 | 55 | void SetNotifyName(BString name); 56 | void SetNotifyAvatarBitmap(BBitmap* bitmap); 57 | void SetNotifyStatus(UserStatus status); 58 | void SetNotifyPersonalStatus(BString personalStatus); 59 | 60 | ChatMap Conversations(); 61 | 62 | rgb_color fItemColor; 63 | 64 | protected: 65 | virtual void _EnsureCachePath(); 66 | 67 | BBitmap* _GetCachedAvatar(); 68 | void _SetCachedAvatar(BBitmap* avatar); 69 | 70 | BMessenger fMessenger; 71 | ProtocolLooper* fLooper; 72 | 73 | BString fID; 74 | BString fName; 75 | BString fPersonalStatus; 76 | BBitmap* fAvatarBitmap; 77 | BPath fCachePath; 78 | UserStatus fStatus; 79 | UserPopUp* fPopUp; 80 | ChatMap fConversations; 81 | }; 82 | 83 | 84 | #endif // USER_H 85 | 86 | -------------------------------------------------------------------------------- /application/UserStatus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _USER_STATUS_H 7 | #define _USER_STATUS_H 8 | 9 | /** 10 | * Status codes. 11 | */ 12 | enum UserStatus { 13 | STATUS_ONLINE = 1, 14 | STATUS_AWAY = 2, 15 | STATUS_DO_NOT_DISTURB = 3, 16 | STATUS_CUSTOM_STATUS = 4, 17 | STATUS_INVISIBLE = 5, 18 | STATUS_OFFLINE = 6, 19 | STATUS_STATUSES = 7 20 | }; 21 | 22 | #endif // _USER_STATUS_H 23 | -------------------------------------------------------------------------------- /application/Utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 3 | * Copyright 2014, Funky Idea Software 4 | * Copyright 2021, Jaidyn Levesque 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | #ifndef _APP_UTILS_H 8 | #define _APP_UTILS_H 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include "AppConstants.h" 17 | #include "UserStatus.h" 18 | 19 | class BMenu; 20 | 21 | 22 | // For display purposes 23 | const char* UserStatusToString(UserStatus status); 24 | 25 | // For use with the ImageCache 26 | const char* UserStatusToImageKey(UserStatus status); 27 | 28 | bool IsCommand(BString line); 29 | BString CommandName(BString line); 30 | BString CommandArgs(BString line); 31 | 32 | BResources ChatResources(); 33 | 34 | const char* SettingsPath(); 35 | 36 | const char* AccountsPath(); 37 | const char* AccountPath(const char* signature, const char* subsignature); 38 | 39 | BPath CachePath(); 40 | BPath AccountCachePath(const char* accountName); 41 | BPath RoomsCachePath(const char* accountName); 42 | BPath RoomsCachePath(BPath accPath); 43 | BPath RoomCachePath(const char* accountName, const char* roomIdentifier); 44 | BPath RoomCachePath(BPath accPath, const char* roomIdentifier); 45 | BPath UserCachePath(const char* accountName, const char* userIdentifier); 46 | BPath UserCachePath(BPath accPath, const char* userIdentifier); 47 | BPath ContactCachePath(const char* accountName, const char* userIdentifier); 48 | BPath ContactCachePath(BPath accPath, const char* userIdentifier); 49 | BPath AddOnCachePath(const char* signature); 50 | 51 | rgb_color TintColor(rgb_color color, int severity); 52 | rgb_color ForegroundColor(rgb_color background); 53 | 54 | // Borrowed from BePodder's own libfunky. Groovy B) 55 | status_t ReadAttributeData(BNode* node, const char* name, char** buffer, int32 *size); 56 | status_t WriteAttributeMessage(BNode* node, const char* name, BMessage* data); 57 | status_t ReadAttributeMessage(BNode* node, const char* name, BMessage* data); 58 | 59 | extern "C" status_t our_image(image_info& image); 60 | 61 | 62 | #endif // _APP_UTILS_H 63 | -------------------------------------------------------------------------------- /application/preferences/AccountDialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _ACCOUNT_DIALOG_H 6 | #define _ACCOUNT_DIALOG_H 7 | 8 | #include 9 | #include 10 | 11 | class BTextControl; 12 | 13 | class ProtocolSettings; 14 | class TemplateView; 15 | 16 | const uint32 kAccountAdded = 'acad'; 17 | const uint32 kAccountRenamed = 'acrd'; 18 | 19 | class AccountDialog : public BWindow { 20 | public: 21 | AccountDialog(const char* title, 22 | ProtocolSettings* settings, 23 | const char* account = NULL); 24 | 25 | void SetTarget(BHandler* target); 26 | 27 | virtual void MessageReceived(BMessage* msg); 28 | 29 | private: 30 | ProtocolSettings* fSettings; 31 | BString fAccount; 32 | TemplateView* fTop; 33 | BTextControl* fAccountName; 34 | BHandler* fTarget; 35 | }; 36 | 37 | #endif // _ACCOUNT_DIALOG_H 38 | -------------------------------------------------------------------------------- /application/preferences/AccountListItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | * 5 | * Authors: 6 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 7 | */ 8 | 9 | #include 10 | 11 | #include "AccountListItem.h" 12 | #include "ProtocolSettings.h" 13 | 14 | 15 | AccountListItem::AccountListItem(ProtocolSettings* settings, 16 | const char* account) 17 | : 18 | BStringItem(account), 19 | fSettings(settings), 20 | fAccount(account), 21 | fBaselineOffset(0) 22 | { 23 | } 24 | 25 | 26 | AccountListItem::~AccountListItem() 27 | { 28 | } 29 | 30 | 31 | ProtocolSettings* 32 | AccountListItem::Settings() const 33 | { 34 | return fSettings; 35 | } 36 | 37 | 38 | const char* 39 | AccountListItem::Account() const 40 | { 41 | return fAccount.String(); 42 | } 43 | 44 | 45 | void 46 | AccountListItem::SetAccount(const char* name) 47 | { 48 | fAccount = name; 49 | SetText(fAccount); 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /application/preferences/AccountListItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _ACCOUNT_LIST_ITEM_H 6 | #define _ACCOUNT_LIST_ITEM_H 7 | 8 | #include 9 | #include 10 | 11 | class ProtocolSettings; 12 | 13 | class AccountListItem : public BStringItem { 14 | public: 15 | AccountListItem(ProtocolSettings* settings, 16 | const char* account); 17 | virtual ~AccountListItem(); 18 | 19 | ProtocolSettings* Settings() const; 20 | 21 | const char* Account() const; 22 | void SetAccount(const char* name); 23 | 24 | private: 25 | ProtocolSettings* fSettings; 26 | BString fAccount; 27 | float fBaselineOffset; 28 | }; 29 | 30 | #endif // _ACCOUNT_LIST_ITEM_H 31 | -------------------------------------------------------------------------------- /application/preferences/AppPreferences.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. 3 | * Copyright 2012, Casalinuovo Dario. All rights reserved. 4 | * Copyright 2021-2022, Jaidyn Levesque 5 | * All rights reserved. Distributed under the terms of the MIT license. 6 | */ 7 | #ifndef _APP_PREFERENCES_H 8 | #define _APP_PREFERENCES_H 9 | 10 | #include 11 | #include 12 | 13 | 14 | class AppPreferences { 15 | public: 16 | static AppPreferences* Get(); 17 | 18 | void Load(); 19 | void Save(); 20 | 21 | bool MoveToCurrentWorkspace; 22 | bool RaiseOnMessageReceived; 23 | bool MarkUnreadWindow; 24 | 25 | bool NotifyProtocolStatus; 26 | bool NotifyContactStatus; 27 | bool NotifyNewMessage; 28 | bool SoundOnMessageReceived; 29 | bool SoundOnMention; 30 | 31 | bool HideDeskbar; 32 | bool DisableReplicant; 33 | bool DisableQuitConfirm; 34 | 35 | bool IgnoreEmoticons; 36 | bool MembershipUpdates; 37 | 38 | bool HideOffline; 39 | 40 | float MainWindowListWeight; 41 | float MainWindowChatWeight; 42 | 43 | float ChatViewHorizChatWeight; 44 | float ChatViewHorizListWeight; 45 | float ChatViewVertChatWeight; 46 | float ChatViewVertSendWeight; 47 | 48 | BRect MainWindowRect; 49 | BRect RoomDirectoryRect; 50 | 51 | private: 52 | const char* _PreferencesPath(); 53 | 54 | static AppPreferences* fInstance; 55 | }; 56 | 57 | #endif // _APP_PREFERENCES_H 58 | -------------------------------------------------------------------------------- /application/preferences/PreferencesBehavior.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. 3 | * Copyright 2012, Dario Casalinuovo. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _PREFERENCES_BEHAVIOR_H 7 | #define _PREFERENCES_BEHAVIOR_H 8 | 9 | #include 10 | 11 | class BCheckBox; 12 | 13 | class PreferencesBehavior : public BView { 14 | public: 15 | PreferencesBehavior(); 16 | 17 | virtual void AttachedToWindow(); 18 | virtual void MessageReceived(BMessage* msg); 19 | 20 | private: 21 | 22 | BCheckBox* fToCurrentWorkspace; 23 | BCheckBox* fRaiseOnMessageReceived; 24 | BCheckBox* fMarkUnreadWindow; 25 | 26 | BCheckBox* fDisableQuitConfirm; 27 | }; 28 | 29 | #endif // _PREFERENCES_BEHAVIOR_H 30 | -------------------------------------------------------------------------------- /application/preferences/PreferencesChatWindow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. 3 | * Copyright 2012, Dario Casalinuovo. All rights reserved. 4 | * Copyright 2021-2022, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | 8 | #include "PreferencesChatWindow.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "AppPreferences.h" 17 | 18 | 19 | #undef B_TRANSLATION_CONTEXT 20 | #define B_TRANSLATION_CONTEXT "PreferencesChatWindow" 21 | 22 | 23 | const uint32 kIgnoreEmoticons = 'CBhe'; 24 | const uint32 kMembershipUpdates = 'CBmu'; 25 | 26 | 27 | PreferencesChatWindow::PreferencesChatWindow() 28 | : BView(B_TRANSLATE("Chat view"), B_WILL_DRAW) 29 | { 30 | BBox* chatBox = new BBox("chatBox"); 31 | chatBox->SetLabel(B_TRANSLATE("Chat settings")); 32 | 33 | fMembershipUpdates = new BCheckBox("MembershipUpdates", 34 | B_TRANSLATE("Show join/part messages"), new BMessage(kMembershipUpdates)); 35 | 36 | fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons", 37 | B_TRANSLATE("Ignore emoticons"), new BMessage(kIgnoreEmoticons)); 38 | fIgnoreEmoticons->SetEnabled(false); // No emoticon support currently 39 | 40 | const float spacing = be_control_look->DefaultItemSpacing(); 41 | 42 | 43 | BLayoutBuilder::Group<>(chatBox, B_VERTICAL) 44 | .SetInsets(spacing, spacing * 2, spacing, spacing) 45 | .Add(fMembershipUpdates) 46 | .Add(fIgnoreEmoticons) 47 | .End(); 48 | 49 | BLayoutBuilder::Group<>(this, B_VERTICAL) 50 | .SetInsets(B_USE_DEFAULT_SPACING) 51 | .Add(chatBox) 52 | .AddGlue() 53 | .End(); 54 | } 55 | 56 | 57 | void 58 | PreferencesChatWindow::AttachedToWindow() 59 | { 60 | fIgnoreEmoticons->SetTarget(this); 61 | fIgnoreEmoticons->SetValue(AppPreferences::Get()->IgnoreEmoticons); 62 | fMembershipUpdates->SetTarget(this); 63 | fMembershipUpdates->SetValue(AppPreferences::Get()->MembershipUpdates); 64 | } 65 | 66 | 67 | void 68 | PreferencesChatWindow::MessageReceived(BMessage* message) 69 | { 70 | switch (message->what) { 71 | case kIgnoreEmoticons: 72 | AppPreferences::Get()->IgnoreEmoticons = fIgnoreEmoticons->Value(); 73 | break; 74 | case kMembershipUpdates: 75 | AppPreferences::Get()->MembershipUpdates = fMembershipUpdates->Value(); 76 | break; 77 | default: 78 | BView::MessageReceived(message); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /application/preferences/PreferencesChatWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. 3 | * Copyright 2012, Dario Casalinuovo. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _PREFERENCES_CHATWINDOW_H 7 | #define _PREFERENCES_CHATWINDOW_H 8 | 9 | #include 10 | 11 | class BCheckBox; 12 | 13 | class PreferencesChatWindow : public BView { 14 | public: 15 | PreferencesChatWindow(); 16 | 17 | virtual void AttachedToWindow(); 18 | virtual void MessageReceived(BMessage* msg); 19 | 20 | private: 21 | BCheckBox* fIgnoreEmoticons; 22 | BCheckBox* fMembershipUpdates; 23 | }; 24 | 25 | #endif // _PREFERENCES_BEHAVIOR_H 26 | -------------------------------------------------------------------------------- /application/preferences/PreferencesNotifications.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. 3 | * Copyright 2012, Dario Casalinuovo. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | #ifndef _PREFERENCES_NOTIFICATIONS_H 8 | #define _PREFERENCES_NOTIFICATIONS_H 9 | 10 | #include 11 | 12 | class BButton; 13 | class BCheckBox; 14 | 15 | class PreferencesNotifications : public BView { 16 | public: 17 | PreferencesNotifications(); 18 | 19 | virtual void AttachedToWindow(); 20 | virtual void MessageReceived(BMessage* msg); 21 | 22 | private: 23 | BCheckBox* fNotifyProtocols; 24 | BCheckBox* fNotifyContactStatus; 25 | BCheckBox* fNotifyNewMessage; 26 | BCheckBox* fSoundOnMessageReceived; 27 | BCheckBox* fSoundOnMention; 28 | 29 | BButton* fSoundsButton; 30 | }; 31 | 32 | #endif // _PREFERENCES_NOTIFICATIONS_H 33 | -------------------------------------------------------------------------------- /application/preferences/PreferencesReplicant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. 3 | * Copyright 2012, Dario Casalinuovo. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | 8 | #include "PreferencesReplicant.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "AppPreferences.h" 17 | #include "ReplicantStatusView.h" 18 | 19 | 20 | #undef B_TRANSLATION_CONTEXT 21 | #define B_TRANSLATION_CONTEXT "PreferencesReplicant" 22 | 23 | 24 | const uint32 kDisableReplicant = 'DSrp'; 25 | const uint32 kPermanentReplicant ='PRpt'; 26 | const uint32 kHideDeskbar = 'HCtk'; 27 | 28 | 29 | PreferencesReplicant::PreferencesReplicant() 30 | : BView(B_TRANSLATE("Replicant"), B_WILL_DRAW) 31 | { 32 | BBox* replicantBox = new BBox("replicantBox"); 33 | replicantBox->SetLabel(B_TRANSLATE("Deskbar replicant")); 34 | 35 | fDisableReplicant = new BCheckBox("DisableReplicant", 36 | B_TRANSLATE("Disable deskbar replicant"), 37 | new BMessage(kDisableReplicant)); 38 | fDisableReplicant->SetEnabled(false); // Replicant is broken currently 39 | 40 | if (!AppPreferences::Get()->HideDeskbar) 41 | Looper()->PostMessage(new BMessage(kDisableReplicant)); 42 | 43 | fPermanentReplicant = new BCheckBox("PermanentReplicant", 44 | B_TRANSLATE("Permanent deskbar replicant"), NULL); 45 | fPermanentReplicant->SetEnabled(false); 46 | 47 | fHideDeskbar = new BCheckBox("HideDeskbar", 48 | B_TRANSLATE("Hide field in Deskbar"), new BMessage(kHideDeskbar)); 49 | fHideDeskbar->SetEnabled(false); 50 | 51 | 52 | const float spacing = be_control_look->DefaultItemSpacing(); 53 | 54 | BLayoutBuilder::Group<>(replicantBox, B_VERTICAL) 55 | .SetInsets(spacing, spacing * 2, spacing, spacing) 56 | .Add(fDisableReplicant) 57 | .Add(fPermanentReplicant) 58 | .Add(fHideDeskbar) 59 | .End(); 60 | 61 | BLayoutBuilder::Group<>(this, B_VERTICAL) 62 | .SetInsets(B_USE_DEFAULT_SPACING) 63 | .Add(replicantBox) 64 | .AddGlue() 65 | .End(); 66 | } 67 | 68 | 69 | void 70 | PreferencesReplicant::AttachedToWindow() 71 | { 72 | fHideDeskbar->SetTarget(this); 73 | fDisableReplicant->SetTarget(this); 74 | 75 | fHideDeskbar->SetValue( 76 | AppPreferences::Get()->HideDeskbar); 77 | fDisableReplicant->SetValue( 78 | AppPreferences::Get()->DisableReplicant); 79 | } 80 | 81 | 82 | void 83 | PreferencesReplicant::MessageReceived(BMessage* message) 84 | { 85 | switch (message->what) { 86 | case kHideDeskbar: 87 | AppPreferences::Get()->HideDeskbar 88 | = fHideDeskbar->Value(); 89 | break; 90 | case kDisableReplicant: 91 | AppPreferences::Get()->DisableReplicant 92 | = fDisableReplicant->Value(); 93 | 94 | if (fDisableReplicant->Value() == true) 95 | ReplicantStatusView::RemoveReplicant(); 96 | else 97 | ReplicantStatusView::InstallReplicant(); 98 | 99 | break; 100 | default: 101 | BView::MessageReceived(message); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /application/preferences/PreferencesReplicant.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. 3 | * Copyright 2012, Dario Casalinuovo. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _PREFERENCES_REPLICANT_H 7 | #define _PREFERENCES_REPLICANT_H 8 | 9 | #include 10 | 11 | class BCheckBox; 12 | 13 | class PreferencesReplicant : public BView { 14 | public: 15 | PreferencesReplicant(); 16 | 17 | virtual void AttachedToWindow(); 18 | virtual void MessageReceived(BMessage* msg); 19 | 20 | private: 21 | BCheckBox* fDisableReplicant; 22 | BCheckBox* fPermanentReplicant; 23 | BCheckBox* fHideDeskbar; 24 | 25 | }; 26 | 27 | #endif // _PREFERENCES_REPLICANT_H 28 | -------------------------------------------------------------------------------- /application/views/AccountMenuItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "AccountMenuItem.h" 7 | 8 | #include "AccountsMenu.h" 9 | 10 | 11 | AccountMenuItem::AccountMenuItem(const char* label, BMessage* msg, 12 | BBitmap* icon) 13 | : 14 | BitmapMenuItem(label, msg, icon, 0, 0, false) 15 | { 16 | } 17 | 18 | 19 | void 20 | AccountMenuItem::SetMarked(bool mark) 21 | { 22 | BMenuItem::SetMarked(mark); 23 | if (mark == true) 24 | ((AccountsMenu*)Menu())->SetDefaultSelection(this); 25 | } 26 | -------------------------------------------------------------------------------- /application/views/AccountMenuItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _ACCOUNT_MENU_ITEM_H 6 | #define _ACCOUNT_MENU_ITEM_H 7 | 8 | #include 9 | 10 | #include 11 | 12 | 13 | class AccountMenuItem : public BitmapMenuItem { 14 | public: 15 | AccountMenuItem(const char* label, BMessage* msg, BBitmap* icon = NULL); 16 | 17 | virtual void SetMarked(bool mark); 18 | }; 19 | 20 | #endif // _ACCOUNT_MENU_ITEM_H 21 | -------------------------------------------------------------------------------- /application/views/AccountsMenu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _ACCOUNTS_MENU_H 6 | #define _ACCOUNTS_MENU_H 7 | 8 | #include 9 | 10 | #include "Observer.h" 11 | 12 | class ProtocolLooper; 13 | 14 | 15 | class AccountsMenu : public BPopUpMenu, public Observer { 16 | public: 17 | AccountsMenu(const char* name, BMessage msg, 18 | BMessage* allMsg = NULL); 19 | ~AccountsMenu(); 20 | 21 | virtual void ObserveInteger(int32 what, int32 value); 22 | 23 | void SetDefaultSelection(BMenuItem* item); 24 | static int64 GetDefaultSelection() { return fDefaultSelection; } 25 | 26 | private: 27 | void _PopulateMenu(); 28 | 29 | BBitmap* _EnsureProtocolIcon(const char* label, 30 | ProtocolLooper* looper); 31 | BBitmap* _EnsureAsteriskIcon(); 32 | 33 | 34 | BMessage fAccountMessage; 35 | BMessage* fAllMessage; 36 | static int64 fDefaultSelection; 37 | }; 38 | 39 | #endif // _ACCOUNTS_MENU_H 40 | -------------------------------------------------------------------------------- /application/views/ConversationAccountItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "ConversationAccountItem.h" 7 | 8 | #include "ProtocolLooper.h" 9 | 10 | 11 | ConversationAccountItem::ConversationAccountItem(const char* name, 12 | int64 instance, ProtocolLooper* looper) 13 | : 14 | BStringItem(name), 15 | fInstance(instance), 16 | fProtocolLooper(looper) 17 | { 18 | } 19 | 20 | 21 | int64 22 | ConversationAccountItem::GetInstance() 23 | { 24 | return fInstance; 25 | } 26 | 27 | 28 | ProtocolLooper* 29 | ConversationAccountItem::GetLooper() 30 | { 31 | return fProtocolLooper; 32 | } 33 | -------------------------------------------------------------------------------- /application/views/ConversationAccountItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef CONVERSATIONACCITEM_H 6 | #define CONVERSATIONACCITEM_H 7 | 8 | #include 9 | 10 | class Conversation; 11 | class ProtocolLooper; 12 | 13 | 14 | class ConversationAccountItem : public BStringItem { 15 | public: 16 | ConversationAccountItem(const char* name, int64 instance, 17 | ProtocolLooper* looper); 18 | 19 | int64 GetInstance(); 20 | ProtocolLooper* GetLooper(); 21 | 22 | private: 23 | int64 fInstance; 24 | ProtocolLooper* fProtocolLooper; 25 | }; 26 | 27 | 28 | #endif // CONVERSATIONACCITEM_H 29 | 30 | -------------------------------------------------------------------------------- /application/views/ConversationItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "ConversationItem.h" 7 | 8 | #include 9 | #include 10 | 11 | #include "Conversation.h" 12 | #include "NotifyMessage.h" 13 | #include "Utils.h" 14 | 15 | 16 | const int8 kMentioned = 1; 17 | const int8 kMessage = 2; 18 | 19 | 20 | ConversationItem::ConversationItem(const char* name, Conversation* chat) 21 | : 22 | BStringItem(name), 23 | fChat(chat), 24 | fStatus(0) 25 | { 26 | } 27 | 28 | 29 | void 30 | ConversationItem::DrawItem(BView* owner, BRect frame, bool complete) 31 | { 32 | rgb_color old = owner->HighColor(); 33 | 34 | if (fStatus & kMentioned) 35 | owner->SetHighUIColor(B_SUCCESS_COLOR); 36 | else if (fStatus & kMessage) 37 | owner->SetHighColor(TintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 2)); 38 | 39 | BStringItem::DrawItem(owner, frame, complete); 40 | owner->SetHighColor(old); 41 | } 42 | 43 | 44 | Conversation* 45 | ConversationItem::GetConversation() 46 | { 47 | return fChat; 48 | } 49 | 50 | 51 | void 52 | ConversationItem::ObserveString(int32 what, BString str) 53 | { 54 | switch (what) 55 | { 56 | case STR_ROOM_NAME: 57 | SetText(str.String()); 58 | break; 59 | } 60 | } 61 | 62 | 63 | void 64 | ConversationItem::ObserveInteger(int32 what, int32 num) 65 | { 66 | switch (what) 67 | { 68 | case INT_NEW_MESSAGE: 69 | fStatus |= kMessage; 70 | break; 71 | case INT_NEW_MENTION: 72 | fStatus |= kMentioned; 73 | break; 74 | case INT_CONV_VIEW_SELECTED: 75 | fStatus = 0; 76 | break; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /application/views/ConversationItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _CONVERSATION_ITEM_H 6 | #define _CONVERSATION_ITEM_H 7 | 8 | #include 9 | 10 | #include "Observer.h" 11 | 12 | class Conversation; 13 | 14 | 15 | class ConversationItem : public BStringItem, public Observer { 16 | public: 17 | ConversationItem(const char* name, Conversation* chat); 18 | 19 | virtual void DrawItem(BView* owner, BRect frame, bool complete=false); 20 | 21 | Conversation* GetConversation(); 22 | 23 | void ObserveString(int32 what, BString str); 24 | void ObserveInteger(int32 what, int32 num); 25 | 26 | private: 27 | Conversation* fChat; 28 | int8 fStatus; 29 | }; 30 | 31 | #endif // _CONVERSATION_ITEM_H 32 | -------------------------------------------------------------------------------- /application/views/ConversationListView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _CONVERSATION_LIST_H 6 | #define _CONVERSATION_LIST_H 7 | 8 | #include 9 | 10 | class BPopUpMenu; 11 | class Conversation; 12 | class ConversationAccountItem; 13 | 14 | 15 | class ConversationListView : public BOutlineListView { 16 | public: 17 | ConversationListView(const char* name); 18 | 19 | virtual void MessageReceived(BMessage* msg); 20 | virtual void SelectionChanged(); 21 | virtual void MouseDown(BPoint where); 22 | 23 | // After removing item, select another 24 | void RemoveItemSelecting(BListItem* item); 25 | 26 | void AddConversation(Conversation* chat); 27 | void RemoveConversation(Conversation* chat); 28 | void AddAccount(int64 instance); 29 | void RemoveAccount(int64 instance); 30 | void SortConversation(Conversation* chat); 31 | 32 | private: 33 | BPopUpMenu* _ConversationPopUp(); 34 | void _AddDefaultItems(BPopUpMenu* menu, Conversation* chat); 35 | BPopUpMenu* _BlankPopUp(); 36 | 37 | ConversationAccountItem* 38 | _EnsureAccountItem(Conversation* chat); 39 | }; 40 | 41 | #endif // _CONVERSATION_LIST_H 42 | -------------------------------------------------------------------------------- /application/views/ConversationView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2021-2022, Jaidyn Levesque. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _CHAT_VIEW_H 7 | #define _CHAT_VIEW_H 8 | 9 | #include 10 | #include 11 | 12 | #include "AppConstants.h" 13 | #include "Conversation.h" 14 | #include "Observer.h" 15 | 16 | class BStringView; 17 | class BSplitView; 18 | 19 | class BitmapView; 20 | class EnterTextView; 21 | class RenderView; 22 | class SendTextView; 23 | class User; 24 | class UserListView; 25 | 26 | 27 | const uint32 kClearText = 'CVct'; 28 | 29 | 30 | class ConversationView : public BGroupView, public Observer, public Notifier { 31 | public: 32 | ConversationView(Conversation* chat = NULL); 33 | 34 | virtual void AttachedToWindow(); 35 | void Show(); 36 | 37 | virtual void MessageReceived(BMessage* message); 38 | void ImMessage(BMessage* msg); 39 | 40 | Conversation* GetConversation(); 41 | void SetConversation(Conversation* chat); 42 | 43 | void UpdateUserList(UserMap users); 44 | void InvalidateUserList(); 45 | 46 | void ObserveString(int32 what, BString str); 47 | void ObservePointer(int32 what, void* ptr); 48 | 49 | void GetWeights(float* horizChat, float* horizList, 50 | float* vertChat, float* vertSend); 51 | void SetWeights(float horizChat, float horizList, 52 | float vertChat, float vertSend); 53 | 54 | private: 55 | typedef KeyMap UInt16IntMap; 56 | 57 | void _InitInterface(); 58 | 59 | bool _AppendOrEnqueueMessage(BMessage* msg); 60 | void _AppendMessage(BMessage* msg); 61 | 62 | void _ScrollToBottom(); 63 | 64 | // Helper functions for _AppendFormattedMessage() 65 | void _EnableStartingFaces(BMessage* msg, int32 index, 66 | uint16* face, UInt16IntMap* indices, int32* next); 67 | void _DisableEndingFaces(BMessage* msg, int32 index, 68 | uint16* face, UInt16IntMap* indices); 69 | void _EnableStartingColor(BMessage* msg, int32 index, 70 | rgb_color* color, int32* indice, int32* next); 71 | 72 | void _UserMessage(const char* format, const char* bodyFormat, 73 | BMessage* msg); 74 | 75 | // When the user hasn't joined any real conversations 76 | void _FakeChat(); 77 | 78 | Conversation* fConversation; 79 | BObjectList fMessageQueue; 80 | 81 | EnterTextView* fNameTextView; 82 | EnterTextView* fSubjectTextView; 83 | BitmapView* fProtocolView; 84 | BitmapView* fIcon; 85 | 86 | RenderView* fReceiveView; 87 | UserListView* fUserList; 88 | SendTextView* fSendView; 89 | BSplitView* fHorizSplit; 90 | BSplitView* fVertSplit; 91 | }; 92 | 93 | #endif // _CHAT_VIEW_H 94 | -------------------------------------------------------------------------------- /application/views/InviteDialogue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "InviteDialogue.h" 7 | 8 | #include 9 | #include 10 | 11 | 12 | #undef B_TRANSLATION_CONTEXT 13 | #define B_TRANSLATION_CONTEXT "InviteDialogue" 14 | 15 | 16 | InviteDialogue::InviteDialogue(BMessenger target, const char* title, 17 | const char* body, BMessage* acceptMsg, BMessage* rejectMsg, BBitmap* icon) 18 | : 19 | BAlert(title, body, B_TRANSLATE("Cancel"), B_TRANSLATE("Reject"), 20 | B_TRANSLATE("Accept"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING), 21 | fMessenger(target), 22 | fAcceptMsg(acceptMsg), 23 | fRejectMsg(rejectMsg) 24 | { 25 | if (icon != NULL) 26 | SetIcon(icon); 27 | } 28 | 29 | 30 | void 31 | InviteDialogue::MessageReceived(BMessage* msg) 32 | { 33 | int32 which; 34 | if (msg->FindInt32("which", &which) != B_OK) { 35 | BAlert::MessageReceived(msg); 36 | return; 37 | } 38 | 39 | switch (which) 40 | { 41 | case 0: 42 | break; 43 | case 1: 44 | fMessenger.SendMessage(fRejectMsg); 45 | break; 46 | case 2: 47 | fMessenger.SendMessage(fAcceptMsg); 48 | break; 49 | default: 50 | return; 51 | } 52 | 53 | PostMessage(B_QUIT_REQUESTED); 54 | } 55 | 56 | 57 | status_t 58 | InviteDialogue::Go() 59 | { 60 | return BAlert::Go(NULL); 61 | } 62 | 63 | 64 | -------------------------------------------------------------------------------- /application/views/InviteDialogue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef INVITE_DIALOGUE_H 6 | #define INVITE_DIALOGUE_H 7 | 8 | #include 9 | #include 10 | 11 | class BBitmap; 12 | 13 | 14 | // BAlert for quickly sending yes/no messages directly to a protocol looper 15 | class InviteDialogue : public BAlert { 16 | public: 17 | InviteDialogue(BMessenger target, const char* title, const char* body, 18 | BMessage* acceptMsg, BMessage* rejectMsg, 19 | BBitmap* icon = NULL); 20 | 21 | void MessageReceived(BMessage* msg); 22 | 23 | status_t Go(); 24 | 25 | private: 26 | BMessenger fMessenger; 27 | BMessage* fAcceptMsg; 28 | BMessage* fRejectMsg; 29 | }; 30 | 31 | 32 | #endif // INVITE_DIALOGUE_H 33 | 34 | -------------------------------------------------------------------------------- /application/views/RenderView.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "RenderView.h" 7 | 8 | #include 9 | 10 | 11 | RenderView::RenderView(const char* name) 12 | : 13 | RunView(name), 14 | fLastDay(364), 15 | fLastYear(64) 16 | { 17 | } 18 | 19 | 20 | void 21 | RenderView::AppendGeneric(const char* message, int64 when) 22 | { 23 | if (BString(message).IsEmpty() == true) return; 24 | AppendTimestamp(when); 25 | Append(message, ui_color(B_PANEL_TEXT_COLOR), B_BOLD_FACE); 26 | if (BString(message).EndsWith("\n") == false) Append("\n"); 27 | } 28 | 29 | 30 | void 31 | RenderView::AppendUserstamp(const char* nick, rgb_color nameColor) 32 | { 33 | Append("<", nameColor, B_BOLD_FACE); 34 | Append(nick, nameColor, B_BOLD_FACE); 35 | Append("> ", nameColor, B_BOLD_FACE); 36 | } 37 | 38 | 39 | void 40 | RenderView::AppendTimestamp(time_t time) 41 | { 42 | tm* tm = localtime(&time); 43 | 44 | // If day changed, print date divider 45 | if (fLastDay < tm->tm_yday || fLastYear < tm->tm_year) { 46 | char datestamp[11] = { '\0' }; 47 | strftime(datestamp, 10, "%Y-%m-%d", tm); 48 | BString stamp("――― %date% ―――\n"); 49 | stamp.ReplaceAll("%date%", datestamp); 50 | 51 | Append(stamp.String(), ui_color(B_PANEL_TEXT_COLOR), 52 | B_ITALIC_FACE | B_BOLD_FACE); 53 | 54 | fLastDay = tm->tm_yday; 55 | fLastYear = tm->tm_year; 56 | } 57 | 58 | if (time == 0) { 59 | Append("[xx:xx] ", ui_color(B_LINK_ACTIVE_COLOR), B_BOLD_FACE); 60 | return; 61 | } 62 | char timestamp[9] = { '\0' }; 63 | strftime(timestamp, 8, "[%H:%M] ", tm); 64 | Append(timestamp, ui_color(B_LINK_ACTIVE_COLOR), B_BOLD_FACE); 65 | } 66 | -------------------------------------------------------------------------------- /application/views/RenderView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _RENDER_VIEW_H 6 | #define _RENDER_VIEW_H 7 | 8 | #include 9 | 10 | 11 | class RenderView : public RunView { 12 | public: 13 | RenderView(const char* name); 14 | 15 | void AppendGeneric(const char* message, int64 when); 16 | void AppendUserstamp(const char* nick, rgb_color nameColor); 17 | void AppendTimestamp(time_t time = 0); 18 | 19 | private: 20 | int fLastDay; 21 | int fLastYear; 22 | }; 23 | 24 | #endif // _RENDER_VIEW_H 25 | -------------------------------------------------------------------------------- /application/views/ReplicantMenuItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 3 | * Copyright 2011-2012, Dario Casalinuovo. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | * 6 | * Authors: 7 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 8 | * Dario Casalinuovo 9 | */ 10 | #include "ReplicantMenuItem.h" 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | #include "AppMessages.h" 20 | #include "AppResources.h" 21 | #include "ReplicantStatusView.h" 22 | #include "Utils.h" 23 | 24 | const float kSize = 16; 25 | const float kCircle = 12; 26 | 27 | 28 | ReplicantMenuItem::ReplicantMenuItem(const char* label, UserStatus status, 29 | bool custom, char shortcut, uint32 modifiers) 30 | : 31 | BitmapMenuItem(label, NULL, NULL, shortcut, modifiers), 32 | fStatus(status), 33 | fCustom(custom) 34 | { 35 | BMessage* msg = new BMessage(APP_REPLICANT_STATUS_SET); 36 | msg->AddInt32("status", fStatus); 37 | SetMessage(msg); 38 | 39 | SetIcon(); 40 | } 41 | 42 | 43 | UserStatus 44 | ReplicantMenuItem::Status() const 45 | { 46 | return fStatus; 47 | } 48 | 49 | 50 | bool 51 | ReplicantMenuItem::IsCustom() const 52 | { 53 | return fCustom; 54 | } 55 | 56 | 57 | void 58 | ReplicantMenuItem::SetIcon() 59 | { 60 | BResources res = ChatResources(); 61 | if (res.InitCheck() != B_OK) 62 | return; 63 | 64 | int32 num = 0; 65 | 66 | switch (fStatus) { 67 | case STATUS_ONLINE: 68 | num = kOnlineReplicant; 69 | break; 70 | case STATUS_AWAY: 71 | num = kAwayReplicant; 72 | break; 73 | case STATUS_DO_NOT_DISTURB: 74 | num = kBusyReplicant; 75 | break; 76 | case STATUS_CUSTOM_STATUS: 77 | num = kIconReplicant; 78 | break; 79 | case STATUS_INVISIBLE: 80 | case STATUS_OFFLINE: 81 | num = kOfflineReplicant; 82 | break; 83 | default: 84 | break; 85 | } 86 | 87 | BBitmap* bitmap = IconFromResources(&res, num, B_MINI_ICON); 88 | SetBitmap(bitmap); 89 | } 90 | -------------------------------------------------------------------------------- /application/views/ReplicantMenuItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 3 | * Copyright 2011-2012, Dario Casalinuovo. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _STATUS_MENU_ITEM_H 7 | #define _STATUS_MENU_ITEM_H 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include "UserStatus.h" 14 | 15 | class BBitmap; 16 | 17 | const int32 kSetStatus = 'SEST'; 18 | 19 | class ReplicantMenuItem : public BitmapMenuItem { 20 | public: 21 | ReplicantMenuItem(const char* label, UserStatus status, 22 | bool custom = false, char shortcut = 0, uint32 modifiers = 0); 23 | 24 | UserStatus Status() const; 25 | bool IsCustom() const; 26 | 27 | private: 28 | UserStatus fStatus; 29 | bool fCustom; 30 | 31 | void SetIcon(); 32 | }; 33 | 34 | #endif // _STATUS_MENU_ITEM_H 35 | -------------------------------------------------------------------------------- /application/views/ReplicantStatusView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-2012, Dario Casalinuovo. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | * 5 | * Authors: 6 | * Dario Casalinuovo 7 | */ 8 | #ifndef _REPLICANT_STATUS_VIEW_H 9 | #define _REPLICANT_STATUS_VIEW_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "AppResources.h" 17 | #include "UserStatus.h" 18 | 19 | 20 | class BPopUpMenu; 21 | class BMenuField; 22 | 23 | class BitmapView; 24 | class NicknameTextControl; 25 | class ReplicantHandler; 26 | 27 | class ReplicantStatusView : public BView { 28 | public: 29 | ReplicantStatusView(); 30 | ReplicantStatusView(BMessage* archive); 31 | ~ReplicantStatusView(); 32 | 33 | virtual void MessageReceived(BMessage* msg); 34 | virtual void AttachedToWindow(); 35 | virtual void DetachedFromWindow(); 36 | 37 | virtual void Draw(BRect rect); 38 | 39 | void SetStatus(UserStatus status); 40 | 41 | virtual status_t Archive(BMessage* archive, bool deep) const; 42 | 43 | static ReplicantStatusView* Instantiate(BMessage* archive); 44 | 45 | void MouseDown(BPoint point); 46 | 47 | 48 | static status_t InstallReplicant(); 49 | static status_t RemoveReplicant(); 50 | private: 51 | void _Init(); 52 | void _BuildMenu(); 53 | void _ShowMenu(BPoint point); 54 | BBitmap* _GetIcon(const uint32 id); 55 | 56 | BBitmap* fAppIcon; 57 | 58 | BBitmap* fConnectingIcon; 59 | BBitmap* fIcon; 60 | BBitmap* fOfflineIcon; 61 | BBitmap* fBusyIcon; 62 | BBitmap* fAwayIcon; 63 | BBitmap* fExitMenuIcon; 64 | BBitmap* fPreferencesIcon; 65 | 66 | BResources fResources; 67 | 68 | BPopUpMenu* fReplicantMenu; 69 | 70 | bool fIsInstalled; 71 | BMessenger* fCayaMsg; 72 | 73 | ReplicantHandler* fReplicantHandler; 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /application/views/RoomListRow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "RoomListRow.h" 7 | 8 | #include 9 | 10 | 11 | RoomListRow::RoomListRow(BMessage* msg) 12 | : 13 | BRow(), 14 | fMessage(new BMessage(*msg)), 15 | fInstance(-1) 16 | { 17 | int64 proto = msg->FindInt64("instance"); 18 | BString id = msg->FindString("chat_id"); 19 | BString name = msg->GetString("chat_name", id); 20 | BString desc = msg->FindString("subject"); 21 | BString category = msg->FindString("category"); 22 | int32 user_n = msg->GetInt32("user_count", -1); 23 | 24 | SetField(new BStringField(name), kNameColumn); 25 | SetField(new BStringField(desc), kDescColumn); 26 | SetField(new BStringField(category), kCatColumn); 27 | if (user_n > -1) 28 | SetField(new BIntegerField(user_n), kUserColumn); 29 | } 30 | 31 | 32 | RoomListRow::~RoomListRow() 33 | { 34 | delete fMessage; 35 | } 36 | -------------------------------------------------------------------------------- /application/views/RoomListRow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _ROOM_LIST_ROW_H 6 | #define _ROOM_LIST_ROW_H 7 | 8 | #include 9 | 10 | 11 | enum { 12 | kNameColumn, 13 | kDescColumn, 14 | kCatColumn, 15 | kUserColumn 16 | }; 17 | 18 | 19 | class RoomListRow : public BRow { 20 | public: 21 | RoomListRow(BMessage* msg); 22 | ~RoomListRow(); 23 | 24 | BMessage* Message() { return fMessage; } 25 | int64 Instance() { return fInstance; } 26 | 27 | private: 28 | int64 fInstance; 29 | BMessage* fMessage; 30 | }; 31 | 32 | #endif // _ROOM_LIST_ROW_H 33 | -------------------------------------------------------------------------------- /application/views/RosterItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Andrea Anzani. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _ROSTER_ITEM_H 6 | #define _ROSTER_ITEM_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "AppConstants.h" 15 | #include "Contact.h" 16 | #include "Observer.h" 17 | 18 | class RosterItem : public BStringItem, public Observer { 19 | public: 20 | RosterItem(const char* name, Contact* contact); 21 | ~RosterItem(); 22 | 23 | bool IsVisible() const { return fVisible; } 24 | void SetVisible(bool visible); 25 | 26 | void DrawItem(BView *owner, BRect frame, 27 | bool complete = false); 28 | 29 | void Update(BView *owner, const BFont *font); 30 | 31 | Contact* GetContact() { return fContact;} 32 | 33 | UserStatus Status() const { return fStatus; } 34 | void SetStatus(UserStatus status); 35 | 36 | BString PersonalStatus() const { return fPersonalStatus; } 37 | void SetPersonalStatus(BString str) { fPersonalStatus = str; } 38 | 39 | BBitmap* Bitmap() const { return fBitmap; } 40 | void SetBitmap(BBitmap *); 41 | 42 | protected: 43 | void ObserveString(int32 what, BString str); 44 | void ObservePointer(int32 what, void* ptr); 45 | void ObserveInteger(int32 what, int32 val); 46 | 47 | private: 48 | Contact* fContact; 49 | float fBaselineOffset; 50 | BString fPersonalStatus; 51 | UserStatus fStatus; 52 | BBitmap* fBitmap; 53 | bool fVisible; 54 | BGradientLinear fGradient; 55 | }; 56 | 57 | #endif // _ROSTER_ITEM_H 58 | -------------------------------------------------------------------------------- /application/views/RosterListView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _ROSTER_LIST_VIEW_H 6 | #define _ROSTER_LIST_VIEW_H 7 | 8 | #include 9 | 10 | class BPopUpMenu; 11 | 12 | class Contact; 13 | class RosterItem; 14 | 15 | class RosterListView : public BOutlineListView 16 | { 17 | public: 18 | RosterListView(const char* name); 19 | 20 | virtual void MessageReceived(BMessage* msg); 21 | virtual void MouseMoved(BPoint where, uint32 code, const BMessage*); 22 | virtual void MouseDown(BPoint where); 23 | virtual void Draw(BRect updateRect); 24 | virtual void AttachedToWindow(); 25 | 26 | virtual bool AddItem(BListItem* item); 27 | virtual bool RemoveItem(BListItem* item); 28 | RosterItem* RosterItemAt(int32 index); 29 | 30 | void Sort(); 31 | 32 | private: 33 | 34 | void _InfoWindow(Contact* linker); 35 | 36 | BPopUpMenu* fPopUp; 37 | RosterItem* fPrevItem; 38 | }; 39 | 40 | #endif // _ROSTER_LIST_VIEW_H 41 | -------------------------------------------------------------------------------- /application/views/RosterView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | * 7 | * Authors: 8 | * Andrea Anzani, andrea.anzani@gmail.com 9 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 10 | * Jaidyn Levesque, jadedctrl@teknik.io 11 | */ 12 | #ifndef _ROSTER_VIEW_H 13 | #define _ROSTER_VIEW_H 14 | 15 | #include 16 | 17 | #include "Maps.h" 18 | 19 | class BStringItem; 20 | class BTextControl; 21 | class RosterItem; 22 | class RosterListView; 23 | 24 | 25 | class RosterView : public BGroupView { 26 | public: 27 | RosterView(const char* title, bigtime_t account = -1); 28 | 29 | void MessageReceived(BMessage* message); 30 | void ImMessage(BMessage* msg); 31 | 32 | void AttachedToWindow(); 33 | void SetInvocationMessage(BMessage* msg); 34 | 35 | void SetAccount(bigtime_t instance_id); 36 | void SetManualString(const char* text) { fManualStr = text; } 37 | 38 | int64 GetAccount() { return fAccount; } 39 | BTextControl* SearchBox() { return fSearchBox; } 40 | 41 | void UpdateListItem(RosterItem* item); 42 | 43 | RosterListView* ListView(); 44 | 45 | private: 46 | RosterMap _RosterMap(); 47 | 48 | RosterListView* fListView; 49 | BTextControl* fSearchBox; 50 | bigtime_t fAccount; 51 | 52 | BStringItem* fManualItem; 53 | BString fManualStr; 54 | }; 55 | 56 | #endif // _ROSTER_VIEW_H 57 | -------------------------------------------------------------------------------- /application/views/SendTextView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _SEND_TEXT_VIEW_H 6 | #define _SEND_TEXT_VIEW_H 7 | 8 | #include 9 | #include 10 | 11 | #include "ConversationView.h" 12 | 13 | 14 | class SendTextView : public BTextView { 15 | public: 16 | SendTextView(const char* name, ConversationView* convView); 17 | 18 | virtual void KeyDown(const char* bytes, int32 numBytes); 19 | 20 | private: 21 | void _AutoComplete(); 22 | BString _NextMatch(BStringList list, BString current); 23 | 24 | BStringList _CommandNames(); 25 | BStringList _UserNames(); 26 | 27 | void _AppendHistory(); 28 | void _UpHistory(); 29 | void _DownHistory(); 30 | 31 | ConversationView* fChatView; 32 | 33 | // Used for auto-completion 34 | int32 fCurrentIndex; 35 | BString fCurrentWord; 36 | BStringList fCurrentList; 37 | 38 | // Used for history 39 | BStringList fHistory; 40 | int32 fHistoryIndex; 41 | }; 42 | 43 | #endif // _SEND_TEXT_VIEW_H 44 | -------------------------------------------------------------------------------- /application/views/StatusMenuItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | * 5 | * Authors: 6 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 7 | */ 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include "AppResources.h" 17 | #include "StatusMenuItem.h" 18 | #include "Utils.h" 19 | 20 | const float kSize = 16; 21 | const float kCircle = 12; 22 | 23 | 24 | StatusMenuItem::StatusMenuItem(const char* label, UserStatus status, 25 | bool custom, char shortcut, uint32 modifiers) 26 | : 27 | BitmapMenuItem(label, NULL, NULL, shortcut, modifiers), 28 | fStatus(status), 29 | fCustom(custom) 30 | { 31 | BMessage* msg = new BMessage(kSetStatus); 32 | msg->AddInt32("status", fStatus); 33 | msg->AddBool("custom", fCustom); 34 | SetMessage(msg); 35 | 36 | SetIcon(); 37 | } 38 | 39 | 40 | UserStatus 41 | StatusMenuItem::Status() const 42 | { 43 | return fStatus; 44 | } 45 | 46 | 47 | bool 48 | StatusMenuItem::IsCustom() const 49 | { 50 | return fCustom; 51 | } 52 | 53 | 54 | void 55 | StatusMenuItem::SetIcon() 56 | { 57 | BResources res = ChatResources(); 58 | if (res.InitCheck() != B_OK) 59 | return; 60 | 61 | int32 num = 0; 62 | 63 | switch (fStatus) { 64 | case STATUS_ONLINE: 65 | num = kOnlineReplicant; 66 | break; 67 | case STATUS_AWAY: 68 | num = kAwayReplicant; 69 | break; 70 | case STATUS_DO_NOT_DISTURB: 71 | num = kBusyReplicant; 72 | break; 73 | case STATUS_CUSTOM_STATUS: 74 | num = kIconReplicant; 75 | break; 76 | case STATUS_INVISIBLE: 77 | case STATUS_OFFLINE: 78 | num = kOfflineReplicant; 79 | break; 80 | default: 81 | break; 82 | } 83 | 84 | BBitmap* bitmap = IconFromResources(&res, num, B_MINI_ICON); 85 | SetBitmap(bitmap); 86 | } 87 | -------------------------------------------------------------------------------- /application/views/StatusMenuItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _STATUS_MENU_ITEM_H 6 | #define _STATUS_MENU_ITEM_H 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include "UserStatus.h" 13 | 14 | class BBitmap; 15 | 16 | const int32 kSetStatus = 'SEST'; 17 | 18 | class StatusMenuItem : public BitmapMenuItem { 19 | public: 20 | StatusMenuItem(const char* label, UserStatus status, 21 | bool custom = false, char shortcut = 0, 22 | uint32 modifiers = 0); 23 | 24 | UserStatus Status() const; 25 | bool IsCustom() const; 26 | 27 | private: 28 | UserStatus fStatus; 29 | bool fCustom; 30 | 31 | void SetIcon(); 32 | }; 33 | 34 | #endif // _STATUS_MENU_ITEM_H 35 | -------------------------------------------------------------------------------- /application/views/StatusView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Pier Luigi Fiorini. All rights reserved. 3 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _STATUS_VIEW_H 7 | #define _STATUS_VIEW_H 8 | 9 | #include 10 | 11 | #include "UserStatus.h" 12 | #include "Observer.h" 13 | 14 | class BPopUpMenu; 15 | 16 | class AccountsMenu; 17 | class BitmapView; 18 | class EnterTextView; 19 | class MenuButton; 20 | 21 | class StatusView : public BView, public Observer { 22 | public: 23 | StatusView(const char* name); 24 | 25 | virtual void AttachedToWindow(); 26 | virtual void MessageReceived(BMessage* msg); 27 | 28 | virtual void ObserveString(int32 what, BString str); 29 | virtual void ObserveInteger(int32 what, int32 value); 30 | virtual void ObservePointer(int32 what, void* ptr); 31 | 32 | 33 | private: 34 | void _SetName(BString name); 35 | void _SetStatus(UserStatus status); 36 | void _SetAvatarIcon(const BBitmap* bitmap); 37 | 38 | void _SetToAccount(); 39 | 40 | EnterTextView* fNickname; 41 | BitmapView* fAvatar; 42 | BPopUpMenu* fStatusMenu; 43 | 44 | MenuButton* fAccountsButton; 45 | AccountsMenu* fAccountsMenu; 46 | int64 fAccount; 47 | }; 48 | 49 | #endif // _STATUS_VIEW_H 50 | -------------------------------------------------------------------------------- /application/views/TemplateView.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | * 5 | * Authors: 6 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 7 | */ 8 | 9 | #include "TemplateView.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | 24 | TemplateView::TemplateView(const char* name) 25 | : BView(name, B_WILL_DRAW) 26 | { 27 | } 28 | 29 | 30 | void 31 | TemplateView::AttachedToWindow() 32 | { 33 | // Once we are attached to window, the GUI is already created 34 | // so we can set our window as target for messages 35 | for (int32 i = 0; i < CountChildren(); i++) { 36 | BView* child = ChildAt(i); 37 | 38 | BMenu* menu = dynamic_cast(child); 39 | BMenuField* menuField 40 | = dynamic_cast(child); 41 | BTextControl* textControl 42 | = dynamic_cast(child); 43 | BTextView* textView = dynamic_cast(child); 44 | BCheckBox* checkBox = dynamic_cast(child); 45 | 46 | if (menuField) 47 | menu = menuField->Menu(); 48 | 49 | if (menu) { 50 | if (i == 0) 51 | menu->MakeFocus(true); 52 | menu->SetTargetForItems(Window()); 53 | } 54 | 55 | if (textControl) 56 | if (i == 0) 57 | textControl->MakeFocus(true); 58 | 59 | if (checkBox) 60 | if (i == 0) 61 | checkBox->MakeFocus(true); 62 | 63 | if (textView) 64 | if (i == 0) 65 | textView->MakeFocus(true); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /application/views/TemplateView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _TEMPLATE_VIEW_H 6 | #define _TEMPLATE_VIEW_H 7 | 8 | #include 9 | 10 | 11 | class TemplateView : public BView { 12 | public: 13 | TemplateView(const char* name); 14 | 15 | virtual void AttachedToWindow(); 16 | }; 17 | 18 | #endif // _TEMPLATE_VIEW_H 19 | -------------------------------------------------------------------------------- /application/views/UserItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "UserItem.h" 7 | 8 | #include 9 | #include 10 | 11 | #include "AppConstants.h" 12 | #include "NotifyMessage.h" 13 | #include "User.h" 14 | #include "Utils.h" 15 | 16 | 17 | UserItem::UserItem(User* user) 18 | : 19 | BStringItem(user->GetName()), 20 | fUser(user), 21 | fStatus(user->GetNotifyStatus()) 22 | { 23 | user->RegisterObserver(this); 24 | } 25 | 26 | 27 | UserItem::~UserItem() 28 | { 29 | fUser->UnregisterObserver(this); 30 | } 31 | 32 | 33 | void 34 | UserItem::DrawItem(BView* owner, BRect frame, bool complete) 35 | { 36 | rgb_color highColor = owner->HighColor(); 37 | owner->SetHighColor(_GetTextColor(highColor)); 38 | 39 | BStringItem::DrawItem(owner, frame, complete); 40 | 41 | owner->SetHighColor(highColor); 42 | } 43 | 44 | 45 | void 46 | UserItem::ObserveString(int32 what, BString str) 47 | { 48 | switch (what) { 49 | case STR_CONTACT_NAME: 50 | SetText(str); 51 | break; 52 | } 53 | } 54 | 55 | 56 | void 57 | UserItem::ObserveInteger(int32 what, int32 value) 58 | { 59 | switch (what) { 60 | case INT_CONTACT_STATUS: 61 | { 62 | fStatus = value; 63 | break; 64 | } 65 | } 66 | } 67 | 68 | 69 | User* 70 | UserItem::GetUser() 71 | { 72 | return fUser; 73 | } 74 | 75 | 76 | rgb_color 77 | UserItem::_GetTextColor(rgb_color highColor) 78 | { 79 | switch (fStatus) 80 | { 81 | case STATUS_AWAY: 82 | return TintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 1); 83 | case STATUS_INVISIBLE: 84 | case STATUS_DO_NOT_DISTURB: 85 | return TintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 2); 86 | case STATUS_OFFLINE: 87 | return TintColor(ui_color(B_LIST_ITEM_TEXT_COLOR), 3); 88 | } 89 | return highColor; 90 | } 91 | -------------------------------------------------------------------------------- /application/views/UserItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef USERITEM_H 6 | #define USERITEM_H 7 | 8 | #include 9 | #include 10 | 11 | #include "Observer.h" 12 | 13 | class User; 14 | 15 | 16 | class UserItem : public BStringItem, public Observer { 17 | public: 18 | UserItem(User* user); 19 | ~UserItem(); 20 | 21 | virtual void DrawItem(BView* owner, BRect frame, bool complete); 22 | 23 | virtual void ObserveString(int32 what, BString str); 24 | virtual void ObserveInteger(int32 what, int32 value); 25 | 26 | User* GetUser(); 27 | 28 | protected: 29 | rgb_color _GetTextColor(rgb_color highColor); 30 | 31 | private: 32 | User* fUser; 33 | int fStatus; 34 | }; 35 | 36 | #endif // USERITEM_H 37 | -------------------------------------------------------------------------------- /application/views/UserListView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef CONVERSATIONLIST_H 6 | #define CONVERSATIONLIST_H 7 | 8 | #include 9 | 10 | #include "Role.h" 11 | 12 | class BPopUpMenu; 13 | 14 | class Conversation; 15 | class User; 16 | 17 | 18 | enum 19 | { 20 | kUserInfo = 'ULui', 21 | kDeafenUser = 'UMdu', 22 | kUndeafenUser = 'UMud', 23 | kMuteUser = 'UMmu', 24 | kUnmuteUser = 'UMum', 25 | kKickUser = 'UMku', 26 | kBanUser = 'UMbu' 27 | }; 28 | 29 | 30 | class UserListView : public BListView { 31 | public: 32 | UserListView(const char* name); 33 | 34 | virtual void MouseDown(BPoint where); 35 | 36 | void Sort(); 37 | 38 | bool HasUser(User* user); 39 | void AddUser(User* user); 40 | void RemoveUser(User* user); 41 | 42 | void SetConversation(Conversation* chat) { fChat = chat; } 43 | 44 | private: 45 | BPopUpMenu* _UserPopUp(); 46 | BPopUpMenu* _BlankPopUp(); 47 | 48 | void _ModerationAction(int32 im_what); 49 | void _ProcessItem(BMessage* itemMsg, BPopUpMenu* menu, 50 | Role* user, Role* target, BString target_id); 51 | 52 | Conversation* fChat; 53 | }; 54 | 55 | #endif // CONVERSATIONLIST_H 56 | -------------------------------------------------------------------------------- /application/views/UserPopUp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | * 5 | * Authors: 6 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 7 | */ 8 | 9 | #include "UserPopUp.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | #include "User.h" 19 | #include "NotifyMessage.h" 20 | 21 | 22 | const window_feel kMenuWindowFeel = window_feel(B_NORMAL_WINDOW_FEEL); 23 | 24 | const int32 kNickChanged = 'NICH'; 25 | 26 | 27 | UserPopUp::UserPopUp(User* user) 28 | : BWindow(BRect(0, 0, 1, 1), "UserPopUp", B_BORDERED_WINDOW_LOOK, 29 | kMenuWindowFeel, B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_MINIMIZABLE | 30 | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | 31 | B_AVOID_FOCUS | B_AUTO_UPDATE_SIZE_LIMITS), 32 | fCoords(B_ORIGIN) 33 | { 34 | // Box to change nick name 35 | fNickBox = new BTextControl("nickBox", NULL, user->GetName(), 36 | new BMessage(kNickChanged)); 37 | 38 | // Real nick name 39 | fLabel = new BStringView("label", user->GetId()); 40 | 41 | // Avatar bitmap 42 | fAvatarView = new BitmapView("avatarView"); 43 | fAvatarView->SetBitmap(user->AvatarBitmap()); 44 | 45 | // Layout 46 | SetLayout(new BGroupLayout(B_VERTICAL)); 47 | AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10) 48 | .AddGroup(B_VERTICAL) 49 | .Add(fNickBox) 50 | .Add(fLabel) 51 | .AddGlue() 52 | .End() 53 | .Add(fAvatarView) 54 | .SetInsets(10, 10, 10, 10) 55 | .TopView() 56 | ); 57 | } 58 | 59 | 60 | void 61 | UserPopUp::MessageReceived(BMessage* msg) 62 | { 63 | switch (msg->what) { 64 | case kNickChanged: 65 | break; 66 | default: 67 | BWindow::MessageReceived(msg); 68 | } 69 | } 70 | 71 | 72 | void 73 | UserPopUp::MoveTo(BPoint where) 74 | { 75 | if (fCoords != where) { 76 | if (Lock()) { 77 | BWindow::MoveTo(where); 78 | fCoords = where; 79 | Unlock(); 80 | } 81 | } 82 | } 83 | 84 | 85 | void 86 | UserPopUp::ObserveString(int32 what, BString str) 87 | { 88 | switch (what) { 89 | case STR_CONTACT_NAME: 90 | if (Lock()) { 91 | fLabel->SetText(str); 92 | Unlock(); 93 | } 94 | break; 95 | } 96 | } 97 | 98 | 99 | void 100 | UserPopUp::ObservePointer(int32 what, void* ptr) 101 | { 102 | switch (what) { 103 | case PTR_AVATAR_BITMAP: 104 | if (Lock()) { 105 | fAvatarView->SetBitmap((BBitmap*)ptr); 106 | Unlock(); 107 | } 108 | break; 109 | } 110 | } 111 | 112 | 113 | void 114 | UserPopUp::ObserveInteger(int32 what, int32 val) 115 | { 116 | switch (what) { 117 | case INT_CONTACT_STATUS: 118 | break; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /application/views/UserPopUp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _USER_POPUP_H 6 | #define _USER_POPUP_H 7 | 8 | #include 9 | 10 | #include "Observer.h" 11 | 12 | class BTextControl; 13 | class BStringView; 14 | 15 | class BitmapView; 16 | class User; 17 | 18 | class UserPopUp : public BWindow, public Observer { 19 | public: 20 | UserPopUp(User* user); 21 | 22 | virtual void MessageReceived(BMessage* msg); 23 | 24 | void MoveTo(BPoint where); 25 | 26 | protected: 27 | void ObserveString(int32 what, BString str); 28 | void ObservePointer(int32 what, void* ptr); 29 | void ObserveInteger(int32 what, int32 val); 30 | 31 | private: 32 | BPoint fCoords; 33 | BTextControl* fNickBox; 34 | BStringView* fLabel; 35 | BitmapView* fAvatarView; 36 | }; 37 | 38 | 39 | #endif // _USER_POPUP_H 40 | 41 | -------------------------------------------------------------------------------- /application/windows/AccountsWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _ACCOUNTS_WINDOW_H 7 | #define _ACCOUNTS_WINDOW_H 8 | 9 | #include 10 | 11 | class BButton; 12 | class BListView; 13 | class BPopUpMenu; 14 | 15 | class ProtocolSettings; 16 | 17 | 18 | class AccountsWindow : public BWindow { 19 | public: 20 | AccountsWindow(); 21 | 22 | virtual void MessageReceived(BMessage* msg); 23 | 24 | private: 25 | BListView* fListView; 26 | BPopUpMenu* fProtosMenu; 27 | BButton* fDelButton; 28 | BButton* fEditButton; 29 | BButton* fToggleButton; 30 | 31 | void _LoadListView(ProtocolSettings* settings); 32 | 33 | int64 _AccountInstance(const char* account); 34 | }; 35 | 36 | #endif // _ACCOUNTS_WINDOW_H 37 | -------------------------------------------------------------------------------- /application/windows/ConversationInfoWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _CONVERSATION_INFO_WINDOW_H 6 | #define _CONVERSATION_INFO_WINDOW_H 7 | 8 | #include 9 | 10 | #include "Observer.h" 11 | 12 | class BStringView; 13 | class BTextView; 14 | 15 | class BitmapView; 16 | class Conversation; 17 | class UrlTextView; 18 | 19 | 20 | class ConversationInfoWindow : public BWindow, public Observer { 21 | public: 22 | ConversationInfoWindow(Conversation* chat); 23 | ~ConversationInfoWindow(); 24 | 25 | virtual void ObserveString(int32 what, BString string); 26 | virtual void ObserveInteger(int32 what, int32 num); 27 | virtual void ObservePointer(int32 what, void* ptr); 28 | 29 | private: 30 | void _InitInterface(); 31 | 32 | void _SetIdLabel(BString id); 33 | void _SetUserCountLabel(int32 userCount); 34 | 35 | Conversation* fChat; 36 | 37 | BStringView* fNameLabel; 38 | BStringView* fUserCountLabel; 39 | BTextView* fIdLabel; 40 | BitmapView* fIcon; 41 | }; 42 | 43 | #endif // _CONVERSATION_INFO_WINDOW_H 44 | -------------------------------------------------------------------------------- /application/windows/MainWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Copyright 2021-2022, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | */ 7 | #ifndef _MAIN_WINDOW_H 8 | #define _MAIN_WINDOW_H 9 | 10 | #include 11 | 12 | #include "libsupport/KeyMap.h" 13 | 14 | class BCardLayout; 15 | class BLayoutItem; 16 | class BMenu; 17 | class BSplitView; 18 | class BTextView; 19 | 20 | class Conversation; 21 | class ConversationItem; 22 | class ConversationListView; 23 | class ConversationView; 24 | class ProtocolSettings; 25 | class RosterItem; 26 | class RosterWindow; 27 | class StatusView; 28 | 29 | 30 | class MainWindow: public BWindow { 31 | public: 32 | MainWindow(); 33 | 34 | void Start(); 35 | void Show(); 36 | virtual bool QuitRequested(); 37 | 38 | virtual void MessageReceived(BMessage* message); 39 | void ImMessage(BMessage* msg); 40 | 41 | virtual void WorkspaceActivated(int32 workspace, 42 | bool active); 43 | 44 | void SetConversation(Conversation* chat); 45 | void SetConversationView(ConversationView* view); 46 | void RemoveConversation(Conversation* chat); 47 | void SortConversation(Conversation* chat); 48 | 49 | private: 50 | void _InitInterface(); 51 | 52 | BMenuBar* _CreateMenuBar(); 53 | BMenu* _CreateAccountsMenu(); 54 | void _RefreshAccountsMenu(); 55 | BMenu* _CreateProtocolMenu(); 56 | 57 | void _ToggleMenuItems(); 58 | 59 | ConversationItem* 60 | _EnsureConversationItem(BMessage* msg); 61 | void _EnsureConversationView(Conversation* chat); 62 | 63 | void _ApplyWeights(); 64 | void _SaveWeights(); 65 | 66 | bool _PopulateWithAccounts(BMenu* menu, 67 | ProtocolSettings* settings); 68 | void _ReplaceMenu(const char* name, BMenu* newMenu); 69 | 70 | RosterWindow* fRosterWindow; 71 | bool fWorkspaceChanged; 72 | BMenuBar* fMenuBar; 73 | 74 | KeyMap fChatList; 75 | 76 | // Left panel, chat list 77 | ConversationListView* fListView; 78 | StatusView* fStatusView; 79 | BSplitView* fSplitView; 80 | 81 | // Right panel, chat 82 | BCardLayout* fChatLayout; 83 | Conversation* fConversation; 84 | ConversationView* fBackupChatView; 85 | }; 86 | 87 | 88 | #endif // _MAIN_WINDOW_H 89 | 90 | -------------------------------------------------------------------------------- /application/windows/PreferencesWindow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | * 5 | * Authors: 6 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 7 | */ 8 | 9 | #include "PreferencesWindow.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "PreferencesBehavior.h" 18 | #include "PreferencesChatWindow.h" 19 | #include "PreferencesNotifications.h" 20 | 21 | 22 | #undef B_TRANSLATION_CONTEXT 23 | #define B_TRANSLATION_CONTEXT "PreferencesWindow" 24 | 25 | 26 | const uint32 kApply = 'SAVE'; 27 | 28 | 29 | PreferencesWindow::PreferencesWindow() 30 | : BWindow(BRect(0, 0, 500, 615), B_TRANSLATE("Preferences"), 31 | B_TITLED_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_RESIZABLE 32 | | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE) 33 | { 34 | BTabView* tabView = new BTabView("tabView", B_WIDTH_AS_USUAL); 35 | tabView->AddTab(new PreferencesBehavior()); 36 | tabView->AddTab(new PreferencesChatWindow()); 37 | tabView->AddTab(new PreferencesNotifications()); 38 | 39 | // Tab resizing here is a bit wonky. We want each tab to be visible, 40 | // but we don't want the tab-view to be too wide… 41 | float charCount = 0; 42 | for (int i = 0; i < tabView->CountTabs(); i++) 43 | charCount += strlen(tabView->TabAt(i)->Label()); 44 | 45 | // These values account for the decreasing amount of padding within tabs, 46 | // Ignucius forgive me. 47 | float textWidth = be_plain_font->Size(); 48 | switch ((int)textWidth) { 49 | case 8: case 9: charCount += 14; break; 50 | case 10: case 11: charCount += 5; break; 51 | case 12: break; 52 | case 13: case 14: case 15: 53 | charCount -= 4; break; 54 | default: charCount -= 10; 55 | } 56 | tabView->SetExplicitMinSize(BSize(charCount * textWidth, B_SIZE_UNSET)); 57 | 58 | BButton* ok = new BButton(B_TRANSLATE("OK"), new BMessage(kApply)); 59 | 60 | BLayoutBuilder::Group<>(this, B_VERTICAL) 61 | .Add(tabView) 62 | .AddGroup(B_HORIZONTAL) 63 | .SetInsets(0, 0, B_USE_HALF_ITEM_SPACING, B_USE_HALF_ITEM_SPACING) 64 | .AddGlue() 65 | .Add(ok) 66 | .End() 67 | .End(); 68 | 69 | CenterOnScreen(); 70 | } 71 | 72 | 73 | void 74 | PreferencesWindow::MessageReceived(BMessage* msg) 75 | { 76 | switch (msg->what) { 77 | case kApply: 78 | Close(); 79 | break; 80 | default: 81 | BWindow::MessageReceived(msg); 82 | } 83 | } 84 | 85 | 86 | -------------------------------------------------------------------------------- /application/windows/PreferencesWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _PREFERENCES_WINDOW_H 6 | #define _PREFERENCES_WINDOW_H 7 | 8 | #include 9 | 10 | class PreferencesWindow : public BWindow { 11 | public: 12 | PreferencesWindow(); 13 | 14 | virtual void MessageReceived(BMessage* msg); 15 | }; 16 | 17 | #endif // _PREFERENCES_WINDOW_H 18 | -------------------------------------------------------------------------------- /application/windows/RoomListWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _ROOM_LIST_WINDOW_H 6 | #define _ROOM_LIST_WINDOW_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | class BButton; 14 | class BColumnListView; 15 | class RoomListRow; 16 | 17 | 18 | typedef KeyMap*> RowMap; 19 | 20 | 21 | class RoomListWindow : public BWindow { 22 | public: 23 | RoomListWindow(); 24 | ~RoomListWindow(); 25 | 26 | static RoomListWindow* Get(); 27 | static bool Check(); 28 | 29 | virtual void MessageReceived(BMessage* msg); 30 | 31 | private: 32 | void _InitInterface(); 33 | 34 | void _EmptyList(); 35 | 36 | BButton* fJoinButton; 37 | BColumnListView* fListView; 38 | 39 | RowMap fRows; 40 | int64 fAccount; 41 | 42 | static RoomListWindow* fInstance; 43 | }; 44 | 45 | #endif // _ROOM_LIST_WINDOW_H 46 | -------------------------------------------------------------------------------- /application/windows/RosterEditWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | * 7 | * Authors: 8 | * Andrea Anzani, andrea.anzani@gmail.com 9 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 10 | * Jaidyn Levesque, jadedctrl@teknik.io 11 | */ 12 | #ifndef _ROSTER_EDITWINDOW_H 13 | #define _ROSTER_EDIT_WINDOW_H 14 | 15 | #include 16 | 17 | class BMenuField; 18 | class RosterItem; 19 | class RosterView; 20 | class TemplateWindow; 21 | 22 | 23 | /* A window with the a list of the user's contacts, will send a message to 24 | the server with contact info, once a contact is selected. */ 25 | class RosterEditWindow : public BWindow { 26 | public: 27 | RosterEditWindow(); 28 | ~RosterEditWindow(); 29 | static RosterEditWindow* Get(); 30 | static bool Check(); 31 | 32 | void MessageReceived(BMessage* message); 33 | void UpdateListItem(RosterItem* item); 34 | 35 | private: 36 | BMenuField* fAccountField; 37 | 38 | BString fEditingUser; 39 | TemplateWindow* fEditingWindow; 40 | 41 | RosterView* fRosterView; 42 | 43 | static RosterEditWindow* fInstance; 44 | }; 45 | 46 | #endif // _ROSTER_EDIT_WINDOW_H 47 | -------------------------------------------------------------------------------- /application/windows/RosterWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved. 4 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 5 | * Distributed under the terms of the MIT License. 6 | * 7 | * Authors: 8 | * Andrea Anzani, andrea.anzani@gmail.com 9 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 10 | * Jaidyn Levesque, jadedctrl@teknik.io 11 | */ 12 | #ifndef ROSTERWINDOW_H 13 | #define ROSTERWINDOW_H 14 | 15 | #include 16 | 17 | class BMenuField; 18 | class RosterItem; 19 | class RosterView; 20 | 21 | 22 | /* A window with the a list of the user's contacts, will send a message to 23 | the server with contact info, once a contact is selected. */ 24 | class RosterWindow : public BWindow { 25 | public: 26 | RosterWindow(const char* title, BMessage* selectMsg, BMessenger* messenger, 27 | bigtime_t instance = -1); 28 | 29 | void MessageReceived(BMessage* message); 30 | 31 | void UpdateListItem(RosterItem* item); 32 | 33 | private: 34 | BButton* fOkButton; 35 | BMenuField* fAccountField; 36 | 37 | RosterView* fRosterView; 38 | BMessenger* fTarget; 39 | BMessage* fMessage; 40 | }; 41 | 42 | #endif // ROSTERWINDOW_H 43 | -------------------------------------------------------------------------------- /application/windows/TemplateWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _TEMPLATE_WINDOW_H 7 | #define _TEMPLATE_WINDOW_H 8 | 9 | #include 10 | #include 11 | 12 | #include "ProtocolTemplate.h" 13 | 14 | class BAlert; 15 | class BMenu; 16 | class BMenuField; 17 | class BTextControl; 18 | class ProtocolSettings; 19 | class TemplateView; 20 | 21 | 22 | class TemplateWindow : public BWindow { 23 | public: 24 | /*! Get template from selected account's protocol 25 | * via ChatProtocol::SettingsTemplate() */ 26 | TemplateWindow(const char* title, 27 | const char* templateType, BMessage* msg, 28 | bigtime_t instance = -1); 29 | 30 | /*! Use only the given template. */ 31 | TemplateWindow(const char* title, 32 | ProtocolTemplate* temp, BMessage* msg, 33 | bigtime_t instance = -1); 34 | 35 | virtual void MessageReceived(BMessage* msg); 36 | 37 | void SetTarget(BHandler* target); 38 | 39 | private: 40 | void _InitInterface(bigtime_t instance); 41 | void _LoadTemplate(); 42 | 43 | int64 fSelectedAcc; 44 | BMenuField* fMenuField; 45 | 46 | ProtocolTemplate* fTemplate; 47 | BString fTemplateType; 48 | TemplateView* fTemplateView; 49 | 50 | BButton* fOkButton; 51 | 52 | BMessage* fMessage; 53 | BHandler* fTarget; 54 | }; 55 | 56 | #endif // _TEMPLATE_WINDOW_H 57 | -------------------------------------------------------------------------------- /application/windows/UserInfoWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Casalinuovo Dario. All rights reserved. 3 | * Copyright 2021, Jaidyn Levesque. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | * 6 | * Authors: 7 | * Casalinuovo Dario 8 | * Jaidyn Levesque 9 | */ 10 | #ifndef _USER_INFO_WINDOW_H 11 | #define _USER_INFO_WINDOW_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "Observer.h" 18 | #include "UserStatus.h" 19 | 20 | class BitmapView; 21 | class User; 22 | 23 | 24 | class UserInfoWindow: public BWindow, public Observer { 25 | public: 26 | UserInfoWindow(User* user); 27 | ~UserInfoWindow(); 28 | 29 | virtual void MessageReceived(BMessage* message); 30 | 31 | virtual void ObserveString(int32 what, BString string); 32 | virtual void ObserveInteger(int32 what, int32 num); 33 | virtual void ObservePointer(int32 what, void* ptr); 34 | 35 | private: 36 | void _InitInterface(); 37 | 38 | void _UpdateStatusViews(UserStatus status); 39 | 40 | User* fUser; 41 | 42 | BitmapView* fAvatar; 43 | BStringView* fNameLabel; 44 | BTextView* fIdLabel; 45 | BitmapView* fStatusIcon; 46 | BStringView* fStatusLabel; 47 | BStringView* fTextStatusLabel; 48 | }; 49 | 50 | #endif // _USER_INFO_WINDOW_H 51 | -------------------------------------------------------------------------------- /data/icons/AppIcon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/AppIcon -------------------------------------------------------------------------------- /data/icons/AppIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/AppIcon.png -------------------------------------------------------------------------------- /data/icons/AppIcon.rdef: -------------------------------------------------------------------------------- 1 | 2 | resource vector_icon array { 3 | $"6E636966040500020106033D835C3C19B2BA8B0B3C20794769624A510E00FFFF" 4 | $"FFB4FFE405FFFFA405020106023D835C3C19B2BA8B0B3C20794769624A510E00" 5 | $"FFE405FFFFA405020106033D429E3C5148BB5ADA3C5C1B4A23AA46EC1800FFFF" 6 | $"FFB47FE583FF04B10C0902093F404644383C273F2E3A244122482245224D2755" 7 | $"245126572256245725582A5828592C5A315C2F5B345D3C5E385E425E4957475C" 8 | $"4D4E02043F4044433D3FBC95BE953B3D333D3D493844424E4A5148534A4A0403" 9 | $"3B2F4E2F4E2D4E2A4D2F532D522F530003334F334F364F345337533755325636" 10 | $"59325602085645C8FEC3AFCA30C0E55E3A5E405EBA4D52B58359B71B4AB38537" 11 | $"B51D3EB31FBA16B69933353130363E4A4641444D475346C657C27B554BCB01C6" 12 | $"35584F5A4F080239BA0539BA6B0802BD1CBC1DBD2FBCA908023E37423904032E" 13 | $"4535473C4739473F4540070A000100123FFFFE2FDACEAFDACE3FFFFE3AB6A5B8" 14 | $"4CC101178400040A010100000A020101000A000202031001178210040A000104" 15 | $"1001178400040A030104000A000407050608100117821004" 16 | }; 17 | -------------------------------------------------------------------------------- /data/icons/misc/Asterisk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/misc/Asterisk -------------------------------------------------------------------------------- /data/icons/misc/Asterisk.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kAsteriskIcon) #'VICN' array { 4 | $"6E636966030400660501020006020000003C6000C000000000004C000048A000" 5 | $"0000AAFF5700FFAA010A0FB7FEB620B923B5D0B939B659B81FB670B8D5B75CB8" 6 | $"52B7A2B7CFB69CB75AB7A2B6D2B75CB785B670B66EB659B684B5D0B7A6B620B7" 7 | $"86B501B81CB501030A0001001245D9190000000000004607C0CBB8BFCA27CC01" 8 | $"178010040A0101001245D9190000000000004607C0CBE8BFCA57CC0117801004" 9 | $"0A0201000245D9190000000000004607C0CBE8BFCA57CC" 10 | }; 11 | -------------------------------------------------------------------------------- /data/icons/misc/People-1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/misc/People-1 -------------------------------------------------------------------------------- /data/icons/misc/People-1.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kOnePersonIcon) #'VICN' array { 4 | $"6E636966120500020006023CADF43D104EBF02CA3EA2224BB02046648D00FFDB" 5 | $"97FFFCAF29020006023CADF43D104EBF02CA3EA2224BB02046648D00D5DCFFFF" 6 | $"9D9BD5020006023B804A3C0065BF02CA3EA2224BE70846C45D00EE9BB0FFCC58" 7 | $"76020006023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFF7EAFEFDD17B02" 8 | $"0006023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFFFFFFEA4A3D7020006" 9 | $"023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFE3EAFEF0A8BB020006023A" 10 | $"B3673751B2BC59783FD2D74AF3F147385900C85805FFF06306020006023AB367" 11 | $"3751B2BC59783FD2D74B03F147385900373583FF6967C0020006023AB3673751" 12 | $"B2BC59783FD2D74B13F147785900A02646FFD53961020106033ABB7400000000" 13 | $"00003AB5E049D1B1471E5B00F2F2F2AB7D7A7AFFBCA18404016C03A329040325" 14 | $"23820371152D02000602388A280000000000004000004A3000C2000000C85804" 15 | $"FFDC952F02000602388A280000000000004000004A4000C200000033318CFFA4" 16 | $"A3D702000602388A280000000000004000004A4000C3000000AB123AFFDD718D" 17 | $"0A0A0D36353646384838593C5B3E5B3E5C425E4858484A4A484A373D310A0B36" 18 | $"353645384838593C5B3E5B3E5C425E424D444D443B0A063635443B4A374036C1" 19 | $"57BAF73D310A08444D424D425E4858484A4A484A37443B0204402843283D283A" 20 | $"2E3A2B3A3140343D344334462E4631462B02043F2AC0592ABE5B2A3A2F3AB7FB" 21 | $"3AB9F93F34BE5B34C05934442F44B9F944B7FB0607FE1B3A5F445F3F5F495FC7" 22 | $"38CAF4C569CAE4CB5ACB1BCA0FC8AACC99C976C888C82F4E5552574C54425458" 23 | $"0A04424D4253484A444D0A0340364A3744340A043C5B3E5B3E4D3C4C0A0A0B01" 24 | $"06023FDBA60000000000003FC3C34069E943C3C30A0001001001178400040A02" 25 | $"0101000A050102000A080103000A0D0107000A100108000A0001041001178400" 26 | $"040A0A0104000A0801090815FF" 27 | }; 28 | -------------------------------------------------------------------------------- /data/icons/misc/People-2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/misc/People-2 -------------------------------------------------------------------------------- /data/icons/misc/People-2.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kTwoPeopleIcon) #'VICN' array { 4 | $"6E6369660D0500020006023CADF43D104EBF02CA3EA2224BB02046648D00FFDB" 5 | $"97FFFCAF29020006023CADF43D104EBF02CA3EA2224BB02046648D00D5DCFFFF" 6 | $"9D9BD5020006023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFF7EAFEFDD1" 7 | $"7B020006023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFFFFFFEA4A3D702" 8 | $"0006023AB3673751B2BC59783FD2D74AF3F147385900C85805FFF06306020006" 9 | $"023AB3673751B2BC59783FD2D74B03F147385900373583FF6967C0020106033A" 10 | $"BB740000000000003AB5E049D1B1471E5B00F2F2F2AB7D7A7AFFBCA18404016C" 11 | $"03A329040325238202000602388A280000000000004000004A3000C2000000C8" 12 | $"5804FFDC952F02000602388A280000000000004000004A4000C200000033318C" 13 | $"FFA4A3D70A0A0D36353646384838593C5B3E5B3E5C425E4858484A4A484A373D" 14 | $"310A0B36353645384838593C5B3E5B3E5C425E424D444D443B0A063635443B4A" 15 | $"374036C157BAF73D310A08444D424D425E4858484A4A484A37443B0204402843" 16 | $"283D283A2E3A2B3A3140343D344334462E4631462B02043F2AC0592ABE5B2A3A" 17 | $"2F3AB7FB3AB9F93F34BE5B34C05934442F44B9F944B7FB0607FE2B42604D6048" 18 | $"605260585E535FCC70CB135C585F5AC98AC8665D53CBEDC8915C51544F3C4E0A" 19 | $"04424D4253484A444D0A0340364A3744340A043C5B3E5B3E4D3C4C130A080106" 20 | $"000A00010030101A01178400040A01010120101A0A03010220101A0A05010320" 21 | $"101A0A09010720101A0A0B010820101A0A00010530101A01178400040A070105" 22 | $"20101A0A05010928101A15FF0A0001001001178400040A020101000A04010200" 23 | $"0A060103000A0A0107000A0C0108000A0001041001178400040A070104000A06" 24 | $"01090815FF" 25 | }; 26 | -------------------------------------------------------------------------------- /data/icons/misc/People-3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/misc/People-3 -------------------------------------------------------------------------------- /data/icons/misc/People-3.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kThreePeopleIcon) #'VICN' array { 4 | $"6E636966120500020006023CADF43D104EBF02CA3EA2224BB02046648D00FFDB" 5 | $"97FFFCAF29020006023CADF43D104EBF02CA3EA2224BB02046648D00D5DCFFFF" 6 | $"9D9BD5020006023B804A3C0065BF02CA3EA2224BE70846C45D00EE9BB0FFCC58" 7 | $"76020006023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFF7EAFEFDD17B02" 8 | $"0006023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFFFFFFEA4A3D7020006" 9 | $"023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFE3EAFEF0A8BB020006023A" 10 | $"B3673751B2BC59783FD2D74AF3F147385900C85805FFF06306020006023AB367" 11 | $"3751B2BC59783FD2D74B03F147385900373583FF6967C0020006023AB3673751" 12 | $"B2BC59783FD2D74B13F147785900A02646FFD53961020106033ABB7400000000" 13 | $"00003AB5E049D1B1471E5B00F2F2F2AB7D7A7AFFBCA18404016C03A329040325" 14 | $"23820371152D02000602388A280000000000004000004A3000C2000000C85804" 15 | $"FFDC952F02000602388A280000000000004000004A4000C200000033318CFFA4" 16 | $"A3D702000602388A280000000000004000004A4000C3000000AB123AFFDD718D" 17 | $"0A0A0D36353646384838593C5B3E5B3E5C425E4858484A4A484A373D310A0B36" 18 | $"353645384838593C5B3E5B3E5C425E424D444D443B0A063635443B4A374036C1" 19 | $"57BAF73D310A08444D424D425E4858484A4A484A37443B0204402843283D283A" 20 | $"2E3A2B3A3140343D344334462E4631462B02043F2AC0592ABE5B2A3A2F3AB7FB" 21 | $"3AB9F93F34BE5B34C05934442F44B9F944B7FB0607FE2B42604D604860526058" 22 | $"5E535FCC70CB135C585F5AC98AC8665D53CBEDC8915C51544F4A580A04424D42" 23 | $"53484A444D0A0340364A3744340A043C5B3E5B3E4D3C4C1B0A0B0106000A0001" 24 | $"00302A1A01178400040A030101202A1A0A060102202A1A0A090103202A1A0A0E" 25 | $"0107202A1A0A110108202A1A0A000105302C1A01178400040A0A0105202C1A0A" 26 | $"00010030101A01178400040A01010120101A0A04010220101A0A07010320101A" 27 | $"0A0C010720101A0A0F010820101A0A00010530101A01178400040A0A01052010" 28 | $"1A0A07010928101A15FF0A0001001001178400040A020101000A050102000A08" 29 | $"0103000A0D0107000A100108000A0001041001178400040A0A0104000A080109" 30 | $"0815FF" 31 | }; 32 | -------------------------------------------------------------------------------- /data/icons/misc/People-4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/misc/People-4 -------------------------------------------------------------------------------- /data/icons/misc/People-4+: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/misc/People-4+ -------------------------------------------------------------------------------- /data/icons/misc/People-4+.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kMorePeopleIcon) #'VICN' array { 4 | $"6E636966150500020006023CADF43D104EBF02CA3EA2224BB02046648D00FFDB" 5 | $"97FFFCAF29020006023CADF43D104EBF02CA3EA2224BB02046648D00D5DCFFFF" 6 | $"9D9BD5020006023B804A3C0065BF02CA3EA2224BE70846C45D00EE9BB0FFCC58" 7 | $"76020006023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFF7EAFEFDD17B02" 8 | $"0006023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFFFFFFEA4A3D7020006" 9 | $"023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFE3EAFEF0A8BB020006023A" 10 | $"B3673751B2BC59783FD2D74AF3F147385900C85805FFF06306020006023AB367" 11 | $"3751B2BC59783FD2D74B03F147385900373583FF6967C0020006023AB3673751" 12 | $"B2BC59783FD2D74B13F147785900A02646FFD53961020106033ABB7400000000" 13 | $"00003AB5E049D1B1471E5B00F2F2F2AB7D7A7AFFBCA18404016C03A329040325" 14 | $"23820371152D02000602388A280000000000004000004A3000C2000000C85804" 15 | $"FFDC952F02000602388A280000000000004000004A4000C200000033318CFFA4" 16 | $"A3D702000602388A280000000000004000004A4000C3000000AB123AFFDD718D" 17 | $"0400660501020006020000003C6000C000000000004C000048A0000000AAFFFC" 18 | $"00FFAA0B0A0D36353646384838593C5B3E5B3E5C425E4858484A4A484A373D31" 19 | $"0A0B36353645384838593C5B3E5B3E5C425E424D444D443B0A063635443B4A37" 20 | $"4036C157BAF73D310A08444D424D425E4858484A4A484A37443B020440284328" 21 | $"3D283A2E3A2B3A3140343D344334462E4631462B02043F2AC0592ABE5B2A3A2F" 22 | $"3AB7FB3AB9F93F34BE5B34C05934442F44B9F944B7FB0607FE2B42604D604860" 23 | $"5260585E535FCC70CB135C585F5AC98AC8665D53CBEDC8915C51544F4A580A04" 24 | $"424D4253484A444D0A0340364A3744340A043C5B3E5B3E4D3C4C0A0C3A223022" 25 | $"30302230223A303A30483A483A3A483A48303A30220A0B0106000A0501022019" 26 | $"170A1101082019170A000105301B1701178400040A0A0105201B170A00010030" 27 | $"2A1A01178400040A030101202A1A0A060102202A1A0A090103202A1A0A0E0107" 28 | $"202A1A0A110108202A1A0A000105302C1A01178400040A0A0105202C1A0A0001" 29 | $"0030101A01178400040A01010120101A0A04010220101A0A07010320101A0A0C" 30 | $"010720101A0A0F010820101A0A00010530101A01178400040A0A010520101A0A" 31 | $"07010928101A15FF0A0001001001178400040A020101000A050102000A080103" 32 | $"000A0D0107000A100108000A0001041001178400040A0A0104000A0801090815" 33 | $"FF0A12010A123E00000000000000003DD1744A70004A8F4501178322040A1301" 34 | $"0A123E00000000000000003DD1744A60004A800001178322040A14010A023E00" 35 | $"000000000000003DD1744A60004A8000" 36 | }; 37 | -------------------------------------------------------------------------------- /data/icons/misc/People-4.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kFourPeopleIcon) #'VICN' array { 4 | $"6E636966120500020006023CADF43D104EBF02CA3EA2224BB02046648D00FFDB" 5 | $"97FFFCAF29020006023CADF43D104EBF02CA3EA2224BB02046648D00D5DCFFFF" 6 | $"9D9BD5020006023B804A3C0065BF02CA3EA2224BE70846C45D00EE9BB0FFCC58" 7 | $"76020006023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFF7EAFEFDD17B02" 8 | $"0006023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFFFFFFEA4A3D7020006" 9 | $"023A6496BA3F153EBCDD3EEA9147D96A4458AB00FFE3EAFEF0A8BB020006023A" 10 | $"B3673751B2BC59783FD2D74AF3F147385900C85805FFF06306020006023AB367" 11 | $"3751B2BC59783FD2D74B03F147385900373583FF6967C0020006023AB3673751" 12 | $"B2BC59783FD2D74B13F147785900A02646FFD53961020106033ABB7400000000" 13 | $"00003AB5E049D1B1471E5B00F2F2F2AB7D7A7AFFBCA18404016C03A329040325" 14 | $"23820371152D02000602388A280000000000004000004A3000C2000000C85804" 15 | $"FFDC952F02000602388A280000000000004000004A4000C200000033318CFFA4" 16 | $"A3D702000602388A280000000000004000004A4000C3000000AB123AFFDD718D" 17 | $"0A0A0D36353646384838593C5B3E5B3E5C425E4858484A4A484A373D310A0B36" 18 | $"353645384838593C5B3E5B3E5C425E424D444D443B0A063635443B4A374036C1" 19 | $"57BAF73D310A08444D424D425E4858484A4A484A37443B0204402843283D283A" 20 | $"2E3A2B3A3140343D344334462E4631462B02043F2AC0592ABE5B2A3A2F3AB7FB" 21 | $"3AB9F93F34BE5B34C05934442F44B9F944B7FB0607FE2B42604D604860526058" 22 | $"5E535FCC70CB135C585F5AC98AC8665D53CBEDC8915C51544F4A580A04424D42" 23 | $"53484A444D0A0340364A3744340A043C5B3E5B3E4D3C4C1F0A0B0106000A0501" 24 | $"022019170A1101082019170A000105301B1701178400040A0A0105201B170A00" 25 | $"0100302A1A01178400040A030101202A1A0A060102202A1A0A090103202A1A0A" 26 | $"0E0107202A1A0A110108202A1A0A000105302C1A01178400040A0A0105202C1A" 27 | $"0A00010030101A01178400040A01010120101A0A04010220101A0A0701032010" 28 | $"1A0A0C010720101A0A0F010820101A0A00010530101A01178400040A0A010520" 29 | $"101A0A07010928101A15FF0A0001001001178400040A020101000A050102000A" 30 | $"080103000A0D0107000A100108000A0001041001178400040A0A0104000A0801" 31 | $"090815FF" 32 | }; 33 | -------------------------------------------------------------------------------- /data/icons/misc/Person: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/misc/Person -------------------------------------------------------------------------------- /data/icons/misc/Person.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kPersonIcon) #'VICN' array { 4 | $"6E636966080500020006023CADF43D104EBF02CA3EA2224AF02046648D00FFDB" 5 | $"97FFFCAF29020006023A6496BA3F153EBCDD3EEA9146596AC09D5100FFF7EAFE" 6 | $"FDD17B020006023AB3673751B2BC59783FD2D74AE3F146F85900C85805FFF063" 7 | $"06020106033AC71C0000000000003AB6DB48D40045300000F2F2F2FFBCA184AB" 8 | $"7D7A7A04016903A3290402000602388A2800000000000040000049E000000000" 9 | $"00C85804FFDC952F090A0D2E302E4330453059345B365B365C3A5E4058404742" 10 | $"454232352C0A0B2E302E4230453059345B365B365C3A5E3A4A3C4A3C360A062E" 11 | $"303C3642323630BD5BB893352C0A083C4A3A4A3A5E40584047424542323C3602" 12 | $"0438223B22352232283225322B382E352E3B2E3E283E2B3E250607FE1B3A5F44" 13 | $"5F3F5F495FC738CAF4C569CAE4CB5ACB1BCA0FC8AACC99C976C888C82F4E5552" 14 | $"574C544254580A043A4A3A5040473C4A0A03363042323A2E0A04345B365B364A" 15 | $"34490A0A050105000A0001001001178400040A010101000A020102000A030103" 16 | $"000A060106000A070107000A0001041001178400040A040104000A0301080815" 17 | $"FF" 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /data/icons/misc/Search: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/misc/Search -------------------------------------------------------------------------------- /data/icons/misc/Search.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kSearchIcon) #'VICN' array { 4 | $"6E6369660805010200060338D2F73CD163BF82B23B84A94B88504870C900FFEF" 5 | $"A5BDFFFCC0FFFFF890020106023E49240000000000003CAAAA4940004A30007C" 6 | $"F1B706FFFFFCC0040192020016023A55A6BAC2293F0DA33E958646C2EB47A1D6" 7 | $"0001FF9E020106023C00000000000000003C00004A30004A500000DCF4FFFF60" 8 | $"94AA02001603360FF5B7B2B23AD6A4392A794ABC0B4AF0350050C285FF5505FF" 9 | $"0B0606AE0BB40BBF4D33C3AEB75CC172BDEFC606C13EC804CA27BD82C117B920" 10 | $"C51BBB40BF06B8073AB6BC0605AE02B57D3EB9B9C3EFB7BB44BBB751BD75C936" 11 | $"CA8DC1B0402F0A093B593D5BBFCDC93D455BC516C5F060465B435D4544510A04" 12 | $"5A425E3F5A3D574008022D40BE1B3108023042BF00BAD108023344BFB3BC1D08" 13 | $"023646C072BD750802264329440204423AC2BE3ABE583A384438BF2438C38A42" 14 | $"4EBE584EC2BE4E4C444CC38A4CBF240606BA0A4C51565B585AC91CCA4EC983C9" 15 | $"E959584F4E4B4D050A00010A12414992000000000000414992CA3294CA674701" 16 | $"178400040A06010A02414992000000000000414992CA3294CA67470A00010912" 17 | $"414992000000000000414992CA3294CA674701178400040A0501090241499200" 18 | $"0000000000414992CA3294CA67470A070109023D49920000000000003D49923A" 19 | $"DA753AC02E" 20 | }; 21 | -------------------------------------------------------------------------------- /data/icons/misc/Tool: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/misc/Tool -------------------------------------------------------------------------------- /data/icons/misc/Tool.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kToolIcon) #'VICN' array { 4 | $"6E63696602030100000200160239F20638AB65BE3DD63F501B4A4E27488B2600" 5 | $"EBFFAD01060EA6996D062C4248304A34484238464C344F5C305E345E2C5E2C5C" 6 | $"4F284C46030A0001001A41745D00000000000041745D442E8BCB345F15FF0117" 7 | $"8402040A0001001A41745D00000000000041745D442E8BCB345F001501178602" 8 | $"040A0101000241745D00000000000041745D442E8BCB345F" 9 | }; 10 | -------------------------------------------------------------------------------- /data/icons/protocols/IRC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/protocols/IRC -------------------------------------------------------------------------------- /data/icons/protocols/IRC.rdef: -------------------------------------------------------------------------------- 1 | 2 | resource vector_icon { 3 | $"6E636966040500020106033D835C3C19B2BA8B0B3C20794769624A510E00FFFF" 4 | $"FFB4FFE405FFFFA405020106023D835C3C19B2BA8B0B3C20794769624A510E00" 5 | $"FFE405FFFFA405020106033D429E3C5148BB5ADA3C5C1B4A23AA46EC1800FFFF" 6 | $"FFB47FE583FF04B10C0902093F404644383C273F2E3A244122482245224D2755" 7 | $"245126572256245725582A5828592C5A315C2F5B345D3C5E385E425E4957475C" 8 | $"4D4E02043F4044433D3FBC95BE953B3D333D3D493844424E4A5148534A4A0403" 9 | $"3B2F4E2F4E2D4E2A4D2F532D522F530003334F334F364F345337533755325636" 10 | $"59325602085645C8FEC3AFCA30C0E55E3A5E405EBA4D52B58359B71B4AB38537" 11 | $"B51D3EB31FBA16B69933353130363E4A4641444D475346C657C27B554BCB01C6" 12 | $"35584F5A4F080239BA0539BA6B0802BD1CBC1DBD2FBCA908023E37423904032E" 13 | $"4535473C4739473F4540070A000100123FFFFE2FDACEAFDACE3FFFFE3AB6A5B8" 14 | $"4CC101178400040A010100000A020101000A000202031001178210040A000104" 15 | $"1001178400040A030104000A000407050608100117821004" 16 | }; 17 | -------------------------------------------------------------------------------- /data/icons/protocols/Jabber: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/protocols/Jabber -------------------------------------------------------------------------------- /data/icons/protocols/Jabber.rdef: -------------------------------------------------------------------------------- 1 | 2 | resource vector_icon { 3 | $"6E63696604020006023D8E720000000000003D8E7249E39E4BD9AA00FFFFFFFF" 4 | $"FBEE01050005FF02000606363A4ABA2B773A2B77363A4A4B0C4F48628900FBFD" 5 | $"BA0CFBFDC147FDFEDC83FEFFEFC0FFFFFBFFFFFFFF120204C93ABFEBCD6DBA93" 6 | $"BF9CCC27BF56CC51C75ACC5BB7A9CC46B589BFBABF9ECDEFB19CBA31BF48B40F" 7 | $"B5BCB40FC86EB40F04032EBA80CE61BF05CF67BC8CCF51C17ECF7DC3E2CEB804" 8 | $"032EBACCD10EBEF36EBCADD1FFC139D22AC36AD16504032EBD92CC52BC8CC3A7" 9 | $"BE82C6D5BA96C07ABA75C04504032EC039CC3FC13FC394BF49C6C1C335C06649" 10 | $"C0310204BCD3BFA8BC7ABFA8BD2CBFA8BD71C047BD71BFEEBD71C09FBCD3C0E5" 11 | $"BD2CC0E5BC7AC0E5BC35C047BC35C09FBC35BFEE0204BD8CBFA8BD34BFA8BDE5" 12 | $"BFA8BE2BC047BE2BBFEEBE2BC09FBD8CC0E5BDE5C0E5BD34C0E5BCEEC047BCEE" 13 | $"C09FBCEEBFEE0204BE46BFA8BDEDBFA8BE9FBFA8BEE4C047BEE4BFEEBEE4C09F" 14 | $"BE46C0E5BE9FC0E5BDEDC0E5BDA8C047BDA8C09FBDA8BFEE0204BEEABFA8BE91" 15 | $"BFA8BF42BFA8BF88C047BF88BFEEBF88C09FBEEAC0E5BF42C0E5BE91C0E5BE4B" 16 | $"C047BE4BC09FBE4BBFEE0204BF98BFA8BF40BFA8BFF1BFA8C037C047C037BFEE" 17 | $"C037C09FBF98C0E5BFF1C0E5BF40C0E5BEFAC047BEFAC09FBEFABFEE0204C010" 18 | $"BFA8BFB8BFA8C069BFA8C0AFC047C0AFBFEEC0AFC09FC010C0E5C069C0E5BFB8" 19 | $"C0E5BF72C047BF72C09FBF72BFEE0204C10CBFA8C0B3BFA8C164BFA8C1AAC047" 20 | $"C1AABFEEC1AAC09FC10CC0E5C164C0E5C0B3C0E5C06DC047C06DC09FC06DBFEE" 21 | $"0204C19ABFA8C141BFA8C1F2BFA8C238C047C238BFEEC238C09FC19AC0E5C1F2" 22 | $"C0E5C141C0E5C0FBC047C0FBC09FC0FBBFEE04032EBC3FBFE7BB65C047BBC8C0" 23 | $"3CBB03C051BAA1C03104032EC243C007C28FC027C202C007C31DC047C375C047" 24 | $"04032EC243C007C28FC027C202C007C31DC047C375C0470204C86DBC5FC94CBA" 25 | $"AFC78EBE0FC165BCC5C469BE3DBE62BB4DBD85B70EBCA6B8BEBE64B55DC48DB6" 26 | $"A8C18AB52FC790B8200204BF34D2E8BE2CD2E8C03CD2E8C10CD3DCC10CD353C1" 27 | $"0CD464BF34D4CFC03CD4CFBE2CD4CF3AD3DC3AD4643AD353130A000100023EEC" 28 | $"A00000000000003EECA04640053FFFFB0A010100123EECA00000000000003EEC" 29 | $"A04640053FFFFB01178300040A010101123EECA00000000000003EECA0464005" 30 | $"3FFFFB01178222040A010102123EECA00000000000003EECA04640053FFFFB01" 31 | $"178222040A010103123EECA00000000000003EECA04640053FFFFB0117812204" 32 | $"0A010104123EECA00000000000003EECA04640053FFFFB01178122040A010105" 33 | $"123EECA00000000000003EECA04640053FFFFB01178022040A010106123EECA0" 34 | $"0000000000003EECA04640053FFFFB01178022040A010107123EECA000000000" 35 | $"00003EECA04640053FFFFB01178022040A010108123EECA00000000000003EEC" 36 | $"A04640053FFFFB01178022040A010109123EECA00000000000003EECA0464005" 37 | $"3FFFFB01178022040A01010A123EECA00000000000003EECA04640053FFFFB01" 38 | $"178022040A01010B123EECA00000000000003EECA04640053FFFFB0117802204" 39 | $"0A01010C123EECA00000000000003EECA04640053FFFFB01178022040A01010D" 40 | $"123EECA00000000000003EECA04640053FFFFB01178022040A02010E023EECA0" 41 | $"0000000000003EECA04640053FFFFB0A01010F123EECA00000000000003EECA0" 42 | $"4640053FFFFB01178000040A030110023EECA00000000000003EECA04640053F" 43 | $"FFFB0A010111023EECA00000000000003EECA04640053FFFFB" 44 | }; 45 | -------------------------------------------------------------------------------- /data/icons/protocols/Matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/protocols/Matrix.png -------------------------------------------------------------------------------- /data/icons/protocols/Matrix.rdef: -------------------------------------------------------------------------------- 1 | 2 | resource vector_icon { 3 | $"6E63696601050003020E2040204020C400206020C840216023602260B54C6026" 4 | $"CC3C26CC7926CC05B491CBF1B548CBFBB449CBEDB3BBCBE7B402CBEAB3BBC7DA" 5 | $"B3BB40B3BBC3CDB3BBBBB3B3BBB399B3BBB7A6B402B395B491B38EB449B392B5" 6 | $"48B38426B34426B37A26B3062320B54C2022202020212020B740204020BB8020" 7 | $"40204020402040020E5AB3445AB3445AB37ACAF2B38ECA37B384CB38B392CBC5" 8 | $"B399CB7EB395CBC5B7A6CBC540CBC5BBB3CBC5C3CDCBC5CBE7CBC5C7DACB7ECB" 9 | $"EACAF2CBF1CB38CBEDCA37CBFB5ACC3C5ACC055ACC795D60CA33605E6060605F" 10 | $"6060C840604060C40060BB80602060B7405F205D205E20CA33205AB3445AB306" 11 | $"5AB3445AB3445AB3445AB3440222BC52BB80BC52BB80BBF3BBB9BB7937BB8DBC" 12 | $"04BB35BC93BB1ABBD5BB1ABC7BBB1ABBA2BB1ABB3CBB1ABB6FBAB9BB3CB9F9BB" 13 | $"3CBA59BB3CB998BB3CB8D8BB3CB938BB3CB8D8BCC3B8D8BFD1B8D8BE4AB8D844" 14 | $"B8D8C466B8D8C2DFB943C466BA1BC466B9AFC466BA86C46635C466BAF2C46635" 15 | $"C35D35C14D35C25535BE7DBB9EBDD6BB64BE32BBFABD4EBD1BBD18BC60BD1BBE" 16 | $"68BD18BE8AC1A6BE8ABD7EBE8BC2913DC469BE8CC37DBEF7C466BFCAC45FBF60" 17 | $"C462C032C45BC103C455C09AC458C108C34AC114C136C10EC240C11EBF0FC151" 18 | $"BDCCC132BDFFC198BD4EC2BDBD18C205BD18C34BBD184ABD69C37BBD29C42CBD" 19 | $"E4C444C1A6C4403DC444C291C444C469C444C37DC4ADC466C580C45FC516C462" 20 | $"C5E8C45BC6B9C455C650C458C6BCC361C6C3C17AC6BFC26DC6CDBE09C62ABC3E" 21 | $"C6AEBCFCC59EBB7CC3A7BB20C4F1BB2EC26EBB13C114BC0BC1D9BB49C0EFBC2F" 22 | $"C0A7BC78C0CBBC53C089BC52C04EBC08C06CBC2DBFD1BB68BDF5BB1ABF12BB1A" 23 | $"BD29BB1ABC52BB80BCEBBB2BBC52BB80BC52BB80BC52BB80BC52BB80030A0001" 24 | $"00000A000101000A00010200" 25 | }; 26 | -------------------------------------------------------------------------------- /data/icons/replicant/Away: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/replicant/Away -------------------------------------------------------------------------------- /data/icons/replicant/Away.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kAwayReplicant) #'VICN' array { 4 | $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900FFEC" 5 | $"4BFFF0A506020006023B3049396B0ABA90833C646E4A101543299500FFFFFFFF" 6 | $"FFF289020006023A1DA6393F04BBB5BC3C6B074AEA3648091100F99B05FFFCB2" 7 | $"3D03F8B24203D2820504017402000402B7E79C25FFFFF289100A08325E385E40" 8 | $"564E5E545E6050584C3E510A062E2C2E3E3E454A3C4A2A3A250A042E2C2E3E3E" 9 | $"453E320A042E2C3E324A2A3A250A043E323E454A3C4A2A0A0338423C4D3C440A" 10 | $"0622422254325C3E513E402E3A0A0422422254325C32490A04224232493E402E" 11 | $"3A0A043249325C3E513E400A063E423E544E5C5A505A3F4A390A04C222C2104E" 12 | $"495A3F523C0A043E42C222C210523C4A390A054151C08BC8834E5C4E49C22BC2" 13 | $"140A053E423E54C08BC8834151C22BC2140A044E494E5C5A505A3F110A060100" 14 | $"000A0001061815FF01178400040A00010618001501178600040A010107000A03" 15 | $"0109000A0501052020210A020108000A00010A1001178400040A01010D000A04" 16 | $"010E000A0302040F000A02010B000A07010C000A0001011001178400040A0101" 17 | $"02000A020103000A03010400" 18 | }; 19 | -------------------------------------------------------------------------------- /data/icons/replicant/Busy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/replicant/Busy -------------------------------------------------------------------------------- /data/icons/replicant/Busy.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kBusyReplicant) #'VICN' array { 4 | $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900EC66" 5 | $"66FFEC6666020006023B3049396B0ABA90833C646E4A101543299500FFFFFFFF" 6 | $"F38383020006023A1DA6393F04BBB5BC3C6B074AEA3648091100EC6666B7FF90" 7 | $"AF03C1494903E35555040174020004028ABD0E0EFFE98484100A08325E385E40" 8 | $"564E5E545E6050584C3E510A062E2C2E3E3E454A3C4A2A3A250A042E2C2E3E3E" 9 | $"453E320A042E2C3E324A2A3A250A043E323E454A3C4A2A0A0338423C4D3C440A" 10 | $"0622422254325C3E513E402E3A0A0422422254325C32490A04224232493E402E" 11 | $"3A0A043249325C3E513E400A063E423E544E5C5A505A3F4A390A04C222C2104E" 12 | $"495A3F523C0A043E42C222C210523C4A390A054151C08BC8834E5C4E49C22BC2" 13 | $"140A053E423E54C08BC8834151C22BC2140A044E494E5C5A505A3F110A060100" 14 | $"000A0001061815FF01178400040A00010618001501178600040A010107000A03" 15 | $"0109000A0501052020210A020108000A00010A1001178400040A01010D000A04" 16 | $"010E000A0302040F000A02010B000A07010C000A0001011001178400040A0101" 17 | $"02000A020103000A03010400" 18 | }; 19 | -------------------------------------------------------------------------------- /data/icons/replicant/ExitMenu: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/replicant/ExitMenu -------------------------------------------------------------------------------- /data/icons/replicant/ExitMenu.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kExitMenuReplicant) #'VICN' array { 4 | $"6E63696606040165020006023B17A83B6361BEF4563EB24E4B75B044DE8200F3" 5 | $"F3F3FFC7CCD1020106033E40000000000000003D000048000049800034FFFFFF" 6 | $"82D1D6DCFF8C9298020006023C800000000000000040000049800000000000FF" 7 | $"FFFFFF737A800501020006023A3AE43BE90DBF66193DE06C4B72A1462FBE00FF" 8 | $"ABABFFD90000040204BE2730C36F30B8E030B49642B496BC94B496C481BE2754" 9 | $"B8E054C36F54544254C48154BC940204BE2730C28C30B9C130B62F3FB62FBC0D" 10 | $"B62FC2A4BE274EB9C14EC28C4E503F50C2A450BC0D00043936393631372E412C" 11 | $"3C30463F47374947454A3B4C404A3B08023C3EC17136070A0002010002404000" 12 | $"0000000000003FC71CBDFFFF4471C70A0402010018001501178600040A040201" 13 | $"001815FF01178400040A02020100000A030101000A010101023FCCD000000000" 14 | $"00003FBBBB40CC7F4022220A05020203100117842004" 15 | }; 16 | 17 | -------------------------------------------------------------------------------- /data/icons/replicant/Icon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/replicant/Icon -------------------------------------------------------------------------------- /data/icons/replicant/Icon.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kIconReplicant) #'VICN' array { 4 | $"6E6369660E0500020006023C43C6B9E5E23A85A83CEE414268F44A445900C6D7" 5 | $"F5FF6B94DD03EC6666020006023B2B47BB18653D0FA53D225148297046CA1900" 6 | $"FFEC4BFFF0A506020006023B3049396B0ABA90833C646E4A101543299500FFFF" 7 | $"FFFFFFF289020006023C71E33A0C78BA15E43C7D2149055549455700E3EDFFFF" 8 | $"9EC2FF03FFACAC020006023A1DA6393F04BBB5BC3C6B074AEA3648091100F99B" 9 | $"05FFFCB23D03003CB0020006023C0AE63B3927BC611E3D03FF4C25624A1A9600" 10 | $"A3043CFFFF90AF03C93B3B030D296402000602BD498B3E1159BF219BBE7D2F4C" 11 | $"1B8F4A331300BD0F0FFFE98484040174100A08325E385E40564E5E545E605058" 12 | $"4C3E510A062E2C2E3E3E454A3C4A2A3A250A042E2C2E3E3E453E320A042E2C3E" 13 | $"324A2A3A250A043E323E454A3C4A2A0A0338423C4D3C440A0622422254325C3E" 14 | $"513E402E3A0A0422422254325C32490A04224232493E402E3A0A043249325C3E" 15 | $"513E400A063E423E544E5C5A505A3F4A390A04C222C2104E495A3F523C0A043E" 16 | $"42C222C210523C4A390A054151C08BC8834E5C4E49C22BC2140A053E423E54C0" 17 | $"8BC8834151C22BC2140A044E494E5C5A505A3F110A0D0100000A0001061815FF" 18 | $"01178400040A00010618001501178600040A010107000A080109000A0B010520" 19 | $"20210A050108000A00010A1001178400040A02010D000A0A010E000A0902040F" 20 | $"000A06010B000A0C010C000A0001011001178400040A030102000A040103000A" 21 | $"07010400" 22 | }; 23 | -------------------------------------------------------------------------------- /data/icons/replicant/MessageReceived: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/replicant/MessageReceived -------------------------------------------------------------------------------- /data/icons/replicant/MessageReceived.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kReplicantMessageReceived) #'VICN' array { 4 | $"6E636966050500020106033D835C3C19B2BA8B0B3C20794769624A510E00FFCE" 5 | $"CEB4FF0404FFC10505020106023D835C3C19B2BA8B0B3C20794769624A510E00" 6 | $"FF0404FFC10505020106033D429E3C5148BB5ADA3C5C1B4A23AA46EC1800AAE4" 7 | $"F3B40392B6FF03627A05FF0502093F404644383C273F2E3A244122482245224D" 8 | $"2755245126572256245725582A5828592C5A315C2F5B345D3C5E385E425E4957" 9 | $"475C4D4E02043F4044433D3FBC95BE953B3D333D3D493844424E4A5148534A4A" 10 | $"04032E264DB84FC80CB673C6C93258385902085645C8FEC3AFCA30C0E55E3A5E" 11 | $"405EBA4D5227592B4A2237263E21BA16B6DF33353130363E4A4641444D475346" 12 | $"C657C27B554BCB01C635584F5A4F04032E36353F3DBD0FBD2D44404C42090A00" 13 | $"01001001178400040A010100000A020101000A0401021001178210040A040102" 14 | $"123FFD6238491FB8085D3F8C5843A1A3BE897201178210040A00010310011784" 15 | $"00040A030103000A0401041001178210040A040104123FC0CBB65EEB3639DA3F" 16 | $"FF4C40FECDC3C0A80117821004" 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /data/icons/replicant/Offline: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/replicant/Offline -------------------------------------------------------------------------------- /data/icons/replicant/Offline.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kOfflineReplicant) #'VICN' array { 4 | $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA190062F3" 5 | $"C0FF6DC1A4020006023B3049396B0ABA90833C646E4A101543299500FFFFFFFF" 6 | $"62F3C0020006023A1DA6393F04BBB5BC3C6B074AEA36480911006DC1A4FF33D4" 7 | $"9D036DC1A40343927704017402000402C86DC1A4FF62F3C0100A08325E385E40" 8 | $"564E5E545E6050584C3E510A062E2C2E3E3E454A3C4A2A3A250A042E2C2E3E3E" 9 | $"453E320A042E2C3E324A2A3A250A043E323E454A3C4A2A0A0338423C4D3C440A" 10 | $"0622422254325C3E513E402E3A0A0422422254325C32490A04224232493E402E" 11 | $"3A0A043249325C3E513E400A063E423E544E5C5A505A3F4A390A04C222C2104E" 12 | $"495A3F523C0A043E42C222C210523C4A390A054151C08BC8834E5C4E49C22BC2" 13 | $"140A053E423E54C08BC8834151C22BC2140A044E494E5C5A505A3F110A060100" 14 | $"000A0001061815FF01178400040A00010618001501178600040A010107000A03" 15 | $"0109000A0501052020210A020108000A00010A1001178400040A01010D000A04" 16 | $"010E000A0302040F000A02010B000A07010C000A0001011001178400040A0101" 17 | $"02000A020103000A03010400" 18 | }; 19 | -------------------------------------------------------------------------------- /data/icons/replicant/Online: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/replicant/Online -------------------------------------------------------------------------------- /data/icons/replicant/Online.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kOnlineReplicant) #'VICN' array { 4 | $"6E636966080500020006023B2B47BB18653D0FA53D225148297046CA1900647F" 5 | $"00FFF3DAA4020006023B3049396B0ABA90833C646E4A101543299500FFFFFFFD" 6 | $"97A369020006023A1DA6393F04BBB5BC3C6B074AEA3648091100647F00FBC490" 7 | $"3F0321780D035B710604017402000402B85C6C1AFFD5CB73100A08325E385E40" 8 | $"564E5E545E6050584C3E510A062E2C2E3E3E454A3C4A2A3A250A042E2C2E3E3E" 9 | $"453E320A042E2C3E324A2A3A250A043E323E454A3C4A2A0A0338423C4D3C440A" 10 | $"0622422254325C3E513E402E3A0A0422422254325C32490A04224232493E402E" 11 | $"3A0A043249325C3E513E400A063E423E544E5C5A505A3F4A390A04C222C2104E" 12 | $"495A3F523C0A043E42C222C210523C4A390A054151C08BC8834E5C4E49C22BC2" 13 | $"140A053E423E54C08BC8834151C22BC2140A044E494E5C5A505A3F110A060100" 14 | $"000A0001061815FF01178400040A00010618001501178600040A010107000A03" 15 | $"0109000A0501052020210A020108000A00010A1001178400040A01010D000A04" 16 | $"010E000A0302040F000A02010B000A07010C000A0001011001178400040A0101" 17 | $"02000A020103000A03010400" 18 | }; 19 | -------------------------------------------------------------------------------- /data/icons/status/Away: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/status/Away -------------------------------------------------------------------------------- /data/icons/status/Away.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kAwayIcon) #'VICN' array { 4 | $"6E636966010201040400FFBA0055FFFFFFA9E8B732FFB891270102044030C345" 5 | $"30BC3A30304030BC3A30C3454050BC3A50C34550504050C34550BC3A010A0001" 6 | $"0002408000000000000000408000C60000C60000" 7 | }; 8 | -------------------------------------------------------------------------------- /data/icons/status/Busy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/status/Busy -------------------------------------------------------------------------------- /data/icons/status/Busy.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kBusyIcon) #'VICN' array { 4 | $"6E636966010201040400E9060655E1CECEA9C43A3AFF752F2F0102044030C345" 5 | $"30BC3A30304030BC3A30C3454050BC3A50C34550504050C34550BC3A010A0001" 6 | $"0002408000000000000000408000C60000C60000" 7 | }; 8 | -------------------------------------------------------------------------------- /data/icons/status/Offline: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/status/Offline -------------------------------------------------------------------------------- /data/icons/status/Offline.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kOfflineIcon) #'VICN' array { 4 | $"6E63696601020104040000337F558B9097A92D3541FF0F12160102044030C345" 5 | $"30BC3A30304030BC3A30C3454050BC3A50C34550504050C34550BC3A010A0001" 6 | $"0002408000000000000000408000C60000C60000" 7 | }; 8 | -------------------------------------------------------------------------------- /data/icons/status/Online: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/icons/status/Online -------------------------------------------------------------------------------- /data/icons/status/Online.rdef: -------------------------------------------------------------------------------- 1 | #include "application/AppResources.h" 2 | 3 | resource(kOnlineIcon) #'VICN' array { 4 | $"6E63696601020104040050B96455B9D6BEA917932FFF2766210102044030C345" 5 | $"30BC3A30304030BC3A30C3454050BC3A50C34550504050C34550BC3A010A0001" 6 | $"0002408000000000000000408000C60000C60000" 7 | }; 8 | -------------------------------------------------------------------------------- /data/screenshots/update-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/screenshots/update-1.png -------------------------------------------------------------------------------- /data/screenshots/update-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/screenshots/update-2.png -------------------------------------------------------------------------------- /data/screenshots/update-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/screenshots/update-3.png -------------------------------------------------------------------------------- /data/screenshots/update-final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/data/screenshots/update-final.png -------------------------------------------------------------------------------- /documentation/img/AppIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/AppIcon.png -------------------------------------------------------------------------------- /documentation/img/chat-header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/chat-header.png -------------------------------------------------------------------------------- /documentation/img/chat-input.og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/chat-input.og.png -------------------------------------------------------------------------------- /documentation/img/chat-input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/chat-input.png -------------------------------------------------------------------------------- /documentation/img/chat-list.og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/chat-list.og.png -------------------------------------------------------------------------------- /documentation/img/chat-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/chat-list.png -------------------------------------------------------------------------------- /documentation/img/menu-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/menu-bar.png -------------------------------------------------------------------------------- /documentation/img/pref-behavior.og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/pref-behavior.og.png -------------------------------------------------------------------------------- /documentation/img/pref-behavior.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/pref-behavior.png -------------------------------------------------------------------------------- /documentation/img/pref-notifications.og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/pref-notifications.og.png -------------------------------------------------------------------------------- /documentation/img/pref-notifications.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/pref-notifications.png -------------------------------------------------------------------------------- /documentation/img/room-creation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/room-creation.png -------------------------------------------------------------------------------- /documentation/img/room-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/room-directory.png -------------------------------------------------------------------------------- /documentation/img/select-user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/select-user.png -------------------------------------------------------------------------------- /documentation/img/status-area.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/status-area.png -------------------------------------------------------------------------------- /documentation/img/user-list.og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/user-list.og.png -------------------------------------------------------------------------------- /documentation/img/user-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/user-list.png -------------------------------------------------------------------------------- /documentation/img/window.og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/window.og.png -------------------------------------------------------------------------------- /documentation/img/window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/documentation/img/window.png -------------------------------------------------------------------------------- /documentation/style.css: -------------------------------------------------------------------------------- 1 | /* SPCSS theme by Susam Pal, under the MIT license 2 | * https://github.com/susam/spcss */ 3 | body{color:#333;font-family:helvetica,arial,sans-serif;line-height:1.5;margin:0 auto;max-width:40em;padding:0 1em}h1,h2,h3,h4,h5,h6{margin:1.25em 0 .5em;line-height:1.2}a:link{color:#00e}a:visited{color:#518}a:focus,a:hover{color:#03f}a:active{color:#e00}h1 a:empty:before,h2 a:empty:before,h3 a:empty:before,h4 a:empty:before,h5 a:empty:before,h6 a:empty:before{content:"#"}h1 a:empty,h2 a:empty,h3 a:empty,h4 a:empty,h5 a:empty,h6 a:empty{visibility:hidden;padding-left:.25em}h1:hover a:empty,h2:hover a:empty,h3:hover a:empty,h4:hover a:empty,h5:hover a:empty,h6:hover a:empty{visibility:visible}img{max-width:100%}figure{margin:1em 0;text-align:center}figcaption{font-size:small}code,kbd,pre,samp{color:#009;font-family:monospace,monospace}pre kbd{color:#060}blockquote,pre{background:#eee;padding:.5em}pre{overflow:auto}blockquote{border-left:medium solid #ccc;margin:1em 0}blockquote :first-child{margin-top:0}blockquote :last-child{margin-bottom:0}table{border-collapse:collapse}td,th{border:thin solid #999;padding:.3em .4em;text-align:left}@media (prefers-color-scheme:dark){body{background:#111;color:#bbb}a:link{color:#9bf}a:visited{color:#caf}a:focus,a:hover{color:#9cf}a:active{color:#faa}code,kbd,pre,samp{color:#6cf}pre kbd{color:#9c6}blockquote,pre{background:#000}blockquote{border-color:#333}td,th{border-color:#666}} 4 | 5 | /* 6 | * Copyright 2008-2017, Haiku. All rights reserved. 7 | * Distributed under the terms of the MIT License. 8 | */ 9 | .key { /* Shortcut (separate with */ 10 | -webkit-border-radius: 3px; 11 | -khtml-border-radius: 3px; 12 | -moz-border-radius: 3px; 13 | border-radius: 3px; 14 | border-color: #c7c7c7; 15 | border-style: solid; 16 | border-width: 1px; 17 | padding: 0px 2px 0px 2px; 18 | background-color: #e8e8e8; 19 | font-family: serif; 20 | font-variant: small-caps; 21 | font-size: 0.8em; 22 | } 23 | -------------------------------------------------------------------------------- /libs/Makefile: -------------------------------------------------------------------------------- 1 | .DEFAULT_GOAL := default 2 | 3 | libinterface: 4 | $(MAKE) -f libs/libinterface/Makefile 5 | 6 | librunview: 7 | $(MAKE) -f libs/librunview/Makefile 8 | 9 | libsupport: 10 | $(MAKE) -f libs/libsupport/Makefile 11 | 12 | all: libinterface librunview libsupport 13 | 14 | default: all 15 | -------------------------------------------------------------------------------- /libs/libinterface/BitmapMenuItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | BitmapListItem.cpp: A BMenuItem with an optional picture 3 | Written by DarkWyrm , Copyright 2007 4 | Released under the MIT license. 5 | */ 6 | #include "BitmapMenuItem.h" 7 | #include 8 | 9 | 10 | BitmapMenuItem::BitmapMenuItem(const char* label, BMessage* msg, 11 | BBitmap* bitmap, char shortcut, uint32 modifiers, bool ownership) 12 | : 13 | BMenuItem(label, msg, shortcut, modifiers), 14 | fBitmap(bitmap), 15 | fOwnership(ownership) 16 | { 17 | } 18 | 19 | 20 | BitmapMenuItem::BitmapMenuItem(BMessage* data) 21 | : 22 | BMenuItem(data) 23 | { 24 | fBitmap = (BBitmap*) BBitmap::Instantiate(data); 25 | } 26 | 27 | 28 | BitmapMenuItem::~BitmapMenuItem(void) 29 | { 30 | if (fOwnership == true) 31 | delete fBitmap; 32 | } 33 | 34 | 35 | status_t 36 | BitmapMenuItem::Archive(BMessage* data, bool deep) const 37 | { 38 | status_t status = BMenuItem::Archive(data, deep); 39 | 40 | if (status == B_OK && fBitmap) 41 | status = fBitmap->Archive(data, deep); 42 | 43 | if (status == B_OK) 44 | status = data->AddString("class", "BitmapMenuItem"); 45 | 46 | return status; 47 | } 48 | 49 | 50 | void 51 | BitmapMenuItem::GetContentSize(float* width, float* height) 52 | { 53 | float w,h; 54 | BMenuItem::GetContentSize(&w,&h); 55 | if (fBitmap) 56 | w += (fBitmap->Bounds().Width() * 57 | (Frame().Height() / fBitmap->Bounds().Height())) + 20; 58 | 59 | if (width) 60 | *width = w; 61 | 62 | if (height) 63 | *height = h; 64 | } 65 | 66 | 67 | void 68 | BitmapMenuItem::DrawContent(void) 69 | { 70 | if (!Label() && !fBitmap) 71 | return; 72 | 73 | float width, height; 74 | GetContentSize(&width, &height); 75 | 76 | BRect drawrect(Frame()); 77 | drawrect.bottom--; 78 | drawrect.top++; 79 | drawrect.left = ContentLocation().x; 80 | 81 | if (fBitmap) { 82 | // Scale the fBitmap down to completely fit within the field's height 83 | if (fBitmap->Bounds().Height() > drawrect.Height()) { 84 | drawrect.right = drawrect.left + 85 | (fBitmap->Bounds().Width() * 86 | (Frame().Height() / fBitmap->Bounds().Height())); 87 | } else { 88 | drawrect.right = drawrect.left + fBitmap->Bounds().Width(); 89 | } 90 | } else { 91 | drawrect.right = drawrect.left - 5; 92 | } 93 | 94 | BPoint stringpoint(ContentLocation()); 95 | stringpoint.x = drawrect.right + 10; 96 | Menu()->MovePenTo(stringpoint); 97 | BMenuItem::DrawContent(); 98 | 99 | if (fBitmap) { 100 | Menu()->PushState(); 101 | Menu()->SetDrawingMode(B_OP_ALPHA); 102 | Menu()->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); 103 | Menu()->DrawBitmap(fBitmap, fBitmap->Bounds(), drawrect, B_FILTER_BITMAP_BILINEAR); 104 | Menu()->PopState(); 105 | } 106 | } 107 | 108 | 109 | void 110 | BitmapMenuItem::SetBitmap(BBitmap *bitmap) 111 | { 112 | if (fOwnership == true) 113 | delete fBitmap; 114 | fBitmap = bitmap; 115 | } 116 | 117 | -------------------------------------------------------------------------------- /libs/libinterface/BitmapMenuItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | BitmapListItem.h: A BMenuItem with an optional picture 3 | Written by DarkWyrm , Copyright 2007 4 | Released under the MIT license. 5 | */ 6 | #ifndef BITMAP_MENU_ITEM_H 7 | #define BITMAP_MENU_ITEM_H 8 | 9 | #include 10 | 11 | /* 12 | BitmapMenuItems are simple little items, really. They provide the 13 | ability to show a menu item with some text, a picture, or both. The item 14 | optionally takes ownership of the BBitmap given to it. 15 | Note that it is still possible to see the checkmark on marked 16 | BitmapMenuItems -- the bitmap does not obscure the checkmark. 17 | */ 18 | 19 | class BitmapMenuItem : public BMenuItem { 20 | public: 21 | BitmapMenuItem(const char* label, BMessage* msg, 22 | BBitmap* bitmap, char shortcut = 0, 23 | uint32 modifiers = 0, bool ownership = true); 24 | BitmapMenuItem(BMessage* data); 25 | virtual ~BitmapMenuItem(void); 26 | 27 | virtual status_t Archive(BMessage* data, bool deep = true) const; 28 | 29 | virtual void GetContentSize(float* width, float* height); 30 | virtual void DrawContent(void); 31 | 32 | virtual void SetBitmap(BBitmap* bitmap); 33 | BBitmap* Bitmap(void) const { return fBitmap; } 34 | 35 | private: 36 | BBitmap* fBitmap; 37 | float fBaselineOffset; 38 | bool fOwnership; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /libs/libinterface/BitmapUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _BITMAP_UTILS_H 6 | #define _BITMAP_UTILS_H 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | BBitmap* ReadNodeIcon(const char* name, icon_size size, 13 | bool followSymlink); 14 | BBitmap* IconFromResources(BResources* res, int32 num, 15 | icon_size size = B_LARGE_ICON); 16 | BBitmap* RescaleBitmap(const BBitmap* src, float width, 17 | float height); 18 | 19 | #endif // _BITMAP_UTILS_H 20 | -------------------------------------------------------------------------------- /libs/libinterface/BitmapView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _BITMAP_VIEW_H 6 | #define _BITMAP_VIEW_H 7 | 8 | #include 9 | 10 | class BBitmap; 11 | 12 | class BitmapView : public BView { 13 | public: 14 | BitmapView(const char* name = NULL, 15 | uint32 flags = B_WILL_DRAW); 16 | ~BitmapView(); 17 | 18 | virtual void AttachedToWindow(); 19 | 20 | status_t InitCheck(); 21 | 22 | BBitmap* Bitmap() const; 23 | 24 | status_t SetBitmap(const char* filename); 25 | status_t SetBitmap(const BBitmap* bitmap); 26 | void SetSquare(bool isSquare); 27 | 28 | virtual BSize MinSize(); 29 | virtual BSize MaxSize(); 30 | virtual BSize PreferredSize(); 31 | 32 | virtual void Draw(BRect frame); 33 | 34 | private: 35 | BRect _ViewBounds(); 36 | 37 | BBitmap* fBitmap; 38 | bool fIsSquare; 39 | float fWidth; 40 | float fHeight; 41 | }; 42 | 43 | #endif // _BITMAP_VIEW_H 44 | -------------------------------------------------------------------------------- /libs/libinterface/Divider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _DIVIDER_H 6 | #define _DIVIDER_H 7 | 8 | #include 9 | 10 | class BMessage; 11 | class BMessenger; 12 | 13 | class Divider : public BView { 14 | public: 15 | Divider(const char* name, uint32 flags = 16 | B_FRAME_EVENTS | B_WILL_DRAW); 17 | virtual ~Divider(); 18 | 19 | Divider(BMessage* archive); 20 | 21 | virtual void Draw(BRect updateRect); 22 | virtual void GetPreferredSize(float* width, float* height); 23 | 24 | status_t Archive(BMessage* archive, bool deep = true) const; 25 | 26 | static BArchivable* Instantiate(BMessage* archive); 27 | 28 | orientation Orientation(); 29 | void Orientation(orientation orient); 30 | 31 | private: 32 | orientation fOrient; 33 | }; 34 | 35 | #endif // _DIVIDER_H 36 | -------------------------------------------------------------------------------- /libs/libinterface/EnterTextView.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "EnterTextView.h" 7 | 8 | #include 9 | 10 | 11 | EnterTextView::EnterTextView(const char* name) 12 | : 13 | UrlTextView(name), 14 | fTarget(NULL) 15 | { 16 | } 17 | 18 | 19 | EnterTextView::EnterTextView(const char* name, const BFont* initialFont, 20 | const rgb_color* initialColor, uint32 flags) 21 | : 22 | UrlTextView(name, initialFont, initialColor, flags), 23 | fTarget(NULL) 24 | { 25 | } 26 | 27 | 28 | void 29 | EnterTextView::KeyDown(const char* bytes, int32 numBytes) 30 | { 31 | int32 modifiers = Window()->CurrentMessage()->GetInt32("modifiers", 0); 32 | 33 | if (fTarget != NULL && (bytes[0] == B_ENTER) && (modifiers == 0)) 34 | { 35 | BMessage* msg = new BMessage(fMessage); 36 | if (fTextSlot.IsEmpty() == false) { 37 | msg->AddString(fTextSlot.String(), Text()); 38 | SetText(""); 39 | ScrollToOffset(0); 40 | } 41 | fTarget->MessageReceived(msg); 42 | } 43 | else 44 | BTextView::KeyDown(bytes, numBytes); 45 | } 46 | 47 | 48 | void 49 | EnterTextView::SetMessage(BMessage msg, const char* textSlot) 50 | { 51 | fMessage = msg; 52 | if (textSlot != NULL) 53 | fTextSlot.SetTo(textSlot); 54 | } 55 | -------------------------------------------------------------------------------- /libs/libinterface/EnterTextView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _ENTER_TEXT_VIEW_H 6 | #define _ENTER_TEXT_VIEW_H 7 | 8 | #include "UrlTextView.h" 9 | 10 | 11 | class EnterTextView : public UrlTextView { 12 | public: 13 | EnterTextView(const char* name); 14 | EnterTextView(const char* name, const BFont* initialFont, 15 | const rgb_color* initialColor, 16 | uint32 flags = B_WILL_DRAW); 17 | 18 | virtual void KeyDown(const char* bytes, int32 numBytes); 19 | 20 | void SetTarget(BHandler* handler) { fTarget = handler; } 21 | 22 | BMessage Message() { return fMessage; } 23 | void SetMessage(BMessage msg, const char* textSlot = NULL); 24 | 25 | private: 26 | BMessage fMessage; 27 | BHandler* fTarget; 28 | BString fTextSlot; 29 | }; 30 | 31 | #endif // _ENTER_TEXT_VIEW_H 32 | -------------------------------------------------------------------------------- /libs/libinterface/MenuButton.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "MenuButton.h" 7 | 8 | #include 9 | 10 | 11 | MenuButton::MenuButton(const char* name, const char* label, BMessage* message) 12 | : 13 | BButton(name, label, message), 14 | fMenu(NULL) 15 | { 16 | SetBehavior(B_POP_UP_BEHAVIOR); 17 | } 18 | 19 | 20 | void 21 | MenuButton::MouseDown(BPoint where) 22 | { 23 | BButton::MouseDown(where); 24 | if (fMenu != NULL) 25 | fMenu->Go(ConvertToScreen(Bounds().LeftBottom()), true, true, true); 26 | } 27 | 28 | 29 | void 30 | MenuButton::MouseUp(BPoint where) 31 | { 32 | BButton::MouseUp(where); 33 | SetValue(B_CONTROL_OFF); 34 | } 35 | 36 | 37 | void 38 | MenuButton::MouseMoved(BPoint where, uint32 code, const BMessage* dragMsg) 39 | { 40 | } 41 | 42 | 43 | 44 | BPopUpMenu* 45 | MenuButton::Menu() 46 | { 47 | return fMenu; 48 | } 49 | 50 | 51 | void 52 | MenuButton::SetMenu(BPopUpMenu* menu) 53 | { 54 | fMenu = menu; 55 | } 56 | -------------------------------------------------------------------------------- /libs/libinterface/MenuButton.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _MENU_BUTTON_H 6 | #define _MENU_BUTTON_H 7 | 8 | #include 9 | 10 | class BPopUpMenu; 11 | 12 | 13 | class MenuButton : public BButton { 14 | public: 15 | MenuButton(const char* name, const char* label, 16 | BMessage* message); 17 | 18 | virtual void MouseDown(BPoint where); 19 | virtual void MouseUp(BPoint where); 20 | virtual void MouseMoved(BPoint where, uint32 code, const BMessage* dragMsg); 21 | 22 | BPopUpMenu* Menu(); 23 | void SetMenu(BPopUpMenu* menu); 24 | 25 | private: 26 | BPopUpMenu* fMenu; 27 | 28 | }; 29 | 30 | #endif // _MENU_BUTTON_H 31 | -------------------------------------------------------------------------------- /libs/libinterface/PictureView.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | * 5 | * Authors: 6 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | #include "PictureView.h" 13 | 14 | 15 | PictureView::PictureView(const char* name, const char* filename, uint32 flags) 16 | : BView(name, flags), 17 | fBitmap(NULL), 18 | fWidth(0.0f), 19 | fHeight(0.0f) 20 | { 21 | // Set transparent 22 | SetViewColor(B_TRANSPARENT_COLOR); 23 | 24 | // Try to get the image 25 | fBitmap = BTranslationUtils::GetBitmap(filename); 26 | 27 | if (fBitmap) { 28 | BRect frame(fBitmap->Bounds()); 29 | 30 | fWidth = frame.Width(); 31 | fHeight = frame.Height(); 32 | } else 33 | return; 34 | 35 | ResizeTo(fWidth, fHeight); 36 | } 37 | 38 | 39 | PictureView::~PictureView() 40 | { 41 | delete fBitmap; 42 | fBitmap = NULL; 43 | } 44 | 45 | 46 | status_t 47 | PictureView::InitCheck() 48 | { 49 | if (fBitmap != NULL) 50 | return B_OK; 51 | return B_ERROR; 52 | } 53 | 54 | 55 | BSize 56 | PictureView::MinSize() 57 | { 58 | return BSize(fWidth, fHeight); 59 | } 60 | 61 | 62 | BSize 63 | PictureView::MaxSize() 64 | { 65 | return MinSize(); 66 | } 67 | 68 | 69 | BSize 70 | PictureView::PreferredSize() 71 | { 72 | return MinSize(); 73 | } 74 | 75 | 76 | void 77 | PictureView::Draw(BRect frame) 78 | { 79 | if (fBitmap) { 80 | SetDrawingMode(B_OP_ALPHA); 81 | SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); 82 | DrawBitmap(fBitmap, fBitmap->Bounds(), 83 | Bounds(), B_FILTER_BITMAP_BILINEAR); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /libs/libinterface/PictureView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _PICTURE_VIEW_H 6 | #define _PICTURE_VIEW_H 7 | 8 | #include 9 | 10 | class BBitmap; 11 | 12 | class PictureView : public BView { 13 | public: 14 | PictureView(const char* name, const char* filename, 15 | uint32 flags = B_WILL_DRAW); 16 | ~PictureView(); 17 | 18 | status_t InitCheck(); 19 | 20 | virtual BSize MinSize(); 21 | virtual BSize MaxSize(); 22 | virtual BSize PreferredSize(); 23 | 24 | virtual void Draw(BRect frame); 25 | 26 | private: 27 | BBitmap* fBitmap; 28 | float fWidth; 29 | float fHeight; 30 | }; 31 | 32 | #endif // _PICTURE_VIEW_H 33 | -------------------------------------------------------------------------------- /libs/libinterface/UrlTextView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _URL_TEXT_VIEW_H 6 | #define _URL_TEXT_VIEW_H 7 | 8 | #include 9 | #include 10 | 11 | class BPopUpMenu; 12 | 13 | 14 | /*! TextView that highlights and allows selecting of URLs― also provides a 15 | * right-click pop-up menu with internet search options */ 16 | class UrlTextView : public BTextView { 17 | public: 18 | UrlTextView(const char* name); 19 | UrlTextView(const char* name, const BFont* initialFont, 20 | const rgb_color* initialColor, uint32 flags); 21 | 22 | 23 | virtual void MessageReceived(BMessage* msg); 24 | 25 | virtual void MouseDown(BPoint where); 26 | virtual void MouseUp(BPoint where); 27 | virtual void MouseMoved(BPoint where, uint32 code, const BMessage* drag); 28 | 29 | virtual void Select(int32 startOffset, int32 endOffset); 30 | 31 | // Only differs in that it changes font face and color of any URLs 32 | void Insert(const char* text, const text_run_array* runs = NULL); 33 | void SetText(const char* text, const text_run_array* runs = NULL); 34 | 35 | BString WordAt(BPoint point); 36 | void FindWordAround(int32 offset, int32* start, int32* end, 37 | BString* _word = NULL); 38 | const char* GetLine(int32 line); 39 | 40 | BUrl UrlAt(BPoint point); 41 | 42 | bool OverText(BPoint where); 43 | bool OverUrl(BPoint where); 44 | 45 | private: 46 | BPopUpMenu* _RightClickPopUp(BPoint where); 47 | 48 | bool _FindUrlString(BString text, int32* start, int32* end, 49 | int32 offset); 50 | 51 | // Checks if char is allowed in a url, as per rfc3986 52 | bool _IsValidUrlChar(char c); 53 | 54 | // For safe-keeping 55 | text_run_array fNormalRun; 56 | text_run_array fUrlRun; 57 | BCursor* fUrlCursor; 58 | 59 | // Information between MouseDown and MouseUp 60 | BUrl fLastClicked; 61 | bool fMouseDown; 62 | bool fSelecting; 63 | }; 64 | 65 | #endif // _URL_TEXT_VIEW_H 66 | -------------------------------------------------------------------------------- /libs/librunview/Emoconfig.h: -------------------------------------------------------------------------------- 1 | /* i don't like this class name */ 2 | 3 | #ifndef Emoconfig_h_ 4 | #define Emoconfig_h_ 5 | 6 | #include 7 | #include 8 | 9 | class Emoconfig : public BMessage 10 | { 11 | public: 12 | Emoconfig(const char* xmlfile); 13 | ~Emoconfig(); 14 | int numfaces; 15 | BMessage menu; 16 | 17 | float GetEmoticonSize() { 18 | return fEmoticonSize; 19 | } 20 | 21 | private: 22 | 23 | float fEmoticonSize; 24 | XML_Parser fParser; 25 | 26 | static void StartElement(void* pUserData, const char* pName, const char** pAttr); 27 | static void EndElement(void* pUserData, const char* pName); 28 | static void Characters(void* pUserData, const char* pString, int pLen); 29 | 30 | }; 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /libs/librunview/Emoticor.cpp: -------------------------------------------------------------------------------- 1 | #include "Emoticor.h" 2 | #include 3 | #include 4 | #include 5 | #include "string.h" 6 | 7 | 8 | static Emoticor* fInstance = NULL; 9 | 10 | 11 | Emoticor* 12 | Emoticor::Get() 13 | { 14 | if (fInstance == NULL) 15 | fInstance = new Emoticor(); 16 | 17 | return fInstance; 18 | } 19 | 20 | 21 | Emoticor::Emoticor() 22 | { 23 | fInstance = NULL; 24 | fConfig = NULL; 25 | } 26 | 27 | 28 | Emoticor::~Emoticor() 29 | { 30 | if (fConfig) 31 | delete fConfig; 32 | } 33 | 34 | 35 | Emoconfig* 36 | Emoticor::Config() 37 | { 38 | return fConfig; 39 | } 40 | 41 | 42 | void 43 | Emoticor::LoadConfig(const char* txt) 44 | { 45 | fConfig = new Emoconfig(txt); 46 | } 47 | 48 | 49 | void 50 | Emoticor::_findTokens(RunView* fTextView, BString text, int tokenstart, 51 | rgb_color cols, rgb_color font, rgb_color cols2, 52 | rgb_color font2) 53 | { 54 | //****************************************** 55 | // "Iteration is human, recursion is divine" 56 | //****************************************** 57 | 58 | int32 newindex = 0; 59 | BString cur; 60 | int i = tokenstart; 61 | 62 | if (fConfig != NULL) { 63 | while (fConfig->FindString("face", i, &cur) == B_OK) 64 | //for(int i=tokenstart;inumfaces;i++) 65 | { 66 | i++; 67 | //if(config->FindString("face",i,&cur)!=B_OK) return; 68 | 69 | newindex = 0; 70 | 71 | while (true) { 72 | newindex = text.IFindFirst(cur.String(), 0); 73 | //printf("Try %d %s -- match %d\n",i,cur->original.String(),newindex); 74 | 75 | if (newindex != B_ERROR) { 76 | //take a walk on the left side ;) 77 | 78 | //printf("Found at %ld \n",newindex); 79 | 80 | if (newindex - 1 >= 0) { 81 | BString left; 82 | text.CopyInto(left, 0, newindex); 83 | //printf("ready to recourse! [%s]\n",left.String()); 84 | _findTokens(fTextView, left, tokenstart + 1, cols, font, cols2, font2); 85 | } 86 | 87 | 88 | text.Remove(0, newindex + cur.Length()); 89 | 90 | //printf("remaning [%s] printed [%s]\n",text.String(),cur->original.String()); 91 | 92 | // fTextView->Append(cur.String(), cols2, cols2, font2); 93 | // TODO 94 | 95 | if (text.Length() == 0) return; //useless stack 96 | } else 97 | break; 98 | 99 | } 100 | } 101 | } 102 | 103 | // fTextView->Append(text.String(), cols, cols, font); 104 | // TODO 105 | } 106 | 107 | 108 | void 109 | Emoticor::AddText(RunView* fTextView, const char* txt, rgb_color cols, 110 | rgb_color font, rgb_color cols2, rgb_color font2) 111 | { 112 | 113 | BString left(txt); 114 | 115 | // if(!fConfig) 116 | // fTextView->Append(txt,cols,cols,font); 117 | 118 | _findTokens(fTextView, left, 0, cols, font, cols2, font2); 119 | 120 | return; 121 | 122 | } 123 | 124 | 125 | -------------------------------------------------------------------------------- /libs/librunview/Emoticor.h: -------------------------------------------------------------------------------- 1 | #ifndef _Emoticor_h_ 2 | #define _Emoticor_h_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | class Emoticor 10 | { 11 | public: 12 | 13 | static Emoticor* Get(); //singleton 14 | 15 | 16 | void AddText(RunView* fTextView, const char* text, rgb_color cols, 17 | rgb_color font, rgb_color cols2, rgb_color font2); 18 | void LoadConfig(const char*); 19 | 20 | Emoconfig* Config(); 21 | 22 | ~Emoticor(); 23 | 24 | private: 25 | Emoticor(); 26 | Emoconfig* fConfig; 27 | void _findTokens(RunView* fTextView, BString text, int tokenstart, 28 | rgb_color cols, rgb_color font, rgb_color cols2, 29 | rgb_color font2); 30 | 31 | }; 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /libs/librunview/RunView.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "RunView.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | const uint32 kSearchDdg = 'RVse'; 17 | const uint32 kSearchDict = 'RVdc'; 18 | 19 | 20 | RunView::RunView(const char* name) 21 | : 22 | UrlTextView(name), 23 | fLastStyled(false) 24 | { 25 | text_run run = { 0, BFont(), ui_color(B_PANEL_TEXT_COLOR) }; 26 | fDefaultRun = { 1, {run} }; 27 | } 28 | 29 | 30 | void 31 | RunView::Append(const char* text, rgb_color color, BFont font) 32 | { 33 | text_run run = { 0, font, color }; 34 | text_run_array array = { 1, {run} }; 35 | 36 | Insert(text, &array); 37 | fLastStyled = true; 38 | } 39 | 40 | 41 | void 42 | RunView::Append(const char* text, rgb_color color, uint16 fontFace) 43 | { 44 | BFont font; 45 | font.SetFace(fontFace); 46 | Append(text, color, font); 47 | } 48 | 49 | 50 | void 51 | RunView::Append(const char* text, rgb_color color) 52 | { 53 | Append(text, color, BFont()); 54 | } 55 | 56 | 57 | void 58 | RunView::Append(const char* text) 59 | { 60 | if (fLastStyled == false) 61 | Insert(text); 62 | else 63 | Insert(text, &fDefaultRun); 64 | fLastStyled = false; 65 | } 66 | 67 | 68 | void 69 | RunView::ScrollToBottom() 70 | { 71 | ScrollToOffset(TextLength()); 72 | } 73 | -------------------------------------------------------------------------------- /libs/librunview/RunView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _RUN_VIEW_H 6 | #define _RUN_VIEW_H 7 | 8 | #include 9 | 10 | #include 11 | 12 | class BPopUpMenu; 13 | 14 | 15 | class RunView : public UrlTextView { 16 | public: 17 | RunView(const char* name); 18 | 19 | void Append(const char* text, rgb_color color, BFont font); 20 | void Append(const char* text, rgb_color color, uint16 fontFace); 21 | void Append(const char* text, rgb_color color); 22 | void Append(const char* text); 23 | 24 | void ScrollToBottom(); 25 | 26 | private: 27 | // For safe-keeping 28 | text_run_array fDefaultRun; 29 | 30 | // Whether or not the run was changed from default 31 | bool fLastStyled; 32 | }; 33 | 34 | #endif // _RUN_VIEW_H 35 | -------------------------------------------------------------------------------- /libs/libsupport/Base64.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Pier Luigi Fiorini. 3 | * Copyright 2004-2009, René Nyffenegge 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | 7 | // Based on original code from: 8 | // http://www.adp-gmbh.ch/cpp/common/base64.html 9 | 10 | #include 11 | 12 | #include "Base64.h" 13 | 14 | static const BString chars = 15 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 16 | "abcdefghijklmnopqrstuvwxyz" 17 | "0123456789+/"; 18 | 19 | 20 | Base64::Base64() 21 | { 22 | } 23 | 24 | 25 | BString 26 | Base64::Encode(const uchar* data, size_t length) 27 | { 28 | BString encoded; 29 | int32 i = 0; 30 | uchar array3[3], array4[4]; 31 | 32 | while (length--) { 33 | array3[i++] = *(data++); 34 | 35 | if (i == 3) { 36 | array4[0] = (uchar)((array3[0] & 0xfc) >> 2); 37 | array4[1] = (uchar)(((array3[0] & 0x03) << 4) + ((array3[1] & 0xf0) >> 4)); 38 | array4[2] = (uchar)(((array3[1] & 0x0f) << 2) + ((array3[2] & 0xc0) >> 6)); 39 | array4[3] = (uchar)(((array4[2] & 0x3) << 6) + array4[3]); 40 | 41 | for (i = 0; i < 3; i++) 42 | encoded += array3[i]; 43 | i = 0; 44 | } 45 | } 46 | 47 | if (i) { 48 | for (int32 j = i; j < 4; j++) 49 | array4[j] = 0; 50 | 51 | for (int32 j = 0; j < 4; j++) 52 | array4[j] = (uchar)chars.FindFirst(array4[j]); 53 | 54 | array3[0] = (uchar)((array4[0] << 2) + ((array4[i] & 0x30) >> 4)); 55 | array3[1] = (uchar)(((array4[1] & 0xf) << 4) + ((array4[2] & 0x3c) >> 2)); 56 | array3[2] = (uchar)(((array4[2] & 0x3) << 6) + array4[3]); 57 | 58 | for (int32 j = 0; j < i - 1; j++) 59 | encoded += array3[j]; 60 | } 61 | 62 | return encoded; 63 | } 64 | 65 | 66 | bool 67 | Base64::IsBase64(uchar c) 68 | { 69 | return isalnum(c) || (c == '+') || (c == '/'); 70 | } 71 | 72 | 73 | BString 74 | Base64::Decode(const BString& data) 75 | { 76 | int32 length = data.Length(); 77 | int32 i = 0; 78 | int32 index = 0; 79 | uchar array4[4], array3[3]; 80 | BString decoded; 81 | 82 | while (length-- && (data[index] != '=') && IsBase64(data[index])) { 83 | array4[i++] = data[index]; 84 | index++; 85 | 86 | if (i == 4) { 87 | for (i = 0; i < 4; i++) 88 | array4[i] = (uchar)chars.FindFirst(array4[i]); 89 | 90 | array3[0] = (uchar)((array4[0] << 2) + ((array4[1] & 0x30)>> 4)); 91 | array3[1] = (uchar)(((array4[1] & 0xf) << 4) + ((array4[2] & 0x3c) >> 2)); 92 | array3[2] = (uchar)(((array4[2] & 0x3) << 6) + array4[3]); 93 | 94 | for (i = 0; i < 3; i++) 95 | decoded += array3[i]; 96 | i = 0; 97 | } 98 | } 99 | 100 | if (i) { 101 | int32 j; 102 | 103 | for (j = i; j < 4; j++) 104 | array4[j] = 0; 105 | 106 | for (j = 0; j < 4; j++) 107 | array4[j] = (uchar)chars.FindFirst(array4[j]); 108 | 109 | array3[0] = (uchar)((array4[0] << 2) + ((array4[1] & 0x30) >> 4)); 110 | array3[1] = (uchar)(((array4[1] & 0xf) << 4) + ((array4[2] & 0x3c) >> 2)); 111 | array3[2] = (uchar)(((array4[2] & 0x3) << 6) + array4[3]); 112 | 113 | for (j = 0; j < i - 1; j++) 114 | decoded += array3[j]; 115 | } 116 | 117 | return decoded; 118 | } 119 | -------------------------------------------------------------------------------- /libs/libsupport/Base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, Pier Luigi Fiorini. 3 | * Copyright 2004-2009, René Nyffenegge 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _BASE_64_H 7 | #define _BASE_64_H 8 | 9 | #include 10 | 11 | class Base64 { 12 | public: 13 | static bool IsBase64(uchar c); 14 | static BString Encode(const uchar* data, size_t length); 15 | static BString Decode(const BString& data); 16 | 17 | private: 18 | Base64(); 19 | }; 20 | 21 | #endif // _BASE_64_H 22 | -------------------------------------------------------------------------------- /libs/libsupport/List.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _LIST_H 6 | #define _LIST_H 7 | 8 | #include 9 | 10 | #include 11 | 12 | template 13 | class List { 14 | public: 15 | uint32 CountItems() const; 16 | 17 | void AddItem(T type); 18 | 19 | void RemoveItemAt(uint32 position); 20 | 21 | T ItemAt(uint32 position); 22 | 23 | void AddList(List appendList); 24 | 25 | private: 26 | std::list fList; 27 | typedef typename std::list::iterator fIter; 28 | }; 29 | 30 | 31 | template 32 | uint32 List::CountItems() const 33 | { 34 | return fList.size(); 35 | } 36 | 37 | 38 | template 39 | void List::AddItem(T type) 40 | { 41 | fList.push_back(type); 42 | } 43 | 44 | 45 | template 46 | void List::RemoveItemAt(uint32 position) 47 | { 48 | fIter i = fList.begin(); 49 | std::advance(i, position); 50 | fList.erase(i); 51 | } 52 | 53 | 54 | template 55 | T List::ItemAt(uint32 position) 56 | { 57 | fIter i = fList.begin(); 58 | std::advance(i, position); 59 | return *i; 60 | } 61 | 62 | 63 | template 64 | void List::AddList(List appendList) 65 | { 66 | if (appendList.CountItems() == 0) 67 | return; 68 | for (int i = 0; i < appendList.CountItems(); i++) 69 | AddItem(appendList.ItemAt(i)); 70 | } 71 | 72 | 73 | #endif // _LIST_H 74 | -------------------------------------------------------------------------------- /libs/libsupport/SHA1.h: -------------------------------------------------------------------------------- 1 | /* 2 | 100% free public domain implementation of the SHA-1 3 | algorithm by Dominik Reichl 4 | 5 | 6 | === Test Vectors (from FIPS PUB 180-1) === 7 | 8 | "abc" 9 | A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D 10 | 11 | "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" 12 | 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 13 | 14 | A million repetitions of "a" 15 | 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F 16 | */ 17 | 18 | #ifndef ___SHA1_H___ 19 | #define ___SHA1_H___ 20 | 21 | #include // Needed for file access 22 | #include // Needed for memset and memcpy 23 | 24 | //#define LITTLE_ENDIAN 25 | #define MAX_FILE_READ_BUFFER 8000 26 | 27 | class CSHA1 28 | { 29 | public: 30 | // Rotate x bits to the left 31 | #define ROL32(value, bits) (((value)<<(bits))|((value)>>(32-(bits)))) 32 | 33 | #ifdef LITTLE_ENDIAN 34 | #define SHABLK0(i) (block->l[i] = (ROL32(block->l[i],24) & 0xFF00FF00) | (ROL32(block->l[i],8) & 0x00FF00FF)) 35 | #else 36 | #define SHABLK0(i) (block->l[i]) 37 | #endif 38 | 39 | #define SHABLK(i) (block->l[i&15] = ROL32(block->l[(i+13)&15] ^ block->l[(i+8)&15] ^ block->l[(i+2)&15] ^ block->l[i&15],1)) 40 | 41 | // SHA-1 rounds 42 | #define R0(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK0(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); } 43 | #define R1(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); } 44 | #define R2(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0x6ED9EBA1+ROL32(v,5); w=ROL32(w,30); } 45 | #define R3(v,w,x,y,z,i) { z+=(((w|x)&y)|(w&x))+SHABLK(i)+0x8F1BBCDC+ROL32(v,5); w=ROL32(w,30); } 46 | #define R4(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0xCA62C1D6+ROL32(v,5); w=ROL32(w,30); } 47 | 48 | typedef union { 49 | unsigned char c[64]; 50 | unsigned long l[16]; 51 | } SHA1_WORKSPACE_BLOCK; 52 | 53 | // Two different formats for ReportHash(...) 54 | enum { REPORT_HEX = 0, REPORT_DIGIT = 1 }; 55 | 56 | // Constructor and Destructor 57 | CSHA1(); 58 | virtual ~CSHA1(); 59 | 60 | unsigned long m_state[5]; 61 | unsigned long m_count[2]; 62 | unsigned char m_buffer[64]; 63 | unsigned char m_digest[20]; 64 | 65 | void Reset(); 66 | 67 | // Update the hash value 68 | void Update(unsigned char* data, unsigned int len); 69 | bool HashFile(char *szFileName); 70 | 71 | // Finalize hash and report 72 | void Final(); 73 | void ReportHash(char *szReport, unsigned char uReportType = REPORT_HEX); 74 | void GetHash(unsigned char *uDest); 75 | 76 | private: 77 | // Private SHA-1 transformation 78 | void Transform(unsigned long state[5], unsigned char buffer[64]); 79 | }; 80 | 81 | #endif // ___SHA1_H___ 82 | -------------------------------------------------------------------------------- /libs/libsupport/Singleton.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2010, Andrea Anzani. All rights reserved. 3 | * Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved. 4 | * Distributed under the terms of the MIT License. 5 | * 6 | * Authors: 7 | * Andrea Anzani, andrea.anzani@gmail.com 8 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 9 | */ 10 | 11 | #include "Singleton.h" 12 | 13 | 14 | template T* Singleton::fInstance = 0; 15 | -------------------------------------------------------------------------------- /libs/libsupport/Singleton.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the MIT License. 4 | */ 5 | #ifndef _SINGLETON_H 6 | #define _SINGLETON_H 7 | 8 | template 9 | class Singleton { 10 | public: 11 | static T* Get() 12 | { 13 | if (!fInstance) 14 | fInstance = new T(); 15 | return fInstance; 16 | } 17 | 18 | protected: 19 | static T* fInstance; 20 | 21 | Singleton() {} 22 | }; 23 | 24 | #endif // _SINGLETON_H 25 | -------------------------------------------------------------------------------- /libs/private/binary_compatibility/Global.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008, Oliver Tappe, zooey@hirschkaefer.de. 3 | * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _BINARY_COMPATIBILITY_GLOBAL_H_ 7 | #define _BINARY_COMPATIBILITY__GLOBAL_H_ 8 | 9 | 10 | // method codes 11 | enum { 12 | // app kit 13 | 14 | // interface kit 15 | PERFORM_CODE_MIN_SIZE = 1000, 16 | PERFORM_CODE_MAX_SIZE = 1001, 17 | PERFORM_CODE_PREFERRED_SIZE = 1002, 18 | PERFORM_CODE_LAYOUT_ALIGNMENT = 1003, 19 | PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH = 1004, 20 | PERFORM_CODE_GET_HEIGHT_FOR_WIDTH = 1005, 21 | PERFORM_CODE_SET_LAYOUT = 1006, 22 | PERFORM_CODE_INVALIDATE_LAYOUT = 1007, 23 | PERFORM_CODE_DO_LAYOUT = 1008, 24 | PERFORM_CODE_GET_TOOL_TIP_AT = 1009 25 | 26 | // support kit 27 | }; 28 | 29 | 30 | #endif // _BINARY_COMPATIBILITY__GLOBAL_H_ 31 | -------------------------------------------------------------------------------- /libs/private/binary_compatibility/Interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008, Oliver Tappe, zooey@hirschkaefer.de. 3 | * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. 4 | * Distributed under the terms of the MIT License. 5 | */ 6 | #ifndef _BINARY_COMPATIBILITY_INTERFACE_H_ 7 | #define _BINARY_COMPATIBILITY_INTERFACE_H_ 8 | 9 | 10 | #include 11 | 12 | 13 | struct perform_data_min_size { 14 | BSize return_value; 15 | }; 16 | 17 | struct perform_data_max_size { 18 | BSize return_value; 19 | }; 20 | 21 | struct perform_data_preferred_size { 22 | BSize return_value; 23 | }; 24 | 25 | struct perform_data_layout_alignment { 26 | BAlignment return_value; 27 | }; 28 | 29 | struct perform_data_has_height_for_width { 30 | bool return_value; 31 | }; 32 | 33 | struct perform_data_get_height_for_width { 34 | float width; 35 | float min; 36 | float max; 37 | float preferred; 38 | }; 39 | 40 | struct perform_data_set_layout { 41 | BLayout* layout; 42 | }; 43 | 44 | struct perform_data_invalidate_layout { 45 | bool descendants; 46 | }; 47 | 48 | struct perform_data_get_tool_tip_at { 49 | BPoint point; 50 | BToolTip** tool_tip; 51 | bool return_value; 52 | }; 53 | 54 | #endif /* _BINARY_COMPATIBILITY_INTERFACE_H_ */ 55 | -------------------------------------------------------------------------------- /locales/eo.catkeys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JadedCtrl/Chat-O-Matic/4284a8bb237853d202bd115188ff5b5f71be81eb/locales/eo.catkeys -------------------------------------------------------------------------------- /protocols/Makefile.common: -------------------------------------------------------------------------------- 1 | $(shell mkdir $(PROTOCOL_DIR) >/dev/null 2>&1) 2 | -------------------------------------------------------------------------------- /protocols/irc/IrcConstants.h: -------------------------------------------------------------------------------- 1 | #ifndef _IRC_CONSTANTS_H 2 | #define _IRC_CONSTANTS_H 3 | 4 | enum UserRole { 5 | ROOM_MEMBER = 0, 6 | ROOM_HALFOP = 1, 7 | ROOM_OPERATOR = 2, 8 | IRC_OPERATOR = 3 9 | }; 10 | 11 | 12 | // Formatting information from https://modern.ircdocs.horse/formatting.html 13 | #define FORMAT_BOLD 0x02 14 | #define FORMAT_COLOR 0x03 15 | #define FORMAT_RESET 0x0f 16 | #define FORMAT_REVERSE 0x16 17 | #define FORMAT_ITALIC 0x1d 18 | #define FORMAT_STRIKEOUT 0x1e 19 | #define FORMAT_UNDERSCORE 0x1f 20 | 21 | #define FORMAT_COLOR_COUNT 99 22 | #define FORMAT_COLORS { 0xFFFFFF, 0x000000, 0x00007F, 0x009300, \ 23 | 0xFF0000, 0x7F0000, 0x9C009C, 0xFC7F00, 0xFFFF00, 0x00FC00, 0x009393, \ 24 | 0x00FFFF, 0x0000FC, 0xFF00FF, 0x7F7F7F, 0xD2D2D2, \ 25 | 0x470000, 0x472100, 0x474700, 0x324700, 0x004700, 0x00472c, 0x004747, \ 26 | 0x002747, 0x000047, 0x2e0047, 0x470047, 0x47002a, 0x740000, 0x743a00, \ 27 | 0x747400, 0x517400, 0x007400, 0x007449, 0x007474, 0x004074, 0x000074, \ 28 | 0x4b0074, 0x740074, 0x740045, 0xb50000, 0xb56300, 0xb5b500, 0x7db500, \ 29 | 0x00b500, 0x00b571, 0x00b5b5, 0x0063b5, 0x0000b5, 0x7500b5, 0xb500b5, \ 30 | 0xb5006b, 0xff0000, 0xff8c00, 0xffff00, 0xb2ff00, 0x00ff00, 0x00ffa0, \ 31 | 0x00ffff, 0x008cff, 0x0000ff, 0xa500ff, 0xff00ff, 0xff0098, 0xff5959, \ 32 | 0xffb459, 0xffff71, 0xcfff60, 0x6fff6f, 0x65ffc9, 0x6dffff, 0x59b4ff, \ 33 | 0x5959ff, 0xc459ff, 0xff66ff, 0xff59bc, 0xff9c9c, 0xffd39c, 0xffff9c, \ 34 | 0xe2ff9c, 0x9cff9c, 0x9cffdb, 0x9cffff, 0x9cd3ff, 0x9c9cff, 0xdc9cff, \ 35 | 0xff9cff, 0xff94d3, 0x000000, 0x131313, 0x282828, 0x363636, 0x4d4d4d, \ 36 | 0x656565, 0x818181, 0x9f9f9f, 0xbcbcbc, 0xe2e2e2, 0xffffff }; 37 | 38 | 39 | // From RFC 2812 40 | #define RPL_WELCOME 1 41 | #define RPL_WHOISUSER 311 42 | #define RPL_ENDOFWHO 315 43 | #define RPL_ENDOFWHOIS 318 44 | #define RPL_LIST 322 45 | #define RPL_LISTEND 323 46 | #define RPL_TOPIC 332 47 | #define RPL_WHOREPLY 352 48 | #define RPL_NAMREPLY 353 49 | #define RPL_MOTD 372 50 | #define RPL_MOTDSTART 375 51 | #define RPL_ENDOFMOTD 376 52 | 53 | #define ERR_NONICKNAMEGIVEN 431 54 | #define ERR_ERRONEUSNICKNAME 432 55 | #define ERR_NICKNAMEINUSE 433 56 | 57 | #endif // _IRC_CONSTANTS_H 58 | -------------------------------------------------------------------------------- /protocols/irc/IrcMain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "IrcProtocol.h" 7 | 8 | 9 | extern "C" _EXPORT ChatProtocol* protocol_at(int32 i); 10 | extern "C" _EXPORT int32 protocol_count(); 11 | extern "C" _EXPORT const char* signature(); 12 | extern "C" _EXPORT const char* friendly_signature(); 13 | extern "C" _EXPORT uint32 version(); 14 | 15 | 16 | ChatProtocol* 17 | protocol_at(int32 i) 18 | { 19 | if (i == 0) 20 | return (ChatProtocol*)new IrcProtocol(); 21 | return NULL; 22 | } 23 | 24 | 25 | int32 26 | protocol_count() 27 | { 28 | return 1; 29 | } 30 | 31 | 32 | const char* 33 | signature() 34 | { 35 | return "irc"; 36 | } 37 | 38 | 39 | const char* 40 | friendly_signature() 41 | { 42 | return "IRC"; 43 | } 44 | 45 | 46 | uint32 47 | version() 48 | { 49 | return APP_VERSION_1_ALPHA_1; 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /protocols/irc/irc.rdef: -------------------------------------------------------------------------------- 1 | 2 | resource app_version { 3 | major = 0, 4 | middle = 0, 5 | minor = 1, 6 | 7 | variety = B_APPV_ALPHA, 8 | internal = 0, 9 | 10 | short_info = "Chat-O-Matic IRC add-on", 11 | long_info = "©2021 Jaidyn Levesque" 12 | }; 13 | 14 | -------------------------------------------------------------------------------- /protocols/matrix/Matrix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #ifndef _MATRIX_H 7 | #define _MATRIX_H 8 | 9 | #define MATRIX_SIGNATURE "application/x-vnd.chat-o-matic.matrix" 10 | #define MATRIX_ADDON "matrix" 11 | 12 | #endif // _MATRIX_H 13 | -------------------------------------------------------------------------------- /protocols/matrix/MatrixApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _MATRIX_APP_H 6 | #define _MATRIX_APP_H 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | const uint32 CHECK_APP = 'Paca'; 18 | 19 | 20 | class MatrixApp : public BApplication { 21 | public: 22 | MatrixApp(); 23 | 24 | virtual void MessageReceived(BMessage* msg); 25 | void ImMessage(BMessage* msg); 26 | 27 | void Connect(); 28 | void StartLoop(); 29 | 30 | void SendMessage(BMessage msg); 31 | void SendError(const char* message, 32 | mtx::http::RequestErr err, bool fatal = false); 33 | 34 | BMessage* fSettings; 35 | status_t fInitStatus; 36 | BStringList fRoomList; 37 | 38 | private: 39 | // Settings 40 | BString fUser; 41 | BString fPassword; 42 | BString fServer; 43 | BString fSession; 44 | 45 | thread_id fProtoThread; 46 | }; 47 | 48 | 49 | void print_error(mtx::http::RequestErr err, const char* message = NULL); 50 | 51 | void login_handler(const mtx::responses::Login &res, mtx::http::RequestErr err); 52 | 53 | void initial_sync_handler(const mtx::responses::Sync &res, mtx::http::RequestErr err); 54 | void sync_handler(const mtx::responses::Sync &res, mtx::http::RequestErr err); 55 | 56 | void room_sync(mtx::responses::Rooms rooms); 57 | 58 | #endif // _MATRIX_APP_H 59 | -------------------------------------------------------------------------------- /protocols/matrix/MatrixMain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "MatrixProtocol.h" 7 | 8 | 9 | extern "C" _EXPORT ChatProtocol* protocol_at(int32 i); 10 | extern "C" _EXPORT int32 protocol_count(); 11 | extern "C" _EXPORT const char* signature(); 12 | extern "C" _EXPORT const char* friendly_signature(); 13 | extern "C" _EXPORT uint32 version(); 14 | 15 | 16 | ChatProtocol* 17 | protocol_at(int32 i) 18 | { 19 | if (i == 0) 20 | return (ChatProtocol*)new MatrixProtocol(); 21 | return NULL; 22 | } 23 | 24 | 25 | int32 26 | protocol_count() 27 | { 28 | return 1; 29 | } 30 | 31 | 32 | const char* 33 | signature() 34 | { 35 | return "matrix"; 36 | } 37 | 38 | 39 | const char* 40 | friendly_signature() 41 | { 42 | return "Matrix"; 43 | } 44 | 45 | 46 | uint32 47 | version() 48 | { 49 | return APP_VERSION_1_ALPHA_1; 50 | } 51 | -------------------------------------------------------------------------------- /protocols/matrix/MatrixMessages.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _MATRIX_MESSAGES_H 6 | #define _MATRIX_MESSAGES_H 7 | 8 | enum matrix_message { 9 | /* 10 | * Messages between the Matrix add-on and server 11 | */ 12 | 13 | /*! Register account & thread with app →Server 14 | Requires: Account template, int64 thread_id */ 15 | MATRIX_REGISTER_ACCOUNT = 'MXra', 16 | 17 | 18 | /*! Inform the protocol of app team id →Protocol 19 | Requires: int64 team_id */ 20 | MATRIX_ACCOUNT_REGISTERED = 'MXar' 21 | }; 22 | 23 | #endif // _MATRIX_MESSAGES_H 24 | -------------------------------------------------------------------------------- /protocols/matrix/MatrixProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _MATRIX_PROTOCOL_H 6 | #define _MATRIX_PROTOCOL_H 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include "Matrix.h" 13 | 14 | 15 | status_t connect_thread(void* data); 16 | BMessage receive_message(); 17 | 18 | 19 | class MatrixProtocol : public ChatProtocol { 20 | public: 21 | MatrixProtocol(); 22 | ~MatrixProtocol(); 23 | 24 | // ChatProtocol inheritance 25 | virtual status_t Init(ChatProtocolMessengerInterface* interface); 26 | virtual status_t Shutdown(); 27 | 28 | virtual status_t UpdateSettings(BMessage* settings); 29 | 30 | virtual status_t Process(BMessage* msg); 31 | 32 | virtual BMessage SettingsTemplate(const char* name); 33 | virtual BObjectList 34 | Commands(); 35 | 36 | virtual const char* Signature() const { return MATRIX_ADDON; } 37 | virtual const char* FriendlySignature() const { return "Matrix"; } 38 | 39 | virtual BBitmap* Icon() const; 40 | 41 | virtual void SetAddOnPath(BPath path) { fAddOnPath = path; } 42 | virtual BPath AddOnPath() { return fAddOnPath; } 43 | 44 | virtual const char* GetName() { return fName; } 45 | virtual void SetName(const char* name) { fName = name; } 46 | 47 | virtual ChatProtocolMessengerInterface* 48 | MessengerInterface() const { return fMessenger; } 49 | 50 | // Matrix 51 | void SendMessage(BMessage* msg); 52 | void RegisterApp(team_id team); 53 | 54 | private: 55 | void _SendMatrixMessage(BMessage* msg); 56 | void _StartApp(); 57 | 58 | // GUI templates 59 | BMessage _AccountTemplate(); 60 | BMessage _RoomTemplate(); 61 | BMessage _RosterTemplate(); 62 | 63 | // Settings 64 | BMessage* fSettings; 65 | 66 | BPath fAddOnPath; 67 | BString fName; 68 | ChatProtocolMessengerInterface* fMessenger; 69 | 70 | team_id fAppTeam; 71 | thread_id fRecvThread; 72 | BMessenger* fAppMessenger; 73 | }; 74 | 75 | #endif // _MATRIX_PROTOCOL_H 76 | -------------------------------------------------------------------------------- /protocols/matrix/matrix.rdef: -------------------------------------------------------------------------------- 1 | #include "Matrix.h" 2 | 3 | resource app_signature MATRIX_SIGNATURE; 4 | resource app_flags B_BACKGROUND_APP | B_MULTIPLE_LAUNCH; 5 | 6 | resource app_version { 7 | major = 0, 8 | middle = 0, 9 | minor = 1, 10 | 11 | variety = B_APPV_ALPHA, 12 | internal = 0, 13 | 14 | short_info = "Chat-O-Matic Matrix add-on", 15 | long_info = "©2021 Jaidyn Levesque" 16 | }; 17 | -------------------------------------------------------------------------------- /protocols/purple/Purple.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef _PURPLE_H 20 | #define _PURPLE_H 21 | 22 | #define PURPLE_SIGNATURE "application/x-vnd.chat-o-matic.purple" 23 | #define PURPLE_ADDON "purple" 24 | 25 | #endif // _PURPLE_H 26 | -------------------------------------------------------------------------------- /protocols/purple/PurpleDialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | 6 | #include "PurpleDialog.h" 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "PurpleApp.h" 16 | 17 | 18 | PurpleDialog::PurpleDialog(const char* title, const char* primary, 19 | const char* secondary, PurpleAccount* account, va_list actions, 20 | size_t action_count, void* user_data) 21 | : 22 | BWindow(BRect(BPoint(-1000, -1000), BSize(300, 250)), _tr(title), 23 | B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 24 | B_AUTO_UPDATE_SIZE_LIMITS), 25 | fUserData(user_data) 26 | { 27 | CenterOnScreen(); 28 | _ParseActions(actions, action_count, PURPLE_REQUEST_ACTION); 29 | _InitActionInterface(primary, secondary); 30 | } 31 | 32 | 33 | void 34 | PurpleDialog::MessageReceived(BMessage* msg) 35 | { 36 | switch (msg->what) 37 | { 38 | case ACTION_BUTTON: 39 | { 40 | int32 id; 41 | if (msg->FindInt32("index", &id) != B_OK) break; 42 | 43 | PurpleRequestActionCb cb = fActions.ItemAt(id)->callback.action; 44 | cb(fUserData, fActions.ItemAt(id)->index); 45 | Quit(); 46 | break; 47 | } 48 | default: 49 | BWindow::MessageReceived(msg); 50 | } 51 | } 52 | 53 | 54 | void 55 | PurpleDialog::_InitActionInterface(const char* label, const char* desc) 56 | { 57 | BStringView* primaryLabel = new BStringView("primaryText", _tr(label)); 58 | primaryLabel->SetExplicitAlignment( 59 | BAlignment(B_ALIGN_CENTER, B_ALIGN_TOP)); 60 | 61 | BTextView* secondaryLabel = new BTextView("secondaryText"); 62 | secondaryLabel->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); 63 | secondaryLabel->MakeEditable(false); 64 | secondaryLabel->SetWordWrap(true); 65 | secondaryLabel->SetText(_tr(desc)); 66 | 67 | // Init buttons view 68 | BView* buttonsView = new BView("actionButtons", 0); 69 | BLayoutBuilder::Group<>(buttonsView, B_HORIZONTAL); 70 | for (int i = 0; i < fActions.CountItems(); i++) { 71 | RequestAction* action = fActions.ItemAt(i); 72 | BMessage* msg = new BMessage(ACTION_BUTTON); 73 | msg->AddInt32("index", action->index); 74 | 75 | BButton* button = new BButton(action->name.String(), msg); 76 | buttonsView->AddChild(button); 77 | } 78 | 79 | // Main layout 80 | BLayoutBuilder::Group<>(this, B_VERTICAL) 81 | .SetInsets(B_USE_DEFAULT_SPACING) 82 | .Add(primaryLabel) 83 | .Add(secondaryLabel) 84 | .Add(buttonsView) 85 | .AddGlue() 86 | .End(); 87 | } 88 | 89 | 90 | void 91 | PurpleDialog::_ParseActions(va_list actions, int32 count, 92 | PurpleRequestType type) 93 | { 94 | for (int i = 0; i < count; i++) { 95 | RequestAction* action = new RequestAction; 96 | action->name = va_arg(actions, const char*); 97 | action->index = i; 98 | action->type = type; 99 | 100 | switch (type) { 101 | case PURPLE_REQUEST_ACTION: 102 | action->callback.action = va_arg(actions, PurpleRequestActionCb); 103 | break; 104 | } 105 | fActions.AddItem(action); 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /protocols/purple/PurpleDialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * All rights reserved. Distributed under the terms of the MIT license. 4 | */ 5 | #ifndef _PURPLE_DIALOG_H 6 | #define _PURPLE_DIALOG_H 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | 14 | const uint32 ACTION_BUTTON = 'PDab'; 15 | 16 | struct RequestAction 17 | { 18 | BString name; 19 | PurpleRequestType type; 20 | int32 index; 21 | 22 | union { 23 | PurpleRequestActionCb action; 24 | } callback; 25 | }; 26 | 27 | 28 | class PurpleDialog : public BWindow { 29 | public: 30 | // PURPLE_REQUEST_ACTION 31 | PurpleDialog(const char* title, const char* primary, 32 | const char* secondary, PurpleAccount* account, 33 | va_list actions, size_t action_count, void* user_data); 34 | 35 | virtual void MessageReceived(BMessage* msg); 36 | 37 | private: 38 | void _InitActionInterface(const char* label, const char* desc); 39 | void _ParseActions(va_list actions, int32 count, 40 | PurpleRequestType type); 41 | 42 | BObjectList fActions; 43 | void* fUserData; 44 | }; 45 | 46 | #endif // _PURPLE_DIALOG_H 47 | -------------------------------------------------------------------------------- /protocols/purple/PurpleMessages.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021, Jaidyn Levesque 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef _PURPLE_MESSAGES_H 20 | #define _PURPLE_MESSAGES_H 21 | 22 | #include 23 | 24 | enum purple_message { 25 | /* 26 | * Messages between the Purple add-on and server 27 | */ 28 | 29 | /*! Request a count of protocols. →Server 30 | Response is sent directly to the requesting thread 31 | as a message's code, use receive_data() to catch it. 32 | Requires: int64 thread_id */ 33 | PURPLE_REQUEST_PROTOCOL_COUNT = 'PApc', 34 | 35 | /*! Request protocol metadata. →Server 36 | Response is sent directly to the requesting thread 37 | with two subsquent messages (using receive_data())― 38 | the first sending the size of the subsequently sent 39 | flattened BMessage. 40 | Requires: int32 protocol_index, int64 thread_id */ 41 | PURPLE_REQUEST_PROTOCOL_INFO = 'PApi', 42 | 43 | /*! Load/start connecting the account →Server 44 | Just the account's settings message from Cardie's end. 45 | It's the server's job to tie the Cardie account name 46 | to the PurpleAccount. */ 47 | PURPLE_CONNECT_ACCOUNT = 'PAla', 48 | 49 | /*! Associate account with thread →Server 50 | Makes the server associate the given account with 51 | the given thread. All subsequent Server→Add-On 52 | messages related to the account will be sent to this 53 | thread. 54 | Requires: String account_name, int64 thread_id */ 55 | PURPLE_REGISTER_THREAD = 'PArl', 56 | 57 | /*! Disconnect add-on's account →Server 58 | Requires: String account_name */ 59 | PURPLE_DISCONNECT_ACCOUNT = 'Axwx', 60 | 61 | /*! Shutdown an add-on instance →Protocol 62 | Send from server after an account is disabled 63 | or errors out; sent so an add-on instance 64 | won't run for an unconnected account. */ 65 | PURPLE_SHUTDOWN_ADDON = 'Pxwx', 66 | 67 | /*! Register chat commands with proto →Protocol */ 68 | PURPLE_REGISTER_COMMANDS = 'Scmd', 69 | 70 | /*! User has typed a command, process! →Server 71 | Forwarded from Cardie. 72 | Requires: String chat_id, String cmd_name, String misc_str */ 73 | PURPLE_CHAT_COMMAND = 'Pcmd' 74 | }; 75 | 76 | #endif // _PURPLE_MESSAGES_H 77 | -------------------------------------------------------------------------------- /protocols/purple/purple.rdef: -------------------------------------------------------------------------------- 1 | #include "Purple.h" 2 | 3 | resource app_signature PURPLE_SIGNATURE; 4 | 5 | resource app_version { 6 | major = 0, 7 | middle = 0, 8 | minor = 1, 9 | 10 | variety = B_APPV_ALPHA, 11 | internal = 0, 12 | 13 | short_info = "Chat-O-Matic libpurple add-on", 14 | long_info = "©2021 Jaidyn Levesque" 15 | }; 16 | 17 | resource app_flags B_SINGLE_LAUNCH | B_BACKGROUND_APP; 18 | -------------------------------------------------------------------------------- /protocols/xmpp/JabberMain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the GPL v2 License. 4 | * 5 | * Authors: 6 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 7 | */ 8 | 9 | #include 10 | 11 | #include "JabberProtocol.h" 12 | 13 | 14 | extern "C" _EXPORT ChatProtocol* protocol_at(int32 i); 15 | extern "C" _EXPORT int32 protocol_count(); 16 | extern "C" _EXPORT const char* signature(); 17 | extern "C" _EXPORT const char* friendly_signature(); 18 | extern "C" _EXPORT uint32 version(); 19 | 20 | 21 | ChatProtocol* 22 | protocol_at(int32 i) 23 | { 24 | if (i == 0) 25 | return (ChatProtocol*)new JabberProtocol(); 26 | return NULL; 27 | } 28 | 29 | 30 | int32 31 | protocol_count() 32 | { 33 | return 1; 34 | } 35 | 36 | 37 | const char* 38 | signature() 39 | { 40 | return "xmpp"; 41 | } 42 | 43 | 44 | const char* 45 | friendly_signature() 46 | { 47 | return "XMPP"; 48 | } 49 | 50 | 51 | uint32 52 | version() 53 | { 54 | return APP_VERSION_1_ALPHA_1; 55 | } 56 | 57 | 58 | -------------------------------------------------------------------------------- /protocols/xmpp/JabberProtocol.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the GPL v2 License. 4 | * 5 | * Authors: 6 | * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com 7 | */ 8 | 9 | #include "JabberProtocol.h" 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | 17 | #undef B_TRANSLATION_CONTEXT 18 | #define B_TRANSLATION_CONTEXT "JabberProtocol" 19 | 20 | 21 | JabberProtocol::JabberProtocol() 22 | : JabberHandler() 23 | { 24 | } 25 | 26 | 27 | JabberProtocol::~JabberProtocol() 28 | { 29 | } 30 | 31 | 32 | const char* 33 | JabberProtocol::Signature() const 34 | { 35 | return "xmpp"; 36 | } 37 | 38 | 39 | const char* 40 | JabberProtocol::FriendlySignature() const 41 | { 42 | return "XMPP"; 43 | } 44 | 45 | 46 | BBitmap* 47 | JabberProtocol::Icon() const 48 | { 49 | return ReadNodeIcon(fPath.Path(), B_LARGE_ICON, true); 50 | } 51 | 52 | 53 | BMessage 54 | JabberProtocol::SettingsTemplate(const char* name) 55 | { 56 | if (strcmp(name, "account") == 0) 57 | return JabberHandler::_SettingsTemplate(B_TRANSLATE("XMPP identifier:"), 58 | true); 59 | if (strcmp(name, "join_room") == 0 || strcmp(name, "create_room") == 0) 60 | return JabberHandler::_RoomTemplate(); 61 | if (strcmp(name, "roster") == 0) 62 | return JabberHandler::_RosterTemplate(); 63 | else 64 | return BMessage(); 65 | } 66 | 67 | 68 | void 69 | JabberProtocol::OverrideSettings() 70 | { 71 | } 72 | 73 | 74 | BString 75 | JabberProtocol::ComposeJID() const 76 | { 77 | BString jid(fUsername); 78 | if (jid.FindLast("@") < 0) 79 | jid << "@" << fServer; 80 | jid << "/" << fResource; 81 | return jid; 82 | } 83 | -------------------------------------------------------------------------------- /protocols/xmpp/JabberProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Pier Luigi Fiorini. All rights reserved. 3 | * Distributed under the terms of the GPL v2 License. 4 | */ 5 | #ifndef _JABBER_PROTOCOL_H 6 | #define _JABBER_PROTOCOL_H 7 | 8 | #include "JabberHandler.h" 9 | 10 | class JabberProtocol : public JabberHandler { 11 | public: 12 | JabberProtocol(); 13 | virtual ~JabberProtocol(); 14 | 15 | virtual const char* Signature() const; 16 | virtual const char* FriendlySignature() const; 17 | 18 | virtual BBitmap* Icon() const; 19 | 20 | virtual BMessage SettingsTemplate(const char* name); 21 | virtual void OverrideSettings(); 22 | 23 | virtual BString ComposeJID() const; 24 | }; 25 | 26 | #endif // _JABBER_PROTOCOL_H 27 | -------------------------------------------------------------------------------- /protocols/xmpp/jabber.rdef: -------------------------------------------------------------------------------- 1 | 2 | resource app_version { 3 | major = 0, 4 | middle = 0, 5 | minor = 1, 6 | 7 | variety = B_APPV_ALPHA, 8 | internal = 0, 9 | 10 | short_info = "Chat-O-Matic XMPP add-on", 11 | long_info = "©2010 Pier Luigi Fiorini" 12 | }; 13 | 14 | --------------------------------------------------------------------------------