diff --git a/data/icons/protocols/Purple.rdef b/data/icons/protocols/Purple.rdef new file mode 100644 index 0000000..17147ae --- /dev/null +++ b/data/icons/protocols/Purple.rdef @@ -0,0 +1,112 @@ + +resource vector_icon { + $"6E6369661605EF020006023AA0003CA800BCA8003AA0004902AA4A227B00729F" + $"CFFF25486D020006020000003AFB7FBAFB7F000000499795484E4400FFFFFFFF" + $"D3E1F105FF03EEEEEC02000602377D3A35D1AFB6DE78365281483FD147AFEA00" + $"3B1941FFA949B902000602371338346996B6B69D34BBED47606847D819003B19" + $"41FFA646B70200020200000036D776B6E027000000478E014B8C4D007E408DFF" + $"FF82508E0002000202000000387533B87CB800000047A2D84B86BA003B1941FF" + $"FF3B194100020102020000003DCBB2BDA6A20000004932FB4A184C00FFFFFFFF" + $"FFEEEEEC00020002020000003817C5B81E2C0000004856AC4B693200FFFFFFF3" + $"FFEEEEEC0002000602B28000B7C00037C000B280004851554982AA009A5BA8FF" + $"744380036B1A8002001602AF28DAB329E2314CD7B1076247F5FD49A4360000FF" + $"FF0200060232E934B76AED376AED32E9344A55E2498F5C009A5BA8FF6B3E7503" + $"5C3566020006023421EAAACD362AA3D6344356494EDF4A86D200FDB751FFCE5C" + $"000200020232AAAA33A9A132B0C6B3F99149AB9F4A622E00522400FFFF6E3100" + $"0002000202AE7431333F93B24E88B00C0948FEBD4A6A7B006E3100FFFF6E3100" + $"0002001602AFAEF4B2988C30B53CB187EF4A254D499DC90000FFFF0200020200" + $"0000377BB0B77BB000000041ED794B79CC007A1D90FFFF6B3678000200020200" + $"000035EA1335EA130000004ADDFB4B7D89006B3678FFFF6B3678001B020CBDE8" + $"22BDE822BC2122BAB4B77FBAB4B573BAB4B9A1BAB4BDE8BAB436BAB4BFF3BDE8" + $"C19CBC21C19CC061C19CC557C19CC2DCC19CC557C19CC47EC447C546C34CC73F" + $"C447C7E8C19AC7E8C19AC849C19AC90AC19CC8A9C19BCB2DC19C5EBDE85EBFF3" + $"5E365EB77F5EB9A15EB573C87F22CA4522C4F622BDE822C17022BDE822020CBD" + $"E822BDE822BC2122BAB4B77FBAB4B573BAB4B9A1BAB4BDE8BAB436BAB4BFF3BD" + $"E8C19CBC21C19CC061C19CC557C19CC2DCC19CC557C19CC47EC447C546C34CC7" + $"3FC447C7E8C19AC7E8C19AC849C19AC90AC19CC8A9C19BCB2DC19C5EBDE85EBF" + $"F35E365EB77F5EB9A15EB573C87F22CA4522C4F622BDE822C17022BDE822020F" + $"BDE8B453BDE8B453BC76B453BB3AB77FBB3AB5B1BB3AB9A1BB3ABDE8BB3A36BB" + $"3ABFB4BDE8C112BC76C112C061C112C557C112C2DCC112C5A2C113C5DFC19CC5" + $"DFC150C5DFC19CC574C3A5C5CAC30BC693C3A5C777C12CC777C12CC78EC11CC7" + $"C9C112C7ACC112C834C112C90AC112C89FC112C9F9C112CAB8C03FCA68C0C5CB" + $"08BFB7CB2CBDE8CB2CBEE2CB2C36CB2CB77FCB2CB9A1CB2CB5B1C87FB453C9F0" + $"B453C4F6B453BDE8B453C170B453BDE8B453020FBDE8B453BDE8B453BC76B453" + $"BB3AB77FBB3AB5B1BB3AB9A1BB3ABDE8BB3A36BB3ABFB4BDE8C112BC76C112C0" + $"61C112C557C112C2DCC112C5A2C113C5DFC19CC5DFC150C5DFC19CC574C3A5C5" + $"CAC30BC693C3A5C777C12CC777C12CC78EC11CC7C9C112C7ACC112C834C112C9" + $"0AC112C89FC112C9F9C112CAB8C03FCA68C0C5CB08BFB7CB2CBDE8CB2CBEE2CB" + $"2C36CB2CB77FCB2CB9A1CB2CB5B1C87FB453C9F0B453C4F6B453BDE8B453C170" + $"B453BDE8B4530207BBBEC107BBBEC107BCB1C107BE98C107BDA5C107BED5C107" + $"BF06C186BF06C13FBF06C1CCBE98C204BED5C204BDA5C204BBBEC204BCB1C204" + $"BB81C204BB4FC186BB4FC1CCBB4FC13FBBBEC107BB81C107BBBEC1070604BFB8" + $"D3B714B8D3B714BA57B61FBD33B8B5BCEBB7D4BC80B8B5BB1AB8B5BBCDB8B5BB" + $"11B776B8D3B7140604BFB7BCB846B7BCB846B899B748BB40B8C5BB40B80DBA93" + $"B8DEB93DB90FB9E8B8F7B9E1B834B7BCB846020ABBBBB891BBBBB891B836B891" + $"26BF0FB516BB76B610C6F222C97BB406C5E122CA93B570CB18B451CB18B612CB" + $"18C4CBCB2CC35CCB2CC5EBCB2CC5D3CA17C5D3CA17C5D3C8B0C17AC67DC26EC7" + $"84C082C56FC193C1AFC193C1AFC1ECC0E2C21CBF0FC21CBFFEC21CBB70BBBBB8" + $"91BF40B891BBBBB891020ABBBBB891BBBBB891B836B89126BF0FB516BB76B610" + $"C6F222C97BB406C5E122CA93B570CB18B451CB18B612CB18C4CBCB2CC35CCB2C" + $"C5EBCB2CC5D3CA17C5D3CA17C5D3C8B0C17AC67DC26EC784C082C56FC193C1AF" + $"C193C1AFC1ECC0E2C21CBF0FC21CBFFEC21CBB70BBBBB891BF40B891BBBBB891" + $"0210BBA0B91ABBA0B91AB86FB91AB5EABF21B5AABBD2B637C313B523C6F0B616" + $"C46EB39BC975B5E6CAA7B4A7CAA7B6EECAA7C3A6CAA3C08DCAA3C444CAA34ECA" + $"224E5C4ECA044DC987C538C9CDC4A2C941C3B7C8ADC433C8F7C33CC863C240C7" + $"CFC2B8C818C1CBC785C117C6DEC161C740C0C4C671C096C565C09FC5F0C08FC4" + $"D8C0B3C3B5C0A3C442C0D2C298C117C19FC117C19FC11AC196C120C186C11DC1" + $"8DC170C0C9C19CBF1CC19CBFF7C19CBBC7BBA0B91ABED5B91ABBA0B91A0210BB" + $"A0B91ABBA0B91AB86FB91AB5EABF21B5AABBD2B637C313B523C6F0B616C46EB3" + $"9BC975B5E6CAA7B4A7CAA7B6EECAA7C3A6CAA3C08DCAA3C444CAA34ECA224E5C" + $"4ECA044DC987C538C9CDC4A2C941C3B7C8ADC433C8F7C33CC863C240C7CFC2B8" + $"C818C1CBC785C117C6DEC161C740C0C4C671C096C565C09FC5F0C08FC4D8C0B3" + $"C3B5C0A3C442C0D2C298C117C19FC117C19FC11AC196C120C186C11DC18DC170" + $"C0C9C19CBF1CC19CBFF7C19CBBC7BBA0B91ABED5B91ABBA0B91A0208B8E0BC06" + $"B8E0BC06B829BC06B73B39B794BC72B6E2BD78B6B6BEB4B6B6BE17B6B6C022B9" + $"24C15FB7C6C15FB9B6C15FBABBC0ACBA45C11BBB33C03FBB91BEDABB91BF9BBB" + $"91BE2BBABBBD02BB36BD8ABA42BC7AB8E0BC06B99FBC06B8E0BC060205BB04BE" + $"DABB04BEDABB04C007B925C0D4B9E6C0D4B81BC0D4B744BEB4B744BFDFB744BD" + $"AFB8E0BC93B7D8BC93B9EABC93BB04BEDABB04BDEDBB04BEDA0207B9F4BEC6B9" + $"F4BEC6B9F4BF27B98BBFB2B9CBBF81B94BBFE2B8BABFB2B8FBBFE2B87ABF81B8" + $"52BEC6B852BF27B852BE66B8BABDDBB87ABE0CB8FBBDAAB98BBDDBB94BBDAAB9" + $"CBBE0CB9F4BEC6B9F4BE66B9F4BEC60207B96CBEB4B96CBEB4B96CBEE4B94ABF" + $"29B95FBF10B934BF41B906BF29B91ABF41B8F1BF10B8E4BEB4B8E4BEE4B8E4BE" + $"82B906BE3EB8F1BE56B91ABE26B94ABE3EB934BE26B95FBE56B96CBEB4B96CBE" + $"82B96CBEB40208C0A9BC07C0A9BC07C01BBC0DBF40BCA5BF99BC43BE6BBD8FBF" + $"66BFF6BE89BF02BFC5C05EC0CCC0CCC040C0AEC156C0E9C268C04BC1F8C0C5C2" + $"DEBFC948BE74C2F9BF1AC2E6BDCEC24EBCB6C2B9BD2AC1D7BC34C0A9BC07C137" + $"BC02C0A9BC070205C1E9BD14C1E9BD14C138BC52BFA6BD02C016BC86BF0BBDAC" + $"BFCEBF99BF1CBED6C068C041C201BFF0C166C09BC29CBF45C1E9BD14C274BDAF" + $"C1E9BD140207C15BBEBEC15BBEBEC15BBF22C0F5BFB1C135BF7FC0B7BFE3C029" + $"BFB1C069BFE3BFEBBF7FBFC3BEBEBFC3BF22BFC3BE59C029BDCABFEBBDFCC069" + $"BD98C0F5BDCAC0B7BD98C135BDFCC15BBEBEC15BBE59C15BBEBE0210BD63C027" + $"BD63C027BD25C027BCE0C06FBCF8C051BCC8C08DBCA9C0CDBCBAC0ACBC86C10B" + $"BC34C17FBC62C14EBC04C1AEBB4CC1F4BBA6C1F1BA9AC1C930C15CB9F9C176B9" + $"3FC17FB94BC1DFB935C1B4B9E8C314BBDCC479334ABC7FC4D6BE3AC572BDA5C5" + $"33BEF3C4F2C0E8C1C5C0CCC301C0F4C199C0C0C14CC0E4C168C03DC19ABF10C1" + $"F1BFA6C1CBBED1C1EEBE85C183BEACC1B3BE5DC153BE1BC0CDBE3DC10CBE0CC0" + $"ABBDE6C06FBDFEC08DBDCEC050BD63C027BDA1C027BD63C0270207BBF5C0D4BB" + $"F5C0D4BB99C0D4BB52C187BB52C128BB52C1E3BBF5C239BB99C239BCE8C239BE" + $"CFC239BDDBC239BF2BC239BF71C187BF71C1E3BF71C128BECFC0D4BF2BC0D4BD" + $"DBC0D4BBF5C0D4BCE8C0D4BBF5C0D40207BBF1C0E7BBF1C0E7BCE4C0E7BECBC0" + $"E7BDD8C0E7BF08C0E7BF39C166BF39C120BF39C1ABBECBC1E3BF08C1E3BDD8C1" + $"E3BBF1C1E3BCE4C1E3BBB4C1E3BB82C166BB82C1ABBB82C120BBF1C0E7BBB4C0" + $"E7BBF1C0E70205B961C17DB961C17DBCBDC36FBD6BC04BBCD8C04BBDFEC04BC0" + $"D2C176BE18C36FC0AAC31ABE29C518BEB8C48FBD16C484B961C17DBA75C3DDB9" + $"61C17D0207BE42C28EBE42C28EBE56C2BEBE8548BE70C2E2BE9CC2FBBEB1C2CB" + $"BEACC2EEBEB4C2A7BE99C245BEABC274BE85C216BE55C1E5BE6BC1F1BE3FC1D8" + $"BE2AC20ABE2DC1E7BE27C22CBE42C28EBE30C25FBE42C28E0207BD01C291BD01" + $"C291BCEDC2C1BCBDC2F2BCD3C2E6BCA7C2FFBC92C2CEBC9548BC8FC2AABCAAC2" + $"48BC98C278BCBEC21ABCEDC1E8BCD8C1F4BD04C1DBBD19C20CBD14C1EABD1CC2" + $"2FBD01C291BD13C262BD01C2910207C0D4BEB4C0D4BEB4C0D4BEE5C0B1BF29C0" + $"C6BF11C09DBF41C06EBF29C083BF41C059BF11C04BBEB4C04BBEE5C04BBE83C0" + $"6EBE3EC059BE57C083BE26C0B1BE3EC09DBE26C0C6BE57C0D4BEB4C0D4BE83C0" + $"D4BEB40204B4CBCADFB4CBCADFB3EDCAACB539C5FEB399C8D0B5DDC8A6B8D8CA" + $"93B8D8CA93B77DCAACB4CBCADFB623CAC6B4CBCADF0204C4DFCADFC4DFCADFC5" + $"BCCAACC248C77CC688C99CC277C9AEC0D3CA93C0D3CA93C22BCAACC4DFCADFC3" + $"86CAC6C4DFCADF1B0A000100000A0101011001178100040A020102000A030103" + $"1001178100040A040104000A050105000A060106000A070107000A0801081001" + $"178100040A090109000A0A010A1001178100040A0B010B000A03010C000A0C01" + $"0D000A0D010E000A0E010F000A030110000A0C0111000A0F0112000A0F011300" + $"0A030114000A100115000A110116000A120117000A130118000A140119000A15" + $"011A00" +}; diff --git a/data/icons/protocols/Purple.svg b/data/icons/protocols/Purple.svg new file mode 100644 index 0000000..ede1897 --- /dev/null +++ b/data/icons/protocols/Purple.svg @@ -0,0 +1,610 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/protocols/purple/Makefile b/protocols/purple/Makefile index 662bf60..c46ca3b 100644 --- a/protocols/purple/Makefile +++ b/protocols/purple/Makefile @@ -38,7 +38,8 @@ SRCS = \ # Specify the resource definition files to use. Full or relative paths can be # used. RDEFS = \ - protocols/purple/purple.rdef + protocols/purple/purple.rdef \ + data/icons/protocols/Purple/Purple.rdef # Specify the resource files to use. Full or relative paths can be used. # Both RDEFS and RSRCS can be utilized in the same Makefile. @@ -60,7 +61,7 @@ RSRCS = # - if your library does not follow the standard library naming scheme, # you need to specify the path to the library and it's name. # (e.g. for mylib.a, specify "mylib.a" or "path/mylib.a") -LIBS = be crypto network support purple glib-2.0 $(STDCPPLIBS) +LIBS = be crypto glib-2.0 interface network purple support translation $(STDCPPLIBS) # Specify additional paths to directories following the standard libXXX.so diff --git a/protocols/purple/PurpleApp.cpp b/protocols/purple/PurpleApp.cpp index 508a842..b8a4d36 100644 --- a/protocols/purple/PurpleApp.cpp +++ b/protocols/purple/PurpleApp.cpp @@ -91,6 +91,7 @@ PurpleApp::MessageReceived(BMessage* msg) protoInfo.AddMessage("templates", &temps); protoInfo.AddString("name", info->name); protoInfo.AddString("id", info->id); + protoInfo.AddString("icon", info->iconName); SendMessage(thread_id, protoInfo); break; @@ -527,6 +528,8 @@ PurpleApp::_SaveProtocolInfo(PurplePlugin* plugin) PurplePluginProtocolInfo* info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); proto->accountTemplate = _GetAccountTemplate(info); proto->roomTemplate = _GetRoomTemplate(info); + if (info->list_icon != NULL) + proto->iconName = info->list_icon(NULL, NULL); fProtocols.AddItem(proto); } diff --git a/protocols/purple/PurpleApp.h b/protocols/purple/PurpleApp.h index 6e0a192..4b8918b 100644 --- a/protocols/purple/PurpleApp.h +++ b/protocols/purple/PurpleApp.h @@ -65,6 +65,7 @@ typedef struct _ProtocolInfo { BString id; BMessage accountTemplate; BMessage roomTemplate; + BString iconName; } ProtocolInfo; diff --git a/protocols/purple/PurpleProtocol.cpp b/protocols/purple/PurpleProtocol.cpp index 6a3050d..6c56954 100644 --- a/protocols/purple/PurpleProtocol.cpp +++ b/protocols/purple/PurpleProtocol.cpp @@ -22,7 +22,9 @@ #include #include +#include #include +#include #include @@ -46,10 +48,8 @@ protocol_at(int32 i) BMessage protoInfo = receive_message(); BString name = protoInfo.FindString("name"); BString id = protoInfo.FindString("id"); - BMessage templates; - protoInfo.FindMessage("templates", &templates); - return (ChatProtocol*)new PurpleProtocol(name, id, templates); + return (ChatProtocol*)new PurpleProtocol(name, id, protoInfo); } @@ -151,8 +151,21 @@ PurpleProtocol::PurpleProtocol(BString name, BString id, BMessage settings) : fSignature(id), fFriendlySignature(name), - fTemplates(settings) + fIcon(NULL) { + 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); + } } @@ -286,7 +299,7 @@ PurpleProtocol::FriendlySignature() const BBitmap* PurpleProtocol::Icon() const { - return NULL; + return fIcon; } @@ -371,3 +384,18 @@ PurpleProtocol::_RosterTemplate() return temp; } + + +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()); +} diff --git a/protocols/purple/PurpleProtocol.h b/protocols/purple/PurpleProtocol.h index e63f5b2..f11d753 100644 --- a/protocols/purple/PurpleProtocol.h +++ b/protocols/purple/PurpleProtocol.h @@ -20,6 +20,7 @@ #ifndef _PURPLE_PROTOCOL_H #define _PURPLE_PROTOCOL_H +#include #include #include @@ -83,6 +84,8 @@ private: BMessage _RosterTemplate(); + void _FindIcon(BPath* path, directory_which finddir); + ChatProtocolMessengerInterface* fMessenger; BMessenger* fPrplMessenger; thread_id fBirdThread; @@ -92,6 +95,8 @@ private: BString fSignature; BString fFriendlySignature; + BString fIconName; + BBitmap* fIcon; BMessage fTemplates; BObjectList fCommands; };