2021-06-22 14:42:07 -05:00
|
|
|
/*
|
2021-06-23 23:57:27 -05:00
|
|
|
* Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2021-06-24 12:22:34 -05:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
* 02110-1301, USA.
|
2021-06-23 23:57:27 -05:00
|
|
|
*/
|
2021-06-22 14:42:07 -05:00
|
|
|
|
2021-06-23 23:57:27 -05:00
|
|
|
#include "PurpleProtocol.h"
|
2021-06-22 14:42:07 -05:00
|
|
|
|
2021-08-15 01:08:32 -05:00
|
|
|
#include <iostream>
|
|
|
|
|
2021-06-23 23:57:27 -05:00
|
|
|
#include <Application.h>
|
2021-07-18 21:51:38 -05:00
|
|
|
#include <Catalog.h>
|
2021-07-07 15:02:59 -05:00
|
|
|
#include <Resources.h>
|
2021-06-23 23:57:27 -05:00
|
|
|
#include <Roster.h>
|
2021-07-07 15:02:59 -05:00
|
|
|
#include <TranslationUtils.h>
|
2021-06-22 14:42:07 -05:00
|
|
|
|
2021-06-23 23:57:27 -05:00
|
|
|
#include <ChatProtocolMessages.h>
|
2021-06-22 14:42:07 -05:00
|
|
|
|
2021-06-27 16:46:38 -05:00
|
|
|
#include "Purple.h"
|
2021-06-23 23:57:27 -05:00
|
|
|
#include "PurpleMessages.h"
|
2021-06-22 14:42:07 -05:00
|
|
|
|
|
|
|
|
2021-07-18 21:51:38 -05:00
|
|
|
#undef B_TRANSLATION_CONTEXT
|
|
|
|
#define B_TRANSLATION_CONTEXT "PurpleProtocol"
|
|
|
|
|
|
|
|
|
2021-06-23 23:57:27 -05:00
|
|
|
BMessenger* kAppMessenger = NULL;
|
2021-06-22 14:42:07 -05:00
|
|
|
|
2021-06-23 23:57:27 -05:00
|
|
|
|
|
|
|
ChatProtocol*
|
|
|
|
protocol_at(int32 i)
|
|
|
|
{
|
|
|
|
BMessenger* msgr = ensure_app_messenger();
|
2021-08-15 01:08:32 -05:00
|
|
|
if (msgr == NULL)
|
|
|
|
return NULL;
|
2021-06-23 23:57:27 -05:00
|
|
|
|
|
|
|
BMessage* msg = new BMessage(PURPLE_REQUEST_PROTOCOL_INFO);
|
|
|
|
msg->AddInt64("thread_id", find_thread(NULL));
|
|
|
|
msg->AddInt32("index", i);
|
|
|
|
msgr->SendMessage(msg);
|
|
|
|
|
2021-06-27 16:46:38 -05:00
|
|
|
BMessage protoInfo = receive_message();
|
|
|
|
BString name = protoInfo.FindString("name");
|
|
|
|
BString id = protoInfo.FindString("id");
|
2021-06-24 12:22:34 -05:00
|
|
|
|
2021-07-07 15:02:59 -05:00
|
|
|
return (ChatProtocol*)new PurpleProtocol(name, id, protoInfo);
|
2021-06-23 23:57:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int32
|
|
|
|
protocol_count()
|
|
|
|
{
|
2021-08-15 01:08:32 -05:00
|
|
|
BMessenger* msgr = ensure_app_messenger();
|
|
|
|
if (msgr == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2021-06-23 23:57:27 -05:00
|
|
|
BMessage* msg = new BMessage(PURPLE_REQUEST_PROTOCOL_COUNT);
|
|
|
|
msg->AddInt64("thread_id", find_thread(NULL));
|
2021-08-15 01:08:32 -05:00
|
|
|
msgr->SendMessage(msg);
|
2021-06-23 23:57:27 -05:00
|
|
|
|
|
|
|
thread_id sender;
|
2021-06-26 20:40:39 -05:00
|
|
|
return receive_data(&sender, NULL, 0);
|
2021-06-23 23:57:27 -05:00
|
|
|
}
|
2021-06-22 14:42:07 -05:00
|
|
|
|
|
|
|
|
2021-06-23 23:57:27 -05:00
|
|
|
const char*
|
|
|
|
signature()
|
|
|
|
{
|
Reorganize settings directory, custom purple paths
The settings file-hierarchy has been changed a bit:
* Cardie/
* preferences
* Accounts/
* Cache/
* Accounts/
* Add-Ons/
`Cardie/Protocols` is now `Cardie/Accounts`, and the cache directory
has been split into two. `Cache/Accounts/` is for account-specific
cached data (e.g., cached roster icons, data, etc.), and
`Cache/Protocols` is for protocol-wide settings/data.
For purple, this will be used as the user's libpurple directory,
which has been moved from the default of `~/.purple` (yikes!)
Some plugin search-paths have been given to purple, too― lib
directories + "/purple2/", and Cardie/Cache/Add-Ons/purple/plugins/.
2021-06-30 20:29:30 -05:00
|
|
|
return PURPLE_ADDON;
|
2021-06-23 23:57:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char*
|
|
|
|
friendly_signature()
|
|
|
|
{
|
|
|
|
return "Purple";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32
|
|
|
|
version()
|
|
|
|
{
|
2021-08-08 21:01:42 -05:00
|
|
|
return APP_VERSION_1_ALPHA_1;
|
2021-06-23 23:57:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BMessenger*
|
|
|
|
ensure_app_messenger()
|
|
|
|
{
|
|
|
|
if (kAppMessenger == NULL || kAppMessenger->IsValid() == false) {
|
2021-08-15 01:08:32 -05:00
|
|
|
if (ensure_app() == true)
|
|
|
|
kAppMessenger = new BMessenger(PURPLE_SIGNATURE);
|
2021-06-23 23:57:27 -05:00
|
|
|
}
|
|
|
|
return kAppMessenger;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-08-15 01:08:32 -05:00
|
|
|
bool
|
2021-06-23 23:57:27 -05:00
|
|
|
ensure_app()
|
|
|
|
{
|
|
|
|
BRoster roster;
|
2021-06-27 16:46:38 -05:00
|
|
|
if (roster.IsRunning(PURPLE_SIGNATURE) == true)
|
2021-08-15 01:08:32 -05:00
|
|
|
return true;
|
|
|
|
|
|
|
|
if (roster.Launch(PURPLE_SIGNATURE) == B_OK) {
|
|
|
|
snooze(100000);
|
|
|
|
return true;
|
|
|
|
}
|
2021-06-23 23:57:27 -05:00
|
|
|
|
|
|
|
app_info aInfo;
|
|
|
|
be_app->GetAppInfo(&aInfo);
|
|
|
|
BPath protoPath(&aInfo.ref);
|
|
|
|
protoPath.GetParent(&protoPath);
|
2021-08-15 01:08:32 -05:00
|
|
|
protoPath.Append(BString(APP_NAME).ToLower().Append("/purple"));
|
2021-06-23 23:57:27 -05:00
|
|
|
|
|
|
|
entry_ref protoRef;
|
|
|
|
BEntry(protoPath.Path()).GetRef(&protoRef);
|
2021-08-15 01:08:32 -05:00
|
|
|
if (roster.Launch(&protoRef) == B_OK) {
|
|
|
|
snooze(100000);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cerr << "libpurple add-on could not find its binary! All is lost!\n";
|
|
|
|
return false;
|
2021-06-23 23:57:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
status_t
|
|
|
|
connect_thread(void* data)
|
|
|
|
{
|
2021-06-27 16:46:38 -05:00
|
|
|
PurpleProtocol* protocol = (PurpleProtocol*)data;
|
2021-07-05 23:56:59 -05:00
|
|
|
while (true) {
|
|
|
|
BMessage* msg = new BMessage(receive_message());
|
|
|
|
switch (msg->what) {
|
Redesign add-on disconnection
Currently, add-ons are disconnected when ChatProtocol::Shutdown() is
called, which the add-on can do by itself― but there is no standard way
for add-ons to notify the app about their Shutdown. Because of this,
they tend to not call Shutdown()― instead (as in the case of the Jabber
add-on), they display a BAlert (IM_ERROR) notifying the user of the
connection error, but the account is considered active by Cardie (and
its threads are still existant, including its ProtocolLooper).
Zombies are bad, so this is redesigned somewhat with this commit:
Protocols should no longer call ChatProtocol::Shutdown() themselves,
they must send an IM_MESSAGE of IM_PROTOCOL_DISABLE to the app.
This will delete its ProtocolLooper, which in turn will send a
notification to the user and delete the ChatProtocol, and so
calling ChatProtocol::Shutdown().
In the included protocols, an IM_ERROR is sent right before
IM_PROTOCOL_DISABLE is sent if due to a connection error. This is not
required, but it is courteous to inform your user about the "why." :)
2021-07-18 17:52:36 -05:00
|
|
|
case PURPLE_SHUTDOWN_ADDON: {
|
|
|
|
BMessage* disabled = new BMessage(IM_MESSAGE);
|
|
|
|
disabled->AddInt32("im_what", IM_PROTOCOL_DISABLE);
|
|
|
|
protocol->SendMessage(disabled);
|
|
|
|
break;
|
|
|
|
}
|
2021-07-05 23:56:59 -05:00
|
|
|
case PURPLE_REGISTER_COMMANDS:
|
|
|
|
protocol->Process(msg);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
protocol->SendMessage(msg);
|
|
|
|
}
|
|
|
|
}
|
2021-06-27 16:46:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BMessage
|
|
|
|
receive_message()
|
|
|
|
{
|
|
|
|
thread_id sender;
|
|
|
|
int32 size = receive_data(&sender, NULL, 0);
|
|
|
|
char buffer[size];
|
|
|
|
receive_data(&sender, buffer, size);
|
|
|
|
BMessage temp;
|
|
|
|
temp.Unflatten(buffer);
|
|
|
|
return temp;
|
2021-06-23 23:57:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-24 12:22:34 -05:00
|
|
|
PurpleProtocol::PurpleProtocol(BString name, BString id, BMessage settings)
|
2021-06-23 23:57:27 -05:00
|
|
|
:
|
|
|
|
fSignature(id),
|
2021-06-24 12:22:34 -05:00
|
|
|
fFriendlySignature(name),
|
2021-07-07 15:02:59 -05:00
|
|
|
fIcon(NULL)
|
2021-06-22 14:42:07 -05:00
|
|
|
{
|
2021-07-07 15:02:59 -05:00
|
|
|
fIconName = settings.GetString("icon", "");
|
|
|
|
settings.FindMessage("templates", &fTemplates);
|
|
|
|
|
|
|
|
BPath path;
|
|
|
|
_FindIcon(&path, B_SYSTEM_DATA_DIRECTORY);
|
|
|
|
_FindIcon(&path, B_SYSTEM_NONPACKAGED_DATA_DIRECTORY);
|
|
|
|
_FindIcon(&path, B_USER_DATA_DIRECTORY);
|
|
|
|
_FindIcon(&path, B_USER_NONPACKAGED_DATA_DIRECTORY);
|
|
|
|
|
|
|
|
if (path.InitCheck() == B_OK) {
|
|
|
|
BFile iconFile(path.Path(), B_READ_ONLY);
|
|
|
|
fIcon = BTranslationUtils::GetBitmap(&iconFile);
|
|
|
|
}
|
2021-06-22 14:42:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-27 17:33:09 -05:00
|
|
|
PurpleProtocol::~PurpleProtocol()
|
|
|
|
{
|
|
|
|
Shutdown();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-22 14:42:07 -05:00
|
|
|
status_t
|
|
|
|
PurpleProtocol::Init(ChatProtocolMessengerInterface* interface)
|
|
|
|
{
|
|
|
|
fMessenger = interface;
|
|
|
|
return B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
status_t
|
|
|
|
PurpleProtocol::Shutdown()
|
|
|
|
{
|
Redesign add-on disconnection
Currently, add-ons are disconnected when ChatProtocol::Shutdown() is
called, which the add-on can do by itself― but there is no standard way
for add-ons to notify the app about their Shutdown. Because of this,
they tend to not call Shutdown()― instead (as in the case of the Jabber
add-on), they display a BAlert (IM_ERROR) notifying the user of the
connection error, but the account is considered active by Cardie (and
its threads are still existant, including its ProtocolLooper).
Zombies are bad, so this is redesigned somewhat with this commit:
Protocols should no longer call ChatProtocol::Shutdown() themselves,
they must send an IM_MESSAGE of IM_PROTOCOL_DISABLE to the app.
This will delete its ProtocolLooper, which in turn will send a
notification to the user and delete the ChatProtocol, and so
calling ChatProtocol::Shutdown().
In the included protocols, an IM_ERROR is sent right before
IM_PROTOCOL_DISABLE is sent if due to a connection error. This is not
required, but it is courteous to inform your user about the "why." :)
2021-07-18 17:52:36 -05:00
|
|
|
BMessage* disconnect = new BMessage(PURPLE_DISCONNECT_ACCOUNT);
|
2021-06-27 17:33:09 -05:00
|
|
|
_SendPrplMessage(disconnect);
|
|
|
|
|
|
|
|
kill_thread(fBirdThread);
|
2021-06-22 14:42:07 -05:00
|
|
|
return B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
status_t
|
|
|
|
PurpleProtocol::Process(BMessage* msg)
|
|
|
|
{
|
2021-07-05 23:56:59 -05:00
|
|
|
switch(msg->what)
|
|
|
|
{
|
|
|
|
case IM_MESSAGE:
|
|
|
|
_SendPrplMessage(msg);
|
|
|
|
return B_OK;
|
|
|
|
case PURPLE_REGISTER_COMMANDS:
|
|
|
|
{
|
|
|
|
BMessage cmd;
|
|
|
|
for (int i = 0; msg->FindMessage("command", i, &cmd) == B_OK; i++)
|
|
|
|
fCommands.AddItem(new BMessage(cmd));
|
|
|
|
|
|
|
|
BMessage* reload = new BMessage(IM_MESSAGE);
|
|
|
|
reload->AddInt32("im_what", IM_PROTOCOL_RELOAD_COMMANDS);
|
|
|
|
SendMessage(reload);
|
|
|
|
break;
|
|
|
|
}
|
2021-06-27 20:42:37 -05:00
|
|
|
}
|
|
|
|
return B_ERROR;
|
2021-06-22 14:42:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
status_t
|
|
|
|
PurpleProtocol::UpdateSettings(BMessage* msg)
|
|
|
|
{
|
2021-06-26 20:40:39 -05:00
|
|
|
ensure_app();
|
2021-06-27 16:46:38 -05:00
|
|
|
fPrplMessenger = new BMessenger(PURPLE_SIGNATURE);
|
2021-06-27 17:33:09 -05:00
|
|
|
msg->what = PURPLE_CONNECT_ACCOUNT;
|
2021-06-26 20:40:39 -05:00
|
|
|
_SendPrplMessage(msg);
|
2021-06-23 23:57:27 -05:00
|
|
|
|
2021-08-13 15:56:41 -05:00
|
|
|
fBirdThread = spawn_thread(connect_thread, "god_has_abandoned_us",
|
2021-06-27 16:46:38 -05:00
|
|
|
B_NORMAL_PRIORITY, (void*)this);
|
|
|
|
|
2021-08-13 15:56:41 -05:00
|
|
|
if (fBirdThread < B_OK)
|
2021-06-27 16:46:38 -05:00
|
|
|
return B_ERROR;
|
2021-06-23 23:57:27 -05:00
|
|
|
|
2021-06-27 16:46:38 -05:00
|
|
|
BMessage* account = new BMessage(PURPLE_REGISTER_THREAD);
|
2021-08-13 15:56:41 -05:00
|
|
|
account->AddInt64("thread_id", fBirdThread);
|
2022-02-18 15:42:06 -06:00
|
|
|
account->AddString("addon_cache", fAddOnCachePath.Path());
|
|
|
|
account->AddString("account_cache", fAccountCachePath.Path());
|
2021-06-27 16:46:38 -05:00
|
|
|
_SendPrplMessage(account);
|
|
|
|
|
2021-08-13 15:56:41 -05:00
|
|
|
resume_thread(fBirdThread);
|
2021-06-22 14:42:07 -05:00
|
|
|
return B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BMessage
|
|
|
|
PurpleProtocol::SettingsTemplate(const char* name)
|
|
|
|
{
|
2021-07-04 11:31:32 -05:00
|
|
|
BMessage temp;
|
|
|
|
|
2021-07-03 15:00:05 -05:00
|
|
|
if (strcmp(name, "roster") == 0)
|
|
|
|
return _RosterTemplate();
|
2021-07-04 11:31:32 -05:00
|
|
|
else if (strcmp(name, "account") == 0)
|
|
|
|
fTemplates.FindMessage("account", &temp);
|
2021-07-05 13:40:59 -05:00
|
|
|
else if (strcmp(name, "create_room") == 0 || strcmp(name, "join_room") == 0)
|
2021-07-04 11:31:32 -05:00
|
|
|
fTemplates.FindMessage("room", &temp);
|
|
|
|
return temp;
|
2021-06-22 14:42:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BObjectList<BMessage>
|
|
|
|
PurpleProtocol::Commands()
|
|
|
|
{
|
2021-07-05 23:56:59 -05:00
|
|
|
return fCommands;
|
2021-06-22 14:42:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BObjectList<BMessage>
|
|
|
|
PurpleProtocol::UserPopUpItems()
|
|
|
|
{
|
|
|
|
return BObjectList<BMessage>();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BObjectList<BMessage>
|
|
|
|
PurpleProtocol::ChatPopUpItems()
|
|
|
|
{
|
|
|
|
return BObjectList<BMessage>();
|
|
|
|
}
|
|
|
|
|
|
|
|
BObjectList<BMessage>
|
|
|
|
PurpleProtocol::MenuBarItems()
|
|
|
|
{
|
|
|
|
return BObjectList<BMessage>();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char*
|
|
|
|
PurpleProtocol::Signature() const
|
|
|
|
{
|
2021-06-23 23:57:27 -05:00
|
|
|
return fSignature.String();
|
2021-06-22 14:42:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char*
|
|
|
|
PurpleProtocol::FriendlySignature() const
|
|
|
|
{
|
2021-06-23 23:57:27 -05:00
|
|
|
return fFriendlySignature.String();
|
2021-06-22 14:42:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BBitmap*
|
|
|
|
PurpleProtocol::Icon() const
|
|
|
|
{
|
2021-07-07 15:02:59 -05:00
|
|
|
return fIcon;
|
2021-06-22 14:42:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-18 15:42:06 -06:00
|
|
|
BPath
|
|
|
|
PurpleProtocol::AddOnPath()
|
|
|
|
{
|
|
|
|
return fAddOnPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-22 14:42:07 -05:00
|
|
|
void
|
|
|
|
PurpleProtocol::SetAddOnPath(BPath path)
|
|
|
|
{
|
|
|
|
fAddOnPath = path;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-18 15:42:06 -06:00
|
|
|
void
|
|
|
|
PurpleProtocol::SetAccountCachePath(BPath path)
|
2021-06-22 14:42:07 -05:00
|
|
|
{
|
2022-02-18 15:42:06 -06:00
|
|
|
fAccountCachePath = path;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
PurpleProtocol::SetAddOnCachePath(BPath path)
|
|
|
|
{
|
|
|
|
fAddOnCachePath = path;
|
2021-06-22 14:42:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char*
|
|
|
|
PurpleProtocol::GetName()
|
|
|
|
{
|
|
|
|
return fName.String();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
PurpleProtocol::SetName(const char* name)
|
|
|
|
{
|
|
|
|
fName.SetTo(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32
|
|
|
|
PurpleProtocol::GetEncoding()
|
|
|
|
{
|
|
|
|
return 0xffff;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ChatProtocolMessengerInterface*
|
|
|
|
PurpleProtocol::MessengerInterface() const
|
|
|
|
{
|
|
|
|
return fMessenger;
|
|
|
|
}
|
2021-06-26 20:40:39 -05:00
|
|
|
|
|
|
|
|
2021-06-27 16:46:38 -05:00
|
|
|
void
|
|
|
|
PurpleProtocol::SendMessage(BMessage* msg)
|
|
|
|
{
|
|
|
|
if (!msg)
|
|
|
|
return;
|
|
|
|
msg->AddString("protocol", fSignature);
|
|
|
|
fMessenger->SendMessage(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-26 20:40:39 -05:00
|
|
|
void
|
|
|
|
PurpleProtocol::_SendPrplMessage(BMessage* msg)
|
|
|
|
{
|
|
|
|
msg->AddString("account_name", fName);
|
2021-06-27 16:46:38 -05:00
|
|
|
msg->AddString("protocol", fSignature);
|
2021-06-26 20:40:39 -05:00
|
|
|
if (fPrplMessenger->IsValid())
|
|
|
|
fPrplMessenger->SendMessage(msg);
|
|
|
|
}
|
2021-07-03 15:00:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
BMessage
|
|
|
|
PurpleProtocol::_RosterTemplate()
|
|
|
|
{
|
2021-07-18 21:51:38 -05:00
|
|
|
#undef B_TRANSLATION_CONTEXT
|
|
|
|
#define B_TRANSLATION_CONTEXT "PurpleProtocol ― Roster template"
|
|
|
|
|
2021-07-03 15:00:05 -05:00
|
|
|
BMessage temp;
|
|
|
|
BMessage id;
|
|
|
|
id.AddString("name", "user_id");
|
2021-07-18 21:51:38 -05:00
|
|
|
id.AddString("description", B_TRANSLATE("Username:"));
|
|
|
|
id.AddString("error", B_TRANSLATE("You can't friend someone without a nick."));
|
2021-07-03 15:00:05 -05:00
|
|
|
id.AddInt32("type", B_STRING_TYPE);
|
|
|
|
temp.AddMessage("setting", &id);
|
|
|
|
|
|
|
|
BMessage name;
|
|
|
|
name.AddString("name", "user_name");
|
2021-07-18 21:51:38 -05:00
|
|
|
name.AddString("description", B_TRANSLATE("Alias:"));
|
2021-07-03 15:00:05 -05:00
|
|
|
name.AddInt32("type", B_STRING_TYPE);
|
|
|
|
temp.AddMessage("setting", &name);
|
|
|
|
|
|
|
|
return temp;
|
|
|
|
}
|
2021-07-07 15:02:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
PurpleProtocol::_FindIcon(BPath* iconPath, directory_which finddir)
|
|
|
|
{
|
|
|
|
BPath path;
|
|
|
|
find_directory(finddir, &path);
|
|
|
|
|
|
|
|
BString relPath = "pixmaps/pidgin/protocols/48/";
|
|
|
|
relPath << fIconName << ".png";
|
|
|
|
|
|
|
|
path.Append(relPath.String());
|
|
|
|
if (BEntry(path.Path(), true).Exists() == true)
|
|
|
|
iconPath->SetTo(path.Path());
|
|
|
|
}
|