Added a new deskbar replicant with related classes and icons, disabled libdownload and curl depencency, fixed some warnings and style violations around the code

This commit is contained in:
barrett 2011-12-14 23:36:27 +00:00
parent 98dd89fb55
commit 4aff3e3422
21 changed files with 914 additions and 32 deletions

View File

@ -45,10 +45,10 @@ LOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(GENERATED_DIR) ;
# Perform configuration checks # Perform configuration checks
include [ FDirName $(JAM_DIR) CheckRules ] ; include [ FDirName $(JAM_DIR) CheckRules ] ;
CheckGccPlatform ; CheckGccPlatform ;
CheckCurl ; #CheckCurl ;
if ! $(HAVE_CURL) { #if ! $(HAVE_CURL) {
Echo "** Caya needs Curl" ; # Echo "** Caya needs Curl" ;
} #}
# Include jam scripts # Include jam scripts
include [ FDirName $(JAM_DIR) HelperRules ] ; include [ FDirName $(JAM_DIR) HelperRules ] ;

View File

@ -109,3 +109,150 @@ resource(kSearchIcon) #'VICN' array {
$"0000000000414992CA3294CA67470A070109023D49920000000000003D49923A" $"0000000000414992CA3294CA67470A070109023D49920000000000003D49923A"
$"DA753AC02E" $"DA753AC02E"
}; };
/*
* Deskbar replicant icons
*/
// Connecting Green
resource(kConnectingReplicant) #'VICN' array {
$"6E636966070501040156020106023DB0753A5ED7B9F9EE3D18204A5B813F873F"
$"C376A70251C9FF89020106023DE0000000000000003D40004A200049A0005376"
$"A702CBC9FF89020106023F5C743B37D1BAB2F23ED1AC471CEC4937F8BF77A703"
$"48C9FF89020106023EC0D03BF7CDBAC4EE3DD7C849909B4875A356C9FF89CD77"
$"A704020112023EA645399A4BB883763DB26D497A2947E6FF00FFFFFFFF000D02"
$"045040C9A540C29A40405040C29A40C9A55060C29A60C9A560605060C9A560C2"
$"9A0002492E492E2A1E354F204A354F0002492E492EC20DB7EABFC2B752C0DBB7"
$"82BFC2B7520002BFC2B752BFC2B752BA7BB668B6FEBE79B765BA6DB6FEBE7900"
$"02B6FEBE79B6FEBE79B6ABC1B2354FB80BC4EF354F0002C43BC1E9C43BC1E9C5"
$"C2C1A8C54CBFB7C660C0E5C54CBFB7000233403340BF87C25CC5C9C112C52BC2"
$"93C5C9C1120002C5C9C112C5C9C112C61CC047453AC50ABF02453A0405FE0340"
$"3C44394238463A4F374D3951354432483140333C3A3C373C3A0404EF2B442B44"
$"2F503550324C385436573E4D3F553E4D00024728472842252E2B37222E2B0402"
$"0E2A302834293227360002333B333B373D4A3E45444A3E120A0101000241CBC6"
$"3EAFF7BDA3754091DCCA48B8CB509A0A0001073020B2C001179420040A050107"
$"3820B2C0001501178E20040A0501073820B2C015FF01179020040A0101082020"
$"B2C00A0001013020B2C001179420040A0201023820B2C0001501178E20040A02"
$"01023820B2C015FF01179020040A0301033820B2C0001501178E20040A030103"
$"3820B2C015FF01179020040A0401043820B2C0001501178E20040A0401043820"
$"B2C015FF01179020040A0101092020B2C00A0001063020B2C001179420040A05"
$"01063820B2C0001501178E20040A0501063820B2C015FF01179020040A050105"
$"3820B2C015FF01179020040A06030A0C0B100117842004"
};
// Caya icon
resource(kCayaIconReplicant) #'VICN' array {
$"6E636966070501040156020106023DB0753A5ED7B9F9EE3D18204A5B813F873F"
$"C3BD2CCE51EDADE7020106023DE0000000000000003D40004A200049A00053BC"
$"2CCECBEDADE7020106023F5C743B37D1BAB2F23ED1AC471CEC4937F8BFBD2CCE"
$"48EDADE7020106023EC0D03BF7CDBAC4EE3DD7C849909B4875A357E3FCC6CD89"
$"B226020112023EA645399A4BB883763DB26D497A2947E6FF00FFFFFFFF000D02"
$"045040C9A540C29A40405040C29A40C9A55060C29A60C9A560605060C9A560C2"
$"9A0002492E492E2A1E354F204A354F0002492E492EC20DB7EABFC2B752C0DBB7"
$"82BFC2B7520002BFC2B752BFC2B752BA7BB668B6FEBE79B765BA6DB6FEBE7900"
$"02B6FEBE79B6FEBE79B6ABC1B2354FB80BC4EF354F0002C43BC1E9C43BC1E9C5"
$"C2C1A8C54CBFB7C660C0E5C54CBFB7000233403340BF87C25CC5C9C112C52BC2"
$"93C5C9C1120002C5C9C112C5C9C112C61CC047453AC50ABF02453A0405FE0340"
$"3C44394238463A4F374D3951354432483140333C3A3C373C3A0404EF2B442B44"
$"2F503550324C385436573E4D3F553E4D00024728472842252E2B37222E2B0402"
$"0E2A302834293227360002333B333B373D4A3E45444A3E120A0101000241CBC6"
$"3EAFF7BDA3754091DCCA48B8CB509A0A0001073020B2C001179420040A050107"
$"3820B2C0001501178E20040A0501073820B2C015FF01179020040A0101082020"
$"B2C00A0001013020B2C001179420040A0201023820B2C0001501178E20040A02"
$"01023820B2C015FF01179020040A0301033820B2C0001501178E20040A030103"
$"3820B2C015FF01179020040A0401043820B2C0001501178E20040A0401043820"
$"B2C015FF01179020040A0101092020B2C00A0001063020B2C001179420040A05"
$"01063820B2C0001501178E20040A0501063820B2C015FF01179020040A050105"
$"3820B2C015FF01179020040A06030A0C0B100117842004"
};
// Offline
resource(kOfflineReplicant) #'VICN' array {
$"6E636966080501040156020116023DB0753A5ED7B9F9EE3D18204A5B813F873F"
$"C3A551F3020116023DE0000000000000003D40004A200049A00053A5CBF30201"
$"16023F5C743B37D1BAB2F23ED1AC471CEC4937F8BFA548F3020116023EC0D03B"
$"F7CDBAC4EE3DD7C849909B4875A357F3CDA2020112023EA645399A4BB883763D"
$"B26D497A2947E6FF00FFFFFFFF0003647F000D02045040C9A540C29A40405040"
$"C29A40C9A55060C29A60C9A560605060C9A560C29A0002492E492E2A1E354F20"
$"4A354F0002492E492EC20DB7EABFC2B752C0DBB782BFC2B7520002BFC2B752BF"
$"C2B752BA7BB668B6FEBE79B765BA6DB6FEBE790002B6FEBE79B6FEBE79B6ABC1"
$"B2354FB80BC4EF354F0002C43BC1E9C43BC1E9C5C2C1A8C54CBFB7C660C0E5C5"
$"4CBFB7000233403340BF87C25CC5C9C112C52BC293C5C9C1120002C5C9C112C5"
$"C9C112C61CC047453AC50ABF02453A0405FE03403C44394238463A4F374D3951"
$"354432483140333C3A3C373C3A0404EF2B442B442F503550324C385436573E4D"
$"3F553E4D00024728472842252E2B37222E2B04020E2A30283429322736000233"
$"3B333B373D4A3E45444A3E120A0101000241CBC63EAFF7BDA3754091DCCA48B8"
$"CB509A0A0001073020B2C001179420040A0501073820B2C0001501178E20040A"
$"0501073820B2C015FF01179020040A0101082020B2C00A0001013020B2C00117"
$"9420040A0201023820B2C0001501178E20040A0201023820B2C015FF01179020"
$"040A0301033820B2C0001501178E20040A0301033820B2C015FF01179020040A"
$"0401043820B2C0001501178E20040A0401043820B2C015FF01179020040A0101"
$"092020B2C00A0001063020B2C001179420040A0501063820B2C0001501178E20"
$"040A0501063820B2C015FF01179020040A0501053820B2C015FF01179020040A"
$"06030A0C0B100117842004"
};
// Busy
resource(kBusyReplicant) #'VICN' array {
$"6E636966070501040156020106023DB0753A5ED7B9F9EE3D18204A5B813F873F"
$"C3D6111151FFB3B3020106023DE0000000000000003D40004A200049A00053D6"
$"1111CBFFB3B3020106023F5C743B37D1BAB2F23ED1AC471CEC4937F8BFD61111"
$"48FFB3B3020106023EC0D03BF7CDBAC4EE3DD7C849909B4875A357FFB3B3CDF2"
$"3434020112023EA645399A4BB883763DB26D497A2947E6FF00FFFFFFFF000D02"
$"045040C9A540C29A40405040C29A40C9A55060C29A60C9A560605060C9A560C2"
$"9A0002492E492E2A1E354F204A354F0002492E492EC20DB7EABFC2B752C0DBB7"
$"82BFC2B7520002BFC2B752BFC2B752BA7BB668B6FEBE79B765BA6DB6FEBE7900"
$"02B6FEBE79B6FEBE79B6ABC1B2354FB80BC4EF354F0002C43BC1E9C43BC1E9C5"
$"C2C1A8C54CBFB7C660C0E5C54CBFB7000233403340BF87C25CC5C9C112C52BC2"
$"93C5C9C1120002C5C9C112C5C9C112C61CC047453AC50ABF02453A0405FE0340"
$"3C44394238463A4F374D3951354432483140333C3A3C373C3A0404EF2B442B44"
$"2F503550324C385436573E4D3F553E4D00024728472842252E2B37222E2B0402"
$"0E2A302834293227360002333B333B373D4A3E45444A3E120A0101000241CBC6"
$"3EAFF7BDA3754091DCCA48B8CB509A0A0001073020B2C001179420040A050107"
$"3820B2C0001501178E20040A0501073820B2C015FF01179020040A0101082020"
$"B2C00A0001013020B2C001179420040A0201023820B2C0001501178E20040A02"
$"01023820B2C015FF01179020040A0301033820B2C0001501178E20040A030103"
$"3820B2C015FF01179020040A0401043820B2C0001501178E20040A0401043820"
$"B2C015FF01179020040A0101092020B2C00A0001063020B2C001179420040A05"
$"01063820B2C0001501178E20040A0501063820B2C015FF01179020040A050105"
$"3820B2C015FF01179020040A06030A0C0B100117842004"
};
// Away
resource(kAwayReplicant) #'VICN' array {
$"6E636966070501040156020106023DB0753A5ED7B9F9EE3D18204A5B813F873F"
$"C3FF930651FFFCB3020106023DE0000000000000003D40004A200049A00053FF"
$"9306CBFFFCB3020106023F5C743B37D1BAB2F23ED1AC471CEC4937F8BFFF9306"
$"48FFFCB3020106023EC0D03BF7CDBAC4EE3DD7C849909B4875A357FFFCB3CDFF"
$"B006020112023EA645399A4BB883763DB26D497A2947E6FF00FFFFFFFF000D02"
$"045040C9A540C29A40405040C29A40C9A55060C29A60C9A560605060C9A560C2"
$"9A0002492E492E2A1E354F204A354F0002492E492EC20DB7EABFC2B752C0DBB7"
$"82BFC2B7520002BFC2B752BFC2B752BA7BB668B6FEBE79B765BA6DB6FEBE7900"
$"02B6FEBE79B6FEBE79B6ABC1B2354FB80BC4EF354F0002C43BC1E9C43BC1E9C5"
$"C2C1A8C54CBFB7C660C0E5C54CBFB7000233403340BF87C25CC5C9C112C52BC2"
$"93C5C9C1120002C5C9C112C5C9C112C61CC047453AC50ABF02453A0405FE0340"
$"3C44394238463A4F374D3951354432483140333C3A3C373C3A0404EF2B442B44"
$"2F503550324C385436573E4D3F553E4D00024728472842252E2B37222E2B0402"
$"0E2A302834293227360002333B333B373D4A3E45444A3E120A0101000241CBC6"
$"3EAFF7BDA3754091DCCA48B8CB509A0A0001073020B2C001179420040A050107"
$"3820B2C0001501178E20040A0501073820B2C015FF01179020040A0101082020"
$"B2C00A0001013020B2C001179420040A0201023820B2C0001501178E20040A02"
$"01023820B2C015FF01179020040A0301033820B2C0001501178E20040A030103"
$"3820B2C015FF01179020040A0401043820B2C0001501178E20040A0401043820"
$"B2C015FF01179020040A0101092020B2C00A0001063020B2C001179420040A05"
$"01063820B2C0001501178E20040A0501063820B2C015FF01179020040A050105"
$"3820B2C015FF01179020040A06030A0C0B100117842004"
};
// Replicant menu exit
resource(kExitMenuReplicant) #'VICN' array {
$"6E63696601020104040000337F558B9097A92D3541FF0F12160102044030C345"
$"30BC3A30304030BC3A30C3454050BC3A50C34550504050C34550BC3A010A0001"
$"0002408000000000000000408000C60000C60000"
};

View File

@ -5,13 +5,28 @@
#ifndef _CAYA_MESSAGES_H #ifndef _CAYA_MESSAGES_H
#define _CAYA_MESSAGES_H #define _CAYA_MESSAGES_H
//! Show settings window
const uint32 CAYA_SHOW_SETTINGS = 'RPST';
//! Open chat window //! Open chat window
const uint32 CAYA_OPEN_WINDOW = 'CYow'; const uint32 CAYA_OPEN_CHAT_WINDOW = 'CYow';
//! Close chat window //! Close chat window
const uint32 CAYA_CLOSE_WINDOW = 'CYcw'; const uint32 CAYA_CLOSE_CHAT_WINDOW = 'CYcw';
//! Chat messages //! Chat messages
const uint32 CAYA_CHAT = 'CYch'; const uint32 CAYA_CHAT = 'CYch';
//! Send replicant's messenger to Caya
const uint32 CAYA_REPLICANT_MESSENGER = 'RPme';
//! Status notification from the replicant
const uint32 CAYA_REPLICANT_STATUS_SET = 'RPMS';
//! Exit notification from replicant
const uint32 CAYA_REPLICANT_EXIT = 'RPEX';
//! Show main window replicant notification
const uint32 CAYA_REPLICANT_SHOW_WINDOW = 'CYSW';
#endif // _CAYA_MESSAGES_H #endif // _CAYA_MESSAGES_H

View File

@ -14,7 +14,14 @@ enum {
kToolIcon = 20, kToolIcon = 20,
kSearchIcon = 21, kSearchIcon = 21,
kProtocolSettingsTemplate = 1000 kProtocolSettingsTemplate = 1000,
kConnectingReplicant = 1200,
kCayaIconReplicant = 1220,
kOfflineReplicant = 1300,
kBusyReplicant = 1333,
kAwayReplicant = 1400,
kExitMenuReplicant = 1401
}; };
#endif // _CAYA_RESOURCES_H #endif // _CAYA_RESOURCES_H

View File

@ -71,7 +71,7 @@ ChatWindow::ChatWindow(ContactLinker* cl)
bool bool
ChatWindow::QuitRequested() ChatWindow::QuitRequested()
{ {
BMessage msg(CAYA_CLOSE_WINDOW); BMessage msg(CAYA_CLOSE_CHAT_WINDOW);
msg.AddString("id", fContactLinker->GetId()); msg.AddString("id", fContactLinker->GetId());
fContactLinker->Messenger().SendMessage(&msg); fContactLinker->Messenger().SendMessage(&msg);
return false; return false;

View File

@ -53,6 +53,8 @@ Application Caya :
StatusMenuItem.cpp StatusMenuItem.cpp
StatusView.cpp StatusView.cpp
CayaRenderView.cpp CayaRenderView.cpp
ReplicantStatusView.cpp
ReplicantMenuItem.cpp
: be $(TARGET_LIBSTDC++) translation expat : be $(TARGET_LIBSTDC++) translation expat
libinterface.a librunview.a libsupport.a libinterface.a librunview.a libsupport.a
: Caya.rdef : Caya.rdef

View File

@ -12,6 +12,7 @@
#include <Alert.h> #include <Alert.h>
#include <Button.h> #include <Button.h>
#include <CardLayout.h> #include <CardLayout.h>
#include <Deskbar.h>
#include <ListView.h> #include <ListView.h>
#include <Box.h> #include <Box.h>
#include <CheckBox.h> #include <CheckBox.h>
@ -32,6 +33,7 @@
#include <libinterface/BitmapUtils.h> #include <libinterface/BitmapUtils.h>
#include <libinterface/ToolButton.h> #include <libinterface/ToolButton.h>
#include "AccountManager.h"
#include "CayaConstants.h" #include "CayaConstants.h"
#include "CayaMessages.h" #include "CayaMessages.h"
#include "CayaProtocolMessages.h" #include "CayaProtocolMessages.h"
@ -41,6 +43,7 @@
#include "NotifyMessage.h" #include "NotifyMessage.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "PreferencesDialog.h" #include "PreferencesDialog.h"
#include "ReplicantStatusView.h"
#include "RosterItem.h" #include "RosterItem.h"
#include "RosterListView.h" #include "RosterListView.h"
#include "Server.h" #include "Server.h"
@ -49,12 +52,11 @@
const uint32 kLogin = 'LOGI'; const uint32 kLogin = 'LOGI';
const uint32 kSearchContact = 'SRCH'; const uint32 kSearchContact = 'SRCH';
const uint32 kPreferences = 'WPRF';
MainWindow::MainWindow() MainWindow::MainWindow()
: :
BWindow(BRect(0, 0, 300, 400), "Caya", B_DOCUMENT_WINDOW, 0) BWindow(BRect(0, 0, 300, 400), "Caya", B_DOCUMENT_WINDOW, 0),
fWorkspaceChanged(false)
{ {
fStatusView = new StatusView("statusView"); fStatusView = new StatusView("statusView");
@ -62,7 +64,7 @@ MainWindow::MainWindow()
new BMessage(kSearchContact)); new BMessage(kSearchContact));
fListView = new RosterListView("buddyView"); fListView = new RosterListView("buddyView");
fListView->SetInvocationMessage(new BMessage(CAYA_OPEN_WINDOW)); fListView->SetInvocationMessage(new BMessage(CAYA_OPEN_CHAT_WINDOW));
BScrollView* scrollView = new BScrollView("scrollview", fListView, BScrollView* scrollView = new BScrollView("scrollview", fListView,
B_WILL_DRAW, false, true); B_WILL_DRAW, false, true);
@ -72,7 +74,7 @@ MainWindow::MainWindow()
new BMessage(B_ABOUT_REQUESTED))); new BMessage(B_ABOUT_REQUESTED)));
(void)wrenchMenu->AddItem(new BSeparatorItem()); (void)wrenchMenu->AddItem(new BSeparatorItem());
(void)wrenchMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS, (void)wrenchMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS,
new BMessage(kPreferences))); new BMessage(CAYA_SHOW_SETTINGS)));
(void)wrenchMenu->AddItem(new BSeparatorItem()); (void)wrenchMenu->AddItem(new BSeparatorItem());
(void)wrenchMenu->AddItem(new BMenuItem("Quit", (void)wrenchMenu->AddItem(new BMenuItem("Quit",
new BMessage(B_QUIT_REQUESTED))); new BMessage(B_QUIT_REQUESTED)));
@ -105,6 +107,9 @@ MainWindow::MainWindow()
AddFilter(fServer); AddFilter(fServer);
CenterOnScreen(); CenterOnScreen();
//TODO check for errors here
_InstallReplicant();
} }
@ -122,6 +127,7 @@ MainWindow::QuitRequested()
fListView->MakeEmpty(); fListView->MakeEmpty();
fServer->Quit(); fServer->Quit();
CayaPreferences::Get()->Save(); CayaPreferences::Get()->Save();
_RemoveReplicant();
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
return true; return true;
} }
@ -158,18 +164,47 @@ MainWindow::MessageReceived(BMessage* message)
} }
break; break;
} }
case kPreferences: { case CAYA_SHOW_SETTINGS: {
PreferencesDialog* dialog = new PreferencesDialog(); PreferencesDialog* dialog = new PreferencesDialog();
dialog->Show(); dialog->Show();
break; break;
} }
case CAYA_OPEN_WINDOW: { case CAYA_OPEN_CHAT_WINDOW: {
int index = message->FindInt32("index"); int index = message->FindInt32("index");
RosterItem* ritem = ItemAt(index); RosterItem* ritem = ItemAt(index);
if (ritem != NULL) if (ritem != NULL)
ritem->GetContactLinker()->ShowWindow(); ritem->GetContactLinker()->ShowWindow();
break; break;
} }
case CAYA_REPLICANT_STATUS_SET:
{
int32 status;
message->FindInt32("status", &status);
AccountManager* accountManager = AccountManager::Get();
accountManager->SetStatus((CayaStatus)status);
break;
}
case CAYA_REPLICANT_SHOW_WINDOW:
{
if (LockLooper()) {
SetWorkspaces(B_CURRENT_WORKSPACE);
if ((IsMinimized() || IsHidden())
|| fWorkspaceChanged) {
Minimize(false);
Show();
fWorkspaceChanged = false;
} else if ((!IsMinimized() || !IsHidden())
|| (!fWorkspaceChanged)) {
Minimize(true);
}
UnlockLooper();
}
break;
}
case IM_MESSAGE: case IM_MESSAGE:
ImMessage(message); ImMessage(message);
break; break;
@ -179,6 +214,7 @@ MainWindow::MessageReceived(BMessage* message)
case B_ABOUT_REQUESTED: case B_ABOUT_REQUESTED:
be_app->PostMessage(message); be_app->PostMessage(message);
break; break;
default: default:
BWindow::MessageReceived(message); BWindow::MessageReceived(message);
} }
@ -357,3 +393,36 @@ MainWindow::RemoveItem(RosterItem* item)
fListView->RemoveItem(item); fListView->RemoveItem(item);
fListView->Sort(); fListView->Sort();
} }
void
MainWindow::WorkspaceActivated(int32 workspace, bool active)
{
if (active)
fWorkspaceChanged = false;
else
fWorkspaceChanged = true;
}
// The following methods install
// and remove the Caya's replicant
// from Deskbar.
status_t
MainWindow::_InstallReplicant()
{
BDeskbar deskbar;
if (deskbar.HasItem("ReplicantStatusView")) {
_RemoveReplicant();
}
ReplicantStatusView* view = new ReplicantStatusView();
return deskbar.AddItem(view);
}
status_t
MainWindow::_RemoveReplicant()
{
BDeskbar deskbar;
return deskbar.RemoveItem("ReplicantStatusView");
}

View File

@ -29,6 +29,9 @@ public:
void ImError(BMessage* msg); void ImError(BMessage* msg);
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual void WorkspaceActivated(int32 workspace,
bool active);
void ObserveInteger(int32 what, int32 val); void ObserveInteger(int32 what, int32 val);
Server* GetServer() const { return fServer; } Server* GetServer() const { return fServer; }
@ -42,9 +45,13 @@ public:
void RemoveItem(RosterItem*); void RemoveItem(RosterItem*);
private: private:
status_t _InstallReplicant();
status_t _RemoveReplicant();
StatusView* fStatusView; StatusView* fStatusView;
RosterListView* fListView; RosterListView* fListView;
Server* fServer; Server* fServer;
bool fWorkspaceChanged;
}; };
#endif // _MAIN_WINDOW_H #endif // _MAIN_WINDOW_H

View File

@ -6,6 +6,9 @@
* Authors: * Authors:
* Andrea Anzani, andrea.anzani@gmail.com * Andrea Anzani, andrea.anzani@gmail.com
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
*
* Contributors:
* Dario Casalinuovo
*/ */
#include <Application.h> #include <Application.h>
@ -30,7 +33,8 @@
Server::Server() Server::Server()
: :
BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE) BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
fReplicantMessenger(NULL)
{ {
} }
@ -38,6 +42,8 @@ Server::Server()
void void
Server::Quit() Server::Quit()
{ {
delete fReplicantMessenger;
ContactLinker* linker = NULL; ContactLinker* linker = NULL;
while ((linker = fRosterMap.ValueAt(0))) { while ((linker = fRosterMap.ValueAt(0))) {
@ -132,7 +138,7 @@ Server::Filter(BMessage* message, BHandler **target)
result = B_SKIP_MESSAGE; result = B_SKIP_MESSAGE;
break; break;
} }
case CAYA_CLOSE_WINDOW: case CAYA_CLOSE_CHAT_WINDOW:
{ {
BString id = message->FindString("id"); BString id = message->FindString("id");
if (id.Length() > 0) { if (id.Length() > 0) {
@ -148,6 +154,21 @@ Server::Filter(BMessage* message, BHandler **target)
case IM_MESSAGE: case IM_MESSAGE:
result = ImMessage(message); result = ImMessage(message);
break; break;
case CAYA_REPLICANT_MESSENGER:
{
fReplicantMessenger = new BMessenger();
status_t ret = message->FindMessenger(
"messenger", fReplicantMessenger);
if (ret != B_OK || !fReplicantMessenger->IsValid()) {
message->PrintToStream();
printf("err %s\n", strerror(ret));
}
break;
}
default: default:
// Dispatch not handled messages to main window // Dispatch not handled messages to main window
break; break;
@ -200,9 +221,9 @@ Server::ImMessage(BMessage* msg)
} }
case IM_OWN_STATUS_SET: case IM_OWN_STATUS_SET:
{ {
//msg->PrintToStream();
int32 status; int32 status;
const char* protocol; const char* protocol;
if (msg->FindInt32("status", &status) != B_OK) if (msg->FindInt32("status", &status) != B_OK)
return B_SKIP_MESSAGE; return B_SKIP_MESSAGE;
if (msg->FindString("protocol", &protocol) != B_OK) if (msg->FindString("protocol", &protocol) != B_OK)
@ -210,6 +231,8 @@ Server::ImMessage(BMessage* msg)
AccountManager* accountManager = AccountManager::Get(); AccountManager* accountManager = AccountManager::Get();
accountManager->SetStatus((CayaStatus)status); accountManager->SetStatus((CayaStatus)status);
_ReplicantStatusNotify((CayaStatus)status);
break; break;
} }
case IM_STATUS_SET: case IM_STATUS_SET:
@ -219,12 +242,15 @@ Server::ImMessage(BMessage* msg)
if (msg->FindInt32("status", &status) != B_OK) if (msg->FindInt32("status", &status) != B_OK)
return B_SKIP_MESSAGE; return B_SKIP_MESSAGE;
_ReplicantStatusNotify((CayaStatus)status);
ContactLinker* linker = _EnsureContactLinker(msg); ContactLinker* linker = _EnsureContactLinker(msg);
if (!linker) if (!linker)
break; break;
linker->SetNotifyStatus((CayaStatus)status); linker->SetNotifyStatus((CayaStatus)status);
linker->SetNotifyPersonalStatus(msg->FindString("message")); linker->SetNotifyPersonalStatus(msg->FindString("message"));
break; break;
} }
case IM_CONTACT_INFO: case IM_CONTACT_INFO:
@ -310,11 +336,11 @@ Server::ImMessage(BMessage* msg)
return result; return result;
if (msg->FindFloat("progress", &progress) != B_OK) if (msg->FindFloat("progress", &progress) != B_OK)
return result; return result;
#if 0
CayaProtocolAddOn* addOn CayaProtocolAddOn* addOn
= ProtocolManager::Get()->ProtocolAddOn(protocol); = ProtocolManager::Get()->ProtocolAddOn(protocol);
#if 0
BNotification notification(B_PROGRESS_NOTIFICATION); BNotification notification(B_PROGRESS_NOTIFICATION);
notification.SetGroup(BString("Caya")); notification.SetGroup(BString("Caya"));
notification.SetTitle(title); notification.SetTitle(title);
@ -341,10 +367,10 @@ Server::ImMessage(BMessage* msg)
if (msg->FindString("message", &message) != B_OK) if (msg->FindString("message", &message) != B_OK)
return result; return result;
#if 0
CayaProtocolAddOn* addOn CayaProtocolAddOn* addOn
= ProtocolManager::Get()->ProtocolAddOn(protocol); = ProtocolManager::Get()->ProtocolAddOn(protocol);
#if 0
BNotification notification((notification_type)type); BNotification notification((notification_type)type);
notification.SetGroup(BString("Caya")); notification.SetGroup(BString("Caya"));
notification.SetTitle(title); notification.SetTitle(title);
@ -354,6 +380,7 @@ Server::ImMessage(BMessage* msg)
#endif #endif
break; break;
} }
default: default:
break; break;
} }
@ -411,3 +438,14 @@ Server::_EnsureContactLinker(BMessage* message)
return item; return item;
} }
void
Server::_ReplicantStatusNotify(CayaStatus status)
{
if(fReplicantMessenger != NULL && fReplicantMessenger->IsValid()) {
BMessage mess(IM_OWN_STATUS_SET);
mess.AddInt32("status", status);
//mess.PrintToStream();
fReplicantMessenger->SendMessage(&mess);
}
}

View File

@ -48,10 +48,12 @@ public:
private: private:
ProtocolLooper* _LooperFromMessage(BMessage* message); ProtocolLooper* _LooperFromMessage(BMessage* message);
ContactLinker* _EnsureContactLinker(BMessage* message); ContactLinker* _EnsureContactLinker(BMessage* message);
void _ReplicantStatusNotify(CayaStatus status);
RosterMap fRosterMap; RosterMap fRosterMap;
ProtocolLoopers fLoopers; ProtocolLoopers fLoopers;
ContactLinker* fMySelf; ContactLinker* fMySelf;
BMessenger* fReplicantMessenger;
}; };
#endif // _SERVER_H #endif // _SERVER_H

View File

@ -16,16 +16,17 @@
#include "AboutWindow.h" #include "AboutWindow.h"
#include "Caya.h" #include "Caya.h"
#include "CayaMessages.h"
#include "Emoticor.h" #include "Emoticor.h"
#include "FilePanel.h" #include "FilePanel.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "ProtocolManager.h" #include "ProtocolManager.h"
#include "ReplicantStatusView.h"
#include "Server.h" #include "Server.h"
#include "TheApp.h" #include "TheApp.h"
#include "svn_revision.h" #include "svn_revision.h"
TheApp::TheApp() TheApp::TheApp()
: :
BApplication(CAYA_SIGNATURE), BApplication(CAYA_SIGNATURE),
@ -90,12 +91,14 @@ TheApp::AboutRequested()
const char* holders[] = { const char* holders[] = {
"2009-2010 Andrea Anzani", "2009-2010 Andrea Anzani",
"2009-2010 Pier Luigi Fiorini", "2009-2010 Pier Luigi Fiorini",
"2011-2012 Casalinuovo Dario",
NULL NULL
}; };
const char* authors[] = { const char* authors[] = {
"Andrea Anzani", "Andrea Anzani",
"Pier Luigi Fiorini", "Pier Luigi Fiorini",
"Casalinuovo Dario",
NULL NULL
}; };
@ -115,3 +118,25 @@ TheApp::GetMainWindow() const
{ {
return fMainWin; return fMainWin;
} }
void
TheApp::MessageReceived(BMessage* message)
{
//message->PrintToStream();
switch (message->what) {
case CAYA_REPLICANT_STATUS_SET:
case CAYA_REPLICANT_SHOW_WINDOW:
case CAYA_SHOW_SETTINGS:
case CAYA_REPLICANT_MESSENGER:
DetachCurrentMessage();
fMainWin->PostMessage(message);
break;
case CAYA_REPLICANT_EXIT:
// TODO BAlert here
PostMessage(B_QUIT_REQUESTED);
break;
default:
BLooper::MessageReceived(message);
}
}

View File

@ -17,6 +17,8 @@ public:
virtual void ReadyToRun(); virtual void ReadyToRun();
virtual void AboutRequested(); virtual void AboutRequested();
virtual void MessageReceived(BMessage* message);
MainWindow* GetMainWindow() const; MainWindow* GetMainWindow() const;
private: private:

View File

@ -55,6 +55,18 @@ PreferencesBehavior::PreferencesBehavior()
fMarkUnreadWindow->SetEnabled(false); fMarkUnreadWindow->SetEnabled(false);
// not implemented // not implemented
fDisableReplicant = new BCheckBox("DisableReplicant",
"Disable Deskbar replicant", NULL);
fDisableReplicant->SetEnabled(true);
fPermanentReplicant = new BCheckBox("PermanentReplicant",
"Permanent Deskbar Replicant", NULL);
fPermanentReplicant->SetEnabled(true);
fHideCayaTracker = new BCheckBox("HideCayaTracker",
"Hide Caya in Tracker", NULL);
fHideCayaTracker->SetEnabled(false);
const float spacing = be_control_look->DefaultItemSpacing(); const float spacing = be_control_look->DefaultItemSpacing();
SetLayout(new BGroupLayout(B_HORIZONTAL, spacing)); SetLayout(new BGroupLayout(B_HORIZONTAL, spacing));
@ -65,6 +77,9 @@ PreferencesBehavior::PreferencesBehavior()
.Add(fActivateChatWindow) .Add(fActivateChatWindow)
.Add(fMarkUnreadWindow) .Add(fMarkUnreadWindow)
.Add(fPlaySoundOnMessageReceived) .Add(fPlaySoundOnMessageReceived)
.Add(fDisableReplicant)
.Add(fPermanentReplicant)
.Add(fHideCayaTracker)
.SetInsets(spacing * 2, spacing, spacing, spacing) .SetInsets(spacing * 2, spacing, spacing, spacing)
.End() .End()
.Add(fIgnoreEmoticons) .Add(fIgnoreEmoticons)

View File

@ -27,6 +27,10 @@ private:
BCheckBox* fIgnoreEmoticons; BCheckBox* fIgnoreEmoticons;
BCheckBox* fDisableReplicant;
BCheckBox* fPermanentReplicant;
BCheckBox* fHideCayaTracker;
}; };
#endif // _PREFERENCES_BEHAVIOR_H #endif // _PREFERENCES_BEHAVIOR_H

View File

@ -0,0 +1,88 @@
/*
* Copyright 2009, Pier Luigi Fiorini. All rights reserved.
* Copyright 2011, Pier Luigi Fiorini. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
* Dario Casalinuovo
*/
#include "ReplicantMenuItem.h"
#include <string.h>
#include <Bitmap.h>
#include <Menu.h>
#include <libinterface/BitmapUtils.h>
#include "CayaMessages.h"
#include "CayaResources.h"
#include "CayaUtils.h"
#include "ReplicantStatusView.h"
const float kSize = 16;
const float kCircle = 12;
ReplicantMenuItem::ReplicantMenuItem(const char* label, CayaStatus status,
bool custom = false, char shortcut, uint32 modifiers)
:
BitmapMenuItem(label, NULL, NULL, shortcut, modifiers),
fStatus(status),
fCustom(custom)
{
BMessage* msg = new BMessage(CAYA_REPLICANT_STATUS_SET);
msg->AddInt32("status", fStatus);
SetMessage(msg);
SetIcon();
}
CayaStatus
ReplicantMenuItem::Status() const
{
return fStatus;
}
bool
ReplicantMenuItem::IsCustom() const
{
return fCustom;
}
void
ReplicantMenuItem::SetIcon()
{
BResources* res = CayaResources();
if (!res)
return;
int32 num = 0;
switch (fStatus) {
case CAYA_ONLINE:
num = kConnectingReplicant;
break;
case CAYA_EXTENDED_AWAY:
case CAYA_AWAY:
num = kAwayReplicant;
break;
case CAYA_DO_NOT_DISTURB:
num = kBusyReplicant;
break;
case CAYA_OFFLINE:
num = kOfflineReplicant;
break;
default:
break;
}
BBitmap* bitmap = IconFromResources(res, num, B_MINI_ICON);
SetBitmap(bitmap);
delete res;
}

View File

@ -0,0 +1,34 @@
/*
* Copyright 2009, Pier Luigi Fiorini. All rights reserved.
* Copyright 2011, Dario Casalinuovo. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _STATUS_MENU_ITEM_H
#define _STATUS_MENU_ITEM_H
#include <MenuItem.h>
#include <libinterface/BitmapMenuItem.h>
#include "CayaConstants.h"
class BBitmap;
const int32 kSetStatus = 'SEST';
class ReplicantMenuItem : public BitmapMenuItem {
public:
ReplicantMenuItem(const char* label, CayaStatus status,
bool custom = false, char shortcut = 0, uint32 modifiers = 0);
CayaStatus Status() const;
bool IsCustom() const;
private:
CayaStatus fStatus;
bool fCustom;
void SetIcon();
};
#endif // _STATUS_MENU_ITEM_H

View File

@ -0,0 +1,355 @@
/*
* Copyright 2011, Dario Casalinuovo. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Dario Casalinuovo
*/
#include <Application.h>
#include <AppFileInfo.h>
#include <Bitmap.h>
#include <IconUtils.h>
#include <Message.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <PopUpMenu.h>
#include <Roster.h>
#include <Window.h>
#include <libinterface/BitmapMenuItem.h>
#include <libinterface/BitmapUtils.h>
#include "AccountManager.h"
#include "BitmapView.h"
#include "Caya.h"
#include "CayaMessages.h"
#include "CayaProtocolMessages.h"
#include "CayaUtils.h"
#include "NicknameTextControl.h"
#include "ReplicantStatusView.h"
#include "ReplicantMenuItem.h"
#include <stdio.h>
extern "C" _EXPORT BView *instantiate_deskbar_item(void);
// The following handler is added to the Deskbar's looper
// to receive notifications from Caya
class ReplicantHandler : public BHandler {
public:
ReplicantHandler(const char* name, ReplicantStatusView* target)
: BHandler(name)
{
fTarget = target;
}
~ReplicantHandler() {}
virtual void MessageReceived(BMessage* message)
{
switch (message->what) {
case IM_OWN_STATUS_SET:
{
int32 status;
if (message->FindInt32("status", &status) != B_OK)
return;
fTarget->SetStatus((CayaStatus)status);
break;
}
default:
BHandler::MessageReceived(message);
}
}
private:
ReplicantStatusView* fTarget;
};
ReplicantStatusView::ReplicantStatusView()
:
BView(BRect(0, 0, 15, 15), "ReplicantStatusView",
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW)
{
_Init();
}
ReplicantStatusView::ReplicantStatusView(BMessage* archive)
:
BView(archive)
{
_Init();
}
ReplicantStatusView::~ReplicantStatusView()
{
delete fResources;
delete fCayaMsg;
delete fReplicantHandler;
// delete fStatusMenu;
// delete fReplicantMenu;
// TODO: Use a list for that
// maybe our List wrapper to std::list
delete fConnectingIcon;
delete fCayaIcon;
delete fOfflineIcon;
delete fBusyIcon;
delete fAwayIcon;
}
void
ReplicantStatusView::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case CAYA_REPLICANT_STATUS_SET:
{
int32 status;
if (msg->FindInt32("status", &status) != B_OK)
return;
SetStatus((CayaStatus)status);
fCayaMsg->SendMessage(msg);
break;
}
case CAYA_REPLICANT_EXIT:
case CAYA_SHOW_SETTINGS:
case CAYA_REPLICANT_SHOW_WINDOW:
case CAYA_REPLICANT_MESSENGER:
fCayaMsg->SendMessage(msg);
break;
default:
BView::MessageReceived(msg);
}
}
void
ReplicantStatusView::SetStatus(CayaStatus status)
{
for (int32 i = 0; i < fReplicantMenu->CountItems(); i++) {
ReplicantMenuItem* item
= dynamic_cast<ReplicantMenuItem*>(fReplicantMenu->ItemAt(i));
if (item == NULL)
continue;
if (item->IsMarked())
item->SetMarked(false);
if (item && item->Status() == status && !item->IsCustom())
item->SetMarked(true);
}
switch (status) {
case CAYA_AWAY:
case CAYA_EXTENDED_AWAY:
fIcon = fAwayIcon;
break;
case CAYA_DO_NOT_DISTURB:
fIcon = fBusyIcon;
break;
case CAYA_OFFLINE:
fIcon = fOfflineIcon;
break;
default:
fIcon = fCayaIcon;
break;
}
Invalidate();
}
// Draw our deskbar icon.
void
ReplicantStatusView::Draw(BRect rect)
{
SetDrawingMode(B_OP_ALPHA);
DrawBitmap(fIcon);
}
ReplicantStatusView*
ReplicantStatusView::Instantiate(BMessage* archive)
{
if (!validate_instantiation(archive, "ReplicantStatusView"))
return NULL;
return new ReplicantStatusView(archive);
}
status_t
ReplicantStatusView::Archive(BMessage* archive, bool deep) const
{
status_t status = BView::Archive(archive, deep);
if (status == B_OK)
status = archive->AddString("add_on", CAYA_SIGNATURE);
if (status == B_OK)
status = archive->AddString("class", "ReplicantStatusView");
return status;
}
void
ReplicantStatusView::AttachedToWindow()
{
BView::AttachedToWindow();
if (Parent())
SetViewColor(Parent()->ViewColor());
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowColor(ViewColor());
fReplicantHandler = new ReplicantHandler("CayaReplicantHandler", this);
if (Window()->Lock()) {
Window()->AddHandler(fReplicantHandler);
Window()->Unlock();
}
BMessage msg(CAYA_REPLICANT_MESSENGER);
BMessenger messenger(fReplicantHandler);
if (!messenger.IsValid())
return;
msg.AddMessenger("messenger", messenger);
fCayaMsg->SendMessage(&msg);
}
void
ReplicantStatusView::DetachedFromWindow()
{
if (Window()->Lock()) {
Window()->RemoveHandler(fReplicantHandler);
Window()->Unlock();
}
}
void
ReplicantStatusView::MouseDown(BPoint point)
{
unsigned long buttons;
if (LockLooper()) {
GetMouse(&point, &buttons, false);
UnlockLooper();
}
if (buttons & B_PRIMARY_MOUSE_BUTTON) {
// Show / Hide Window command
BMessage msg(CAYA_REPLICANT_SHOW_WINDOW);
fCayaMsg->SendMessage(&msg);
} else if(buttons & B_SECONDARY_MOUSE_BUTTON) {
// Build replicant menu
_ShowMenu(point);
}
}
void
ReplicantStatusView::_Init()
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// Creating the Send messenger and sending
// a messenger targeting this to Caya.
// This will allow the Replicant to communicate
// whith Caya.
fCayaMsg = new BMessenger(CAYA_SIGNATURE);
fResources = CayaResources();
//Get icons from resources
fConnectingIcon = _GetIcon(kConnectingReplicant);
fCayaIcon = _GetIcon(kCayaIconReplicant);
fOfflineIcon = _GetIcon(kOfflineReplicant);
fIcon = fOfflineIcon;
fBusyIcon = _GetIcon(kBusyReplicant);
fAwayIcon = _GetIcon(kAwayReplicant);
fExitMenuIcon = _GetIcon(kExitMenuReplicant);
// Build the replicant menu
_BuildMenu();
}
BBitmap*
ReplicantStatusView::_GetIcon(const uint32 id)
{
BBitmap* icon = IconFromResources(fResources, id, B_MINI_ICON);
return icon;
}
void
ReplicantStatusView::_BuildMenu()
{
// Status menu
//fStatusMenu = new BPopUpMenu("Status", false, false);
fReplicantMenu = new BPopUpMenu(" - ", false, false);
// Add status menu items
int32 s = CAYA_ONLINE;
while (s >= CAYA_ONLINE && s < CAYA_STATUSES) {
if (s == CAYA_EXTENDED_AWAY) {
s++;
continue;
}
BMessage* msg = new BMessage(CAYA_REPLICANT_STATUS_SET);
msg->AddInt32("status", s);
ReplicantMenuItem* item = new ReplicantMenuItem(
CayaStatusToString((CayaStatus)s), (CayaStatus)s);
fReplicantMenu->AddItem(item);
// Add items for custom messages
if (s == CAYA_ONLINE/* || s == CAYA_DO_NOT_DISTURB*/) {
item = new ReplicantMenuItem("Custom...", (CayaStatus) s, true);
fReplicantMenu->AddItem(item);
fReplicantMenu->AddItem(new BSeparatorItem());
}
// Mark offline status by default
if (s == CAYA_OFFLINE)
item->SetMarked(true);
s++;
}
//fReplicantMenu->AddItem(fStatusMenu);
fReplicantMenu->AddItem(new BSeparatorItem());
fReplicantMenu->AddItem(new BitmapMenuItem("Preferences ",
new BMessage(CAYA_SHOW_SETTINGS), fCayaIcon));
fReplicantMenu->AddItem(new BitmapMenuItem("Exit",
new BMessage(CAYA_REPLICANT_EXIT), fExitMenuIcon));
//fStatusMenu->SetTargetForItems(fReplicantMenu);
fReplicantMenu->SetTargetForItems(this);
}
void
ReplicantStatusView::_ShowMenu(BPoint point)
{
fReplicantMenu->SetTargetForItems(this);
ConvertToScreen(&point);
fReplicantMenu->Go(point, true, true, true);
}
extern "C" _EXPORT BView *
instantiate_deskbar_item(void)
{
return new ReplicantStatusView();
}

View File

@ -0,0 +1,71 @@
/*
* Copyright 2011, Dario Casalinuovo. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Dario Casalinuovo
*/
#ifndef _REPLICANT_STATUS_VIEW_H
#define _REPLICANT_STATUS_VIEW_H
#include <Handler.h>
#include <Messenger.h>
#include <Resources.h>
#include <View.h>
#include "CayaConstants.h"
#include "CayaResources.h"
class BPopUpMenu;
class BMenuField;
class BitmapView;
class NicknameTextControl;
class ReplicantHandler;
class ReplicantStatusView : public BView {
public:
ReplicantStatusView();
ReplicantStatusView(BMessage* archive);
~ReplicantStatusView();
virtual void MessageReceived(BMessage* msg);
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect rect);
void SetStatus(CayaStatus status);
virtual status_t Archive(BMessage* archive, bool deep) const;
static ReplicantStatusView* Instantiate(BMessage* archive);
void MouseDown(BPoint point);
private:
void _Init();
void _BuildMenu();
void _ShowMenu(BPoint point);
BBitmap* _GetIcon(const uint32 id);
BBitmap* fIcon;
BBitmap* fConnectingIcon;
BBitmap* fCayaIcon;
BBitmap* fOfflineIcon;
BBitmap* fBusyIcon;
BBitmap* fAwayIcon;
BBitmap* fExitMenuIcon;
BResources* fResources;
BPopUpMenu* fReplicantMenu;
bool fIsInstalled;
BMessenger* fCayaMsg;
ReplicantHandler* fReplicantHandler;
};
#endif

View File

@ -17,8 +17,9 @@ const int32 kSetStatus = 'SEST';
class StatusMenuItem : public BitmapMenuItem { class StatusMenuItem : public BitmapMenuItem {
public: public:
StatusMenuItem(const char* label, CayaStatus status, bool custom = false, StatusMenuItem(const char* label, CayaStatus status,
char shortcut = 0, uint32 modifiers = 0); bool custom = false, char shortcut = 0,
uint32 modifiers = 0);
CayaStatus Status() const; CayaStatus Status() const;
bool IsCustom() const; bool IsCustom() const;

View File

@ -1,7 +1,7 @@
SubDir TOP libs ; SubDir TOP libs ;
# Include all the components. # Include all the components.
SubInclude TOP libs libdownload ; #SubInclude TOP libs libdownload ;
SubInclude TOP libs librunview ; SubInclude TOP libs librunview ;
SubInclude TOP libs libsupport ; SubInclude TOP libs libsupport ;
SubInclude TOP libs libinterface ; SubInclude TOP libs libinterface ;

View File

@ -1,4 +1,4 @@
SubDir TOP tests ; SubDir TOP tests ;
# Include all the components # Include all the components
SubInclude TOP tests libdownload ; #SubInclude TOP tests libdownload ;