You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
(12) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
|
Feb
(23) |
Mar
(6) |
Apr
(6) |
May
(2) |
Jun
(41) |
Jul
(29) |
Aug
(28) |
Sep
(51) |
Oct
(19) |
Nov
(27) |
Dec
|
| 2003 |
Jan
(1) |
Feb
(11) |
Mar
(20) |
Apr
(18) |
May
(23) |
Jun
(18) |
Jul
(13) |
Aug
(49) |
Sep
(20) |
Oct
(3) |
Nov
(24) |
Dec
(1) |
| 2004 |
Jan
(12) |
Feb
(17) |
Mar
(38) |
Apr
(7) |
May
(22) |
Jun
(4) |
Jul
(26) |
Aug
(17) |
Sep
(18) |
Oct
(17) |
Nov
|
Dec
|
| 2005 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(2) |
Oct
|
Nov
(14) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
| 2009 |
Jan
(5) |
Feb
(12) |
Mar
|
Apr
(10) |
May
(7) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(22) |
Dec
(6) |
| 2010 |
Jan
(14) |
Feb
(4) |
Mar
(4) |
Apr
(2) |
May
(3) |
Jun
|
Jul
|
Aug
(7) |
Sep
|
Oct
(2) |
Nov
(39) |
Dec
(3) |
| 2011 |
Jan
(28) |
Feb
(14) |
Mar
(8) |
Apr
(3) |
May
|
Jun
(14) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(3) |
Nov
(4) |
Dec
|
| 2012 |
Jan
(1) |
Feb
(12) |
Mar
(7) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(11) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
(13) |
May
(2) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
(5) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: CVS C. to T. <the...@li...> - 2011-01-27 21:46:56
|
Revision: 620
http://themis.svn.sourceforge.net/themis/?rev=620&view=rev
Author: mark_hellegers
Date: 2011-01-27 21:46:50 +0000 (Thu, 27 Jan 2011)
Log Message:
-----------
- Small bit of refactoring.
- Added support for setting the size of the window in the SiteEntry.
Modified Paths:
--------------
trunk/themis/framework/win.cpp
Modified: trunk/themis/framework/win.cpp
===================================================================
--- trunk/themis/framework/win.cpp 2011-01-27 21:45:37 UTC (rev 619)
+++ trunk/themis/framework/win.cpp 2011-01-27 21:46:50 UTC (rev 620)
@@ -369,20 +369,21 @@
UrlEntry * urlEntry = new UrlEntry(urlId, url.String());
siteEntry->addEntry(urlEntry);
((App *)be_app)->GetSiteHandler()->AddEntry(siteEntry);
-
+
+ ThemisTab * tab = NULL;
if (msg->HasInt32("tab_to_open_in")) {
- int32 tab_index = msg->FindInt32("tab_to_open_in");
- ((ThemisTab *)tabview->TabAt(tab_index))->SetSiteID(siteId);
- // add history entry for tab
- if (msg->HasBool("no_history_add") == false)
- ((ThemisTab *)tabview->TabAt(tab_index))->GetHistory()->AddEntry(url.String());
+ int32 index = msg->FindInt32("tab_to_open_in");
+ tab = (ThemisTab *) tabview->TabAt(index);
}
else {
- ((ThemisTab *)tabview->TabAt(selection))->SetSiteID(siteId);
- // add history entry for tab
- if(msg->HasBool("no_history_add") == false)
- ((ThemisTab *)tabview->TabAt(selection))->GetHistory()->AddEntry(url.String());
+ tab = (ThemisTab *) tabview->TabAt(selection);
}
+ tab->SetSiteID(siteId);
+ // add history entry for tab
+ if(msg->HasBool("no_history_add") == false)
+ tab->GetHistory()->AddEntry(url.String());
+ BRect rect = tabview->Bounds();
+ siteEntry->SetSize(rect.Width() - 2, rect.Height() - 2);
/* add url to global history
* ( You ask, why I am also adding the url on RELOAD, and not only on URL_OPEN?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-27 21:45:43
|
Revision: 619
http://themis.svn.sourceforge.net/themis/?rev=619&view=rev
Author: mark_hellegers
Date: 2011-01-27 21:45:37 +0000 (Thu, 27 Jan 2011)
Log Message:
-----------
Added support for setting and getting the size of the window of the site.
Modified Paths:
--------------
trunk/themis/framework/SiteEntry.cpp
trunk/themis/framework/SiteEntry.h
Modified: trunk/themis/framework/SiteEntry.cpp
===================================================================
--- trunk/themis/framework/SiteEntry.cpp 2011-01-27 21:42:33 UTC (rev 618)
+++ trunk/themis/framework/SiteEntry.cpp 2011-01-27 21:45:37 UTC (rev 619)
@@ -17,6 +17,8 @@
const string kStatusText = "StatusText";
const string kCookiesDisabled = "CookiesDisabled";
const string kFavIcon = "FavIcon";
+const string kWidth = "Width";
+const string kHeight = "Height";
SiteEntry :: SiteEntry(int32 id,
const char * url)
@@ -118,3 +120,17 @@
set(kStatusText, text);
}
+
+void SiteEntry :: SetSize(int width, int height) {
+
+ set(kWidth, width);
+ set(kHeight, height);
+
+}
+
+void SiteEntry :: GetSize(int & width, int & height) {
+
+ width = getInteger(kWidth);
+ height = getInteger(kHeight);
+
+}
Modified: trunk/themis/framework/SiteEntry.h
===================================================================
--- trunk/themis/framework/SiteEntry.h 2011-01-27 21:42:33 UTC (rev 618)
+++ trunk/themis/framework/SiteEntry.h 2011-01-27 21:45:37 UTC (rev 619)
@@ -26,6 +26,8 @@
void SetFavIcon(BBitmap * bmp);
virtual void SetLoadingProgress(int loadingprogress);
void SetStatusText(const char * text);
+ void SetSize(int width, int height);
+ void GetSize(int & width, int & height);
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-27 21:42:39
|
Revision: 618
http://themis.svn.sourceforge.net/themis/?rev=618&view=rev
Author: mark_hellegers
Date: 2011-01-27 21:42:33 +0000 (Thu, 27 Jan 2011)
Log Message:
-----------
Cleaned up the style.
Modified Paths:
--------------
trunk/themis/framework/ThemisTabView.cpp
Modified: trunk/themis/framework/ThemisTabView.cpp
===================================================================
--- trunk/themis/framework/ThemisTabView.cpp 2011-01-16 21:43:37 UTC (rev 617)
+++ trunk/themis/framework/ThemisTabView.cpp 2011-01-27 21:42:33 UTC (rev 618)
@@ -744,45 +744,37 @@
fake_single_view = true;
}
-void
-ThemisTabView::SetNavButtonsByTabHistory()
-{
+void ThemisTabView::SetNavButtonsByTabHistory() {
// printf( "ThemisTabView::SetNavButtonsByTabHistory()\n" );
- ThemisTab* tab = ( ThemisTab* )TabAt( Selection() );
+ ThemisTab* tab = (ThemisTab*)TabAt(Selection());
- ThemisNavView* nv = ( ( Win* )Window() )->GetNavView();
+ ThemisNavView* nv = ((Win*)Window())->GetNavView();
-// printf( "CurrentPosition: %d\n", tab->GetHistory()->GetCurrentPosition() );
+// printf("CurrentPosition: %d\n", tab->GetHistory()->GetCurrentPosition());
tab->GetHistory()->PrintHistory();
- if( tab->GetHistory()->GetCurrentPosition() == 0 )
- {
- if( tab->GetHistory()->GetEntryCount() > 1 )
- {
-// printf( "TABVIEW: enabling back, disabling fwd button if needed.\n" );
- nv->buttons[0]->SetMode( 0 );
- nv->buttons[1]->SetMode( 3 );
+ if (tab->GetHistory()->GetCurrentPosition() == 0) {
+ if (tab->GetHistory()->GetEntryCount() > 1) {
+// printf("TABVIEW: enabling back, disabling fwd button if needed.\n");
+ nv->buttons[0]->SetMode(0);
+ nv->buttons[1]->SetMode(3);
}
- else
- {
+ else {
// printf( "TABVIEW: only one ( or no )history item. disabling back and fwd if needed.\n" );
- nv->buttons[0]->SetMode( 3 );
- nv->buttons[1]->SetMode( 3 );
+ nv->buttons[0]->SetMode(3);
+ nv->buttons[1]->SetMode(3);
}
}
- else
- {
- if( tab->GetHistory()->GetCurrentPosition() == ( tab->GetHistory()->GetEntryCount() - 1 ) )
- {
-// printf( "TABVIEW: at history end. disable back, enable fwd if needed.\n" );
- nv->buttons[0]->SetMode( 3 );
- nv->buttons[1]->SetMode( 0 );
+ else {
+ if (tab->GetHistory()->GetCurrentPosition() == (tab->GetHistory()->GetEntryCount() - 1)) {
+// printf("TABVIEW: at history end. disable back, enable fwd if needed.\n");
+ nv->buttons[0]->SetMode(3);
+ nv->buttons[1]->SetMode(0);
}
- else
- {
-// printf( "TABVIEW: in middle of history. enablind back and fwd if needed.\n" );
- nv->buttons[0]->SetMode( 0 );
- nv->buttons[1]->SetMode( 0 );
+ else {
+// printf("TABVIEW: in middle of history. enabling back and fwd if needed.\n");
+ nv->buttons[0]->SetMode(0);
+ nv->buttons[1]->SetMode(0);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 21:43:43
|
Revision: 617
http://themis.svn.sourceforge.net/themis/?rev=617&view=rev
Author: mark_hellegers
Date: 2011-01-16 21:43:37 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Fixed the reading of the tab history depth setting.
Modified Paths:
--------------
trunk/themis/framework/ThemisTab.cpp
Modified: trunk/themis/framework/ThemisTab.cpp
===================================================================
--- trunk/themis/framework/ThemisTab.cpp 2011-01-16 19:20:14 UTC (rev 616)
+++ trunk/themis/framework/ThemisTab.cpp 2011-01-16 21:43:37 UTC (rev 617)
@@ -29,7 +29,7 @@
fLabel = new BString( "(untitled)" );
int8 histdepth;
- AppSettings->FindInt8( "TabHistoryDepth", &histdepth );
+ AppSettings->FindInt8("PrefsTabHistoryDepth", &histdepth);
fHistory = new TabHistory( histdepth );
fFavIcon = new BBitmap( BRect( 0, 0, 15, 15 ), B_RGB32 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 19:20:20
|
Revision: 616
http://themis.svn.sourceforge.net/themis/?rev=616&view=rev
Author: mark_hellegers
Date: 2011-01-16 19:20:14 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Removed debugging output I accidentally left in.
Modified Paths:
--------------
trunk/themis/framework/win.cpp
Modified: trunk/themis/framework/win.cpp
===================================================================
--- trunk/themis/framework/win.cpp 2011-01-16 16:51:44 UTC (rev 615)
+++ trunk/themis/framework/win.cpp 2011-01-16 19:20:14 UTC (rev 616)
@@ -194,8 +194,6 @@
void Win :: MessageReceived(BMessage * msg) {
- msg->PrintToStream();
-
switch (msg->what) {
case B_ABOUT_REQUESTED: {
be_app_messenger.SendMessage(B_ABOUT_REQUESTED);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 16:51:50
|
Revision: 615
http://themis.svn.sourceforge.net/themis/?rev=615&view=rev
Author: mark_hellegers
Date: 2011-01-16 16:51:44 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Added private variable to store the parent of a BaseEntry and fill it in when adding an entry.
Modified Paths:
--------------
trunk/themis/common/BaseEntry.cpp
trunk/themis/common/BaseEntry.hpp
Modified: trunk/themis/common/BaseEntry.cpp
===================================================================
--- trunk/themis/common/BaseEntry.cpp 2011-01-16 16:16:14 UTC (rev 614)
+++ trunk/themis/common/BaseEntry.cpp 2011-01-16 16:51:44 UTC (rev 615)
@@ -39,6 +39,7 @@
BaseEntry :: BaseEntry(int32 aId) {
fId = aId;
+ fParent = NULL;
}
@@ -59,6 +60,7 @@
void BaseEntry :: addEntry(BaseEntry * aEntry) {
+ aEntry->setParent(this);
fChildEntries.push_back(aEntry);
}
@@ -85,6 +87,18 @@
return result;
}
+void BaseEntry :: setParent(BaseEntry * aParent) {
+
+ fParent = aParent;
+
+}
+
+BaseEntry * BaseEntry :: getParent() {
+
+ return fParent;
+
+}
+
void BaseEntry :: set(const string aName, const char * aValue) {
if (mStrings.count(aName) == 0) {
Modified: trunk/themis/common/BaseEntry.hpp
===================================================================
--- trunk/themis/common/BaseEntry.hpp 2011-01-16 16:16:14 UTC (rev 614)
+++ trunk/themis/common/BaseEntry.hpp 2011-01-16 16:51:44 UTC (rev 615)
@@ -63,6 +63,7 @@
private:
int32 fId;
+ BaseEntry * fParent;
map<string, string> mStrings;
map<string, bool> mBooleans;
@@ -79,6 +80,8 @@
int32 getId() const;
void addEntry(BaseEntry * aEntry);
BaseEntry * getEntry(int32 aId);
+ void setParent(BaseEntry * aParent);
+ BaseEntry * getParent();
void set(const string aName, const char * aValue);
void set(const string aName, const string aValue);
void set(const string aName, const bool aValue);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 16:16:23
|
Revision: 614
http://themis.svn.sourceforge.net/themis/?rev=614&view=rev
Author: mark_hellegers
Date: 2011-01-16 16:16:14 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
- Now passing the renderview pointer using a BaseEntry.
- Removed the RENDERVIEW_POINTER message and just used the existing SH_RENDER_FINISHED message.
- Cleaned up the code a bit.
Modified Paths:
--------------
trunk/themis/common/commondefs.h
trunk/themis/framework/win.cpp
trunk/themis/modules/Renderer/TRenderer.cpp
trunk/themis/modules/Renderer/TRenderer.h
trunk/themis/modules/Renderer/TRendererEngine.cpp
Modified: trunk/themis/common/commondefs.h
===================================================================
--- trunk/themis/common/commondefs.h 2011-01-16 15:01:15 UTC (rev 613)
+++ trunk/themis/common/commondefs.h 2011-01-16 16:16:14 UTC (rev 614)
@@ -207,10 +207,6 @@
#define HTTP_DELETE_REQUEST 'dele'
#define HTTP_HEAD_REQUEST 'head'
-// Renderer message constants
-// Only renderer plugins should send these.
-#define RENDERVIEW_POINTER 'rwpr'
-
//union int32torgb
//{
// int32 value;
Modified: trunk/themis/framework/win.cpp
===================================================================
--- trunk/themis/framework/win.cpp 2011-01-16 15:01:15 UTC (rev 613)
+++ trunk/themis/framework/win.cpp 2011-01-16 16:16:14 UTC (rev 614)
@@ -936,32 +936,42 @@
switch (command) {
case COMMAND_INFO: {
switch (message->what) {
- case RENDERVIEW_POINTER: {
+ case SH_RENDER_FINISHED: {
int32 site_id = 0;
message->FindInt32("site_id", &site_id);
if (site_id != 0) {
int32 tabindex;
ThemisTab * tab = FindTabFor(site_id, &tabindex);
if (tab != NULL) {
- BView * renderview = NULL;
- message->FindPointer("renderview_pointer", (void**)&renderview);
- if (renderview != NULL) {
- /* Attach the renderview to the correct tab. */
- Lock();
- /*
- * We don't need to resize the renderview here, as this is done in
- * ThemisTabView::Select().
- */
- tabview->TabAt(tabindex)->SetView(renderview);
-
- if (tabview->Selection() == tabindex) {
- tabview->Select(tabindex);
-
- if (CurrentFocus() != NULL)
- CurrentFocus()->MakeFocus(false);
- tabview->TabAt(tabindex)->View()->MakeFocus(true);
+ SiteHandler * sh = ((App *)be_app)->GetSiteHandler();
+ if (sh) {
+ SiteEntry * site = sh->GetEntry(site_id);
+ int32 viewId = 0;
+ message->FindInt32("view_id", &viewId);
+ if (viewId != 0) {
+ BaseEntry * entry = site->getEntry(viewId);
+ if (entry != NULL) {
+ BView * renderview = (BView *) entry->getPointer("render_view");
+ if (renderview != NULL) {
+ /* Attach the renderview to the correct tab. */
+ Lock();
+ /*
+ * We don't need to resize the renderview here, as this is done in
+ * ThemisTabView::Select().
+ */
+ tabview->TabAt(tabindex)->SetView(renderview);
+
+ if (tabview->Selection() == tabindex) {
+ tabview->Select(tabindex);
+
+ if (CurrentFocus() != NULL)
+ CurrentFocus()->MakeFocus(false);
+ tabview->TabAt(tabindex)->View()->MakeFocus(true);
+ }
+ Unlock();
+ }
+ }
}
- Unlock();
}
}
}
Modified: trunk/themis/modules/Renderer/TRenderer.cpp
===================================================================
--- trunk/themis/modules/Renderer/TRenderer.cpp 2011-01-16 15:01:15 UTC (rev 613)
+++ trunk/themis/modules/Renderer/TRenderer.cpp 2011-01-16 16:16:14 UTC (rev 614)
@@ -133,12 +133,16 @@
BString typeOfDocument;
message->FindString("type", &typeOfDocument);
if (typeOfDocument == "dom") {
- int32 siteId = message->FindInt32("site_id");
+ int32 siteId = 0;
+ message->FindInt32("site_id", &siteId);
SiteEntry * site = ((App *)be_app)->GetSiteHandler()->GetEntry(siteId);
if (site != NULL) {
- int32 domId = message->FindInt32("dom_id");
+ int32 domId = 0;
+ message->FindInt32("dom_id", &domId);
DOMEntry * entry = (DOMEntry *) site->getEntry(domId);
if (entry != NULL) {
+ int32 urlId = 0;
+ message->FindInt32("url_id", &urlId);
TDocumentPtr document = entry->getDocument();
DOMTrees.push_back(document);
//Start Processing in a new thread
@@ -147,7 +151,8 @@
param->document = document;
param->renderer = this;
param->siteID = siteId;
- param->urlID = message->FindInt32("url_id");
+ param->urlID = urlId;
+ param->domID = domId;
//feeding the random generator
srand(time(NULL));
thread_id id = spawn_thread(PreProcess,THREAD_NAME[rand()%THREAD_NAMES],30,(void *)param);
Modified: trunk/themis/modules/Renderer/TRenderer.h
===================================================================
--- trunk/themis/modules/Renderer/TRenderer.h 2011-01-16 15:01:15 UTC (rev 613)
+++ trunk/themis/modules/Renderer/TRenderer.h 2011-01-16 16:16:14 UTC (rev 614)
@@ -59,6 +59,7 @@
Renderer *renderer;
int32 siteID;
int32 urlID;
+ int32 domID;
};
struct processing_context {
@@ -100,8 +101,6 @@
BList UITrees;
vector <TDocumentPtr> DOMTrees;
- void BroadcastPointer(TRenderView *view);
-
//Below spreads the dark land of Processing methods.
//Because it's a thread_func it has to be static int32 with a single void param
Modified: trunk/themis/modules/Renderer/TRendererEngine.cpp
===================================================================
--- trunk/themis/modules/Renderer/TRendererEngine.cpp 2011-01-16 15:01:15 UTC (rev 613)
+++ trunk/themis/modules/Renderer/TRendererEngine.cpp 2011-01-16 16:16:14 UTC (rev 614)
@@ -29,6 +29,11 @@
#include <Alert.h>
#include <Screen.h>
+// Themis headers
+#include "framework/app.h"
+#include "framework/SiteHandler.h"
+#include "BaseEntry.hpp"
+
//General
#include "CSS_HTM.h"
#include "CSS_Units.h"
@@ -41,16 +46,6 @@
#define GET_ATTRIBUTE_VALUE(attribute,default_value) (attribute.get() != NULL) ? attribute->getNodeValue().c_str() : default_value;
-void Renderer::BroadcastPointer(TRenderView *view)
-{
- //Do the Broadcasting
- BMessage message(RENDERVIEW_POINTER);
- message.AddInt32("command",COMMAND_INFO);
- message.AddString("type","TRenderView");
- message.AddPointer("data_pointer",view);
- Broadcast(MS_TARGET_ALL,&message);
-}
-
int32 Renderer::PreProcess(void *data)
{
preprocess_thread_param *cdata = (preprocess_thread_param *)data;
@@ -89,27 +84,27 @@
//Save the BMessenger to userIntterface
//view->userInterface = userInterface;
- //Do the Broadcasting to give the view to the UI
- BMessage *message = new BMessage(RENDERVIEW_POINTER);
- message->AddInt32("command",COMMAND_INFO);
- message->AddInt32("site_id",view->siteID);
- message->AddInt32("url_id",view->urlID);
- message->AddPointer("renderview_pointer",(void *)view);
- cdata->renderer->Broadcast(MS_TARGET_ALL,message);
-
//Start processing the DOM Tree
printf("RENDERER: START PROCESSING...\n");
processing_context context;
bigtime_t time = real_time_clock_usecs();
cdata->renderer->Process(cdata->document,view,context);
printf("RENDERER: DONE PROCESSING in %lld microseconds.\n",real_time_clock_usecs() - time);
-
- //Do the Broadcasting to say we are done rendering
- message->what = SH_RENDER_FINISHED;
- message->RemoveName("renderview_pointer");
- cdata->renderer->Broadcast(MS_TARGET_SITEHANDLER,message);
-
+ /* Get an unique ID from the app for the DOM entry */
+ int32 viewId = ((App *)be_app)->GetNewID();
+ BaseEntry * entry = new BaseEntry(viewId);
+ entry->set("render_view", (void *) view);
+ ((App *)be_app)->GetSiteHandler()->AddEntry(entry, view->siteID, cdata->domID);
+
+ //Do the Broadcasting to give the view to the UI
+ BMessage *message = new BMessage(SH_RENDER_FINISHED);
+ message->AddInt32("command",COMMAND_INFO);
+ message->AddInt32("site_id",view->siteID);
+ message->AddInt32("url_id",view->urlID);
+ message->AddInt32("view_id",viewId);
+ cdata->renderer->Broadcast(MS_TARGET_ALL,message);
+
//Update the view
//cdata->view->Invalidate();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 15:01:21
|
Revision: 613
http://themis.svn.sourceforge.net/themis/?rev=613&view=rev
Author: mark_hellegers
Date: 2011-01-16 15:01:15 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Moved the code to get the checkbox value to a separate function.
Modified Paths:
--------------
trunk/themis/framework/PrefsWin.cpp
trunk/themis/framework/PrefsWin.h
Modified: trunk/themis/framework/PrefsWin.cpp
===================================================================
--- trunk/themis/framework/PrefsWin.cpp 2011-01-16 14:47:04 UTC (rev 612)
+++ trunk/themis/framework/PrefsWin.cpp 2011-01-16 15:01:15 UTC (rev 613)
@@ -90,6 +90,18 @@
}
+bool PrefsWin :: GetCheckBoxValue(BMessage * aMessage) {
+
+ BCheckBox * checkBox;
+ aMessage->FindPointer("source", (void**)&checkBox);
+ bool result = false;
+ if(checkBox->Value() == 1)
+ result = true;
+
+ return result;
+
+}
+
void PrefsWin :: CreatePrefViews(BMessage * aPluginList) {
printf("Creating preferences views\n");
@@ -184,12 +196,7 @@
case IZ_CHECKBOX: {
printf("PREFS: IZ_CHECKBOX\n");
- BCheckBox* cbox;
- msg->FindPointer("source", ( void** )&cbox);
- bool value = false;
- if(cbox->Value() == 1)
- value = true;
-
+ bool value = GetCheckBoxValue(msg);
AppSettings->ReplaceBool(kPrefsIntelligentZoom, value);
SaveAppSettings();
@@ -200,12 +207,7 @@
{
printf("PREFS: SHOWTYPEAHEAD_CHECKBOX\n");
- BCheckBox* cbox;
- msg->FindPointer("source", ( void** )&cbox);
- bool value = false;
- if(cbox->Value() == 1)
- value = true;
-
+ bool value = GetCheckBoxValue(msg);
AppSettings->ReplaceBool(kPrefsShowTypeAheadWindow, value);
SaveAppSettings();
@@ -215,12 +217,7 @@
case SHOWTABS_CHECKBOX: {
printf("PREFS: SHOWTABS_CHECKBOX\n");
- BCheckBox* cbox;
- msg->FindPointer("source", ( void** )&cbox);
- bool value = false;
- if(cbox->Value() == 1)
- value = true;
-
+ bool value = GetCheckBoxValue(msg);
AppSettings->ReplaceBool(kPrefsShowTabsAtStartup, value);
SaveAppSettings();
@@ -230,12 +227,7 @@
case TABSBACKGROUND_CHECKBOX: {
printf("PREFS: TABSBACKGROUND_CHECKBOX\n");
- BCheckBox* cbox;
- msg->FindPointer("source", ( void** )&cbox);
- bool value = false;
- if(cbox->Value() == 1)
- value = true;
-
+ bool value = GetCheckBoxValue(msg);
AppSettings->ReplaceBool(kPrefsOpenTabsInBackground, value);
SaveAppSettings();
@@ -245,12 +237,7 @@
case TABSBLANK_CHECKBOX: {
printf("PREFS: TABSBACKGROUND_CHECKBOX\n");
- BCheckBox* cbox;
- msg->FindPointer("source", ( void** )&cbox);
- bool value = false;
- if(cbox->Value() == 1)
- value = true;
-
+ bool value = GetCheckBoxValue(msg);
AppSettings->ReplaceBool(kPrefsOpenBlankTargetInTab, value);
SaveAppSettings();
Modified: trunk/themis/framework/PrefsWin.h
===================================================================
--- trunk/themis/framework/PrefsWin.h 2011-01-16 14:47:04 UTC (rev 612)
+++ trunk/themis/framework/PrefsWin.h 2011-01-16 15:01:15 UTC (rev 613)
@@ -29,6 +29,7 @@
BRect fViewFrame;
vector<BView *> mPrefViews;
+ bool GetCheckBoxValue(BMessage * aMessage);
void CreatePrefViews(BMessage * aPluginList);
void SaveAppSettings();
@@ -89,7 +90,7 @@
const char * fName;
BBitmap * fBitmap;
float fFontHeight;
-
+
public:
PrefsListItem(const char* name,
const uint8* bitmapdata);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 14:47:11
|
Revision: 612
http://themis.svn.sourceforge.net/themis/?rev=612&view=rev
Author: mark_hellegers
Date: 2011-01-16 14:47:04 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
- Added CSSDOMEntry class and converted the CSSParser and CSSViewer to use it.
- Cleaned up the code a bit.
Modified Paths:
--------------
trunk/themis/makefile
trunk/themis/modules/CSSParser/CSSParserPlugin.cpp
trunk/themis/modules/CSSParser/CSSParserPlugin.hpp
trunk/themis/modules/CSSViewer/CSSViewer.cpp
Added Paths:
-----------
trunk/themis/common/CSSDOMEntry.cpp
trunk/themis/common/CSSDOMEntry.hpp
Added: trunk/themis/common/CSSDOMEntry.cpp
===================================================================
--- trunk/themis/common/CSSDOMEntry.cpp (rev 0)
+++ trunk/themis/common/CSSDOMEntry.cpp 2011-01-16 14:47:04 UTC (rev 612)
@@ -0,0 +1,54 @@
+/*
+ Copyright (c) 2011 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: January 16, 2011
+*/
+
+/* CSSDOMEntry implementation
+ See CSSDOMEntry.hpp for more information
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// SGMLParser headers
+#include "CSSDOMEntry.hpp"
+
+// Constants declared
+const string kCSSStyleSheet = "CSS Stylesheet";
+
+CSSDOMEntry :: CSSDOMEntry(int32 aId, CSSStyleSheetPtr aStyleSheet)
+ : BaseEntry(aId) {
+
+ set(kCSSStyleSheet, shared_static_cast<void>(aStyleSheet));
+
+}
+
+CSSStyleSheetPtr CSSDOMEntry :: getStyleSheet() {
+
+ return shared_static_cast<CSSStyleSheet>(getSharedPtr(kCSSStyleSheet));
+}
Added: trunk/themis/common/CSSDOMEntry.hpp
===================================================================
--- trunk/themis/common/CSSDOMEntry.hpp (rev 0)
+++ trunk/themis/common/CSSDOMEntry.hpp 2011-01-16 14:47:04 UTC (rev 612)
@@ -0,0 +1,49 @@
+/*
+ Copyright (c) 2011 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: January 16, 2011
+*/
+
+#ifndef CSSDOMENTRY_HPP
+#define CSSDOMENTRY_HPP
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+
+// Themis headers
+#include "BaseEntry.hpp"
+
+class CSSDOMEntry : public BaseEntry {
+
+ public:
+ CSSDOMEntry(int32 aId, CSSStyleSheetPtr aStyleSheet);
+
+ CSSStyleSheetPtr getStyleSheet();
+
+};
+
+#endif
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2011-01-16 14:35:13 UTC (rev 611)
+++ trunk/themis/makefile 2011-01-16 14:47:04 UTC (rev 612)
@@ -120,7 +120,8 @@
common/prefsman.cpp \
common/BasePrefsView.cpp \
common/BaseEntry.cpp \
- common/DOMEntry.cpp
+ common/DOMEntry.cpp \
+ common/CSSDOMEntry.cpp
#add similar lines for new plugins, libraries, etc.
HTTPADDONSOURCES= \
http/optionshandler.cpp \
@@ -541,11 +542,11 @@
$(COMMON_DEPENDS_DIR)%.d: common/%.cpp
@echo "Common: Updating dependency file $(notdir $@)"
- @set -e;VAR1=$(shell echo "$(COMMON_DEPENDS_DIR)$(notdir $@)"|sed 's/\//\\\//g');VAR2=$(shell echo "$(COMMON_OBJECT_DIR)"|sed 's/\//\\\//g'); $(CC) -Icommon -I./ -Iframework/DOM -M $(CPPFLAGS) $< | sed 's/\($*\)\.o[ :]*/objects\/common\/\1.o depends\/common\/\1.d : /g' > $@;[ -s $@ ] || rm -f $@
+ @set -e;VAR1=$(shell echo "$(COMMON_DEPENDS_DIR)$(notdir $@)"|sed 's/\//\\\//g');VAR2=$(shell echo "$(COMMON_OBJECT_DIR)"|sed 's/\//\\\//g'); $(CC) -Icommon -I./ -Iframework/DOM -Iframework/DOMStyle -M $(CPPFLAGS) $< | sed 's/\($*\)\.o[ :]*/objects\/common\/\1.o depends\/common\/\1.d : /g' > $@;[ -s $@ ] || rm -f $@
$(COMMON_OBJECT_DIR)%.o: common/%.cpp $(COMMON_DEPENDS_DIR)%.d
@echo "Common: Updating object file $(notdir $@)"
- @$(CC) $(CFLAGS) $(COMPILE_FLAGS) -Icommon -I./ -Iframework/DOM -c $< -o $@
+ @$(CC) $(CFLAGS) $(COMPILE_FLAGS) -Icommon -I./ -Iframework/DOM -Iframework/DOMStyle -c $< -o $@
#renderer
Modified: trunk/themis/modules/CSSParser/CSSParserPlugin.cpp
===================================================================
--- trunk/themis/modules/CSSParser/CSSParserPlugin.cpp 2011-01-16 14:35:13 UTC (rev 611)
+++ trunk/themis/modules/CSSParser/CSSParserPlugin.cpp 2011-01-16 14:47:04 UTC (rev 612)
@@ -48,9 +48,12 @@
#include <storage/Directory.h>
// Themis headers
+#include "framework/app.h"
+#include "framework/SiteHandler.h"
#include "commondefs.h"
#include "plugman.h"
#include "PrefsDefs.h"
+#include "CSSDOMEntry.hpp"
// CSSParser headers
#include "CSSParserPlugin.hpp"
@@ -208,21 +211,28 @@
}
-void CSSParserPlugin :: NotifyParseFinished(void * aDocument,
+void CSSParserPlugin :: NotifyParseFinished(CSSStyleSheetPtr aStyleSheet,
string aType,
BMessage * aOriginalMessage) {
- int32 siteID = 0;
- int32 urlID = 0;
- aOriginalMessage->FindInt32("site_id", &siteID);
- aOriginalMessage->FindInt32("url_id", &urlID);
+ int32 siteId = 0;
+ int32 urlId = 0;
+ int32 domId = 0;
+ aOriginalMessage->FindInt32("site_id", &siteId);
+ aOriginalMessage->FindInt32("url_id", &urlId);
+ aOriginalMessage->FindInt32("dom_id", &domId);
+ /* Get an unique ID from the app for the DOM entry */
+ int32 cssId = ((App *)be_app)->GetNewID();
+ CSSDOMEntry * entry = new CSSDOMEntry(cssId, aStyleSheet);
+ ((App *)be_app)->GetSiteHandler()->AddEntry(entry, siteId, domId);
+
BMessage * done = new BMessage(SH_PARSE_DOC_FINISHED);
done->AddInt32("command", COMMAND_INFO);
done->AddString("type", aType.c_str());
- done->AddPointer("pointer", aDocument);
- done->AddInt32("site_id", siteID);
- done->AddInt32("url_id", urlID);
+ done->AddInt32("site_id", siteId);
+ done->AddInt32("url_id", urlId);
+ done->AddInt32("cssdom_id", cssId);
// Message created. Broadcast it.
Broadcast(MS_TARGET_ALL, done);
@@ -232,57 +242,6 @@
}
-void CSSParserPlugin :: ParseDocument(string aURL,
- BMessage * aOriginalMessage) {
-
- if (CacheRegistered()) {
- int32 fileToken = mCache->FindObject(mUserToken, aURL.c_str());
- ssize_t fileSize = mCache->GetObjectSize(mUserToken, fileToken);
-
- if (fileSize == 0) {
- Debug("Requested file is 0 bytes long. Aborting parse", PlugID());
- }
- else {
- // Read the file and parse it.
- const unsigned int BUFFER_SIZE = 2000;
- string content = "";
- char * buffer = new char[BUFFER_SIZE];
- ssize_t bytesRead = 0;
- int totalBytes = 0;
- bool foundData = true;
- while (foundData) {
- if (totalBytes > fileSize) {
- foundData = false;
- printf("Reading more bytes than possible. Skipping last buffer\n");
- }
- else {
- bytesRead = mCache->Read(mUserToken, fileToken, buffer, BUFFER_SIZE);
- if (bytesRead > 0) {
- content += buffer;
- memset(buffer, 0, BUFFER_SIZE);
- totalBytes += bytesRead;
- }
- else {
- foundData = false;
- }
- }
- }
- delete[] buffer;
-
- // Parse it
- if (content.size() != 0) {
- mParser->parse(content);
-
- NotifyParseFinished(mDocuments.end() - 1, "cssdom", aOriginalMessage);
- }
- }
- }
- else {
- printf("Not registered with the cache. Nothing to do\n");
- }
-
-}
-
void CSSParserPlugin :: MessageReceived(BMessage * aMessage) {
switch (aMessage->what) {
@@ -297,7 +256,7 @@
Debug(cssLoad.c_str(), PlugID());
CSSStyleSheetPtr document = mParser->parse(path);
mDocuments.push_back(document);
- NotifyParseFinished(mDocuments.end() - 1, "cssdom", aMessage);
+ NotifyParseFinished(document, "cssdom", aMessage);
}
break;
}
@@ -394,9 +353,14 @@
Debug(cssLoad.c_str(), PlugID());
CSSStyleSheetPtr document = mParser->parse(path);
mDocuments.push_back(document);
- NotifyParseFinished(mDocuments.end() - 1, "cssdom", aMessage);
+ NotifyParseFinished(document, "cssdom", aMessage);
}
}
+ else {
+ // Assuming the default stylesheet is parsed first!!!
+ CSSStyleSheetPtr document = mDocuments[0];
+ NotifyParseFinished(document, "cssdom", aMessage);
+ }
}
}
}
Modified: trunk/themis/modules/CSSParser/CSSParserPlugin.hpp
===================================================================
--- trunk/themis/modules/CSSParser/CSSParserPlugin.hpp 2011-01-16 14:35:13 UTC (rev 611)
+++ trunk/themis/modules/CSSParser/CSSParserPlugin.hpp 2011-01-16 14:47:04 UTC (rev 612)
@@ -90,12 +90,9 @@
// Function to check if the document is a supported one.
bool IsDocumentSupported(BMessage * aMessage);
// Function to notify plugins that parsing is finished.
- void NotifyParseFinished(void * aDocument,
+ void NotifyParseFinished(CSSStyleSheetPtr aStyleSheet,
string aType,
BMessage * aOriginalMessage);
- // Function to parse a document.
- void ParseDocument(string aURL,
- BMessage * aOriginalMessage);
public:
CSSParserPlugin(BMessage * aInfo = NULL);
Modified: trunk/themis/modules/CSSViewer/CSSViewer.cpp
===================================================================
--- trunk/themis/modules/CSSViewer/CSSViewer.cpp 2011-01-16 14:35:13 UTC (rev 611)
+++ trunk/themis/modules/CSSViewer/CSSViewer.cpp 2011-01-16 14:47:04 UTC (rev 612)
@@ -47,6 +47,10 @@
#include <Autolock.h>
// Themis headers
+#include "framework/app.h"
+#include "framework/SiteHandler.h"
+#include "framework/SiteEntry.h"
+#include "CSSDOMEntry.hpp"
#include "commondefs.h"
CSSViewer * viewer;
@@ -137,7 +141,7 @@
float CSSViewer :: PlugVersion() {
- return 0.1;
+ return 0.2;
}
@@ -150,25 +154,28 @@
int32 command = 0;
aMessage->FindInt32("command", &command);
- switch ( command ) {
- case COMMAND_INFO: {
+ switch (command) {
+ case COMMAND_INFO: {
// Check if it is css dom data
- BString type;
- aMessage->FindString("type", &type);
- if ( type == "cssdom" ) {
- // Get the pointer out
- void * document = NULL;
- aMessage->FindPointer("pointer", &document);
- if (document) {
- CSSStyleSheetPtr * temp = (CSSStyleSheetPtr *) document;
- if (!mView) {
- mView = new CSSView(*temp);
- }
- else {
- BAutolock viewLock(mView);
- if (viewLock.IsLocked()) {
- mView->SetStyleSheet(*temp);
+ BString typeOfDocument;
+ aMessage->FindString("type", &typeOfDocument);
+ if (typeOfDocument == "cssdom") {
+ int32 siteId = aMessage->FindInt32("site_id");
+ SiteEntry * site = ((App *)be_app)->GetSiteHandler()->GetEntry(siteId);
+ if (site != NULL) {
+ int32 cssId = aMessage->FindInt32("cssdom_id");
+ CSSDOMEntry * entry = (CSSDOMEntry *) site->getEntry(cssId);
+ if (entry != NULL) {
+ CSSStyleSheetPtr document = entry->getStyleSheet();
+ if (!mView) {
+ mView = new CSSView(document);
}
+ else {
+ BAutolock viewLock(mView);
+ if (viewLock.IsLocked()) {
+ mView->SetStyleSheet(document);
+ }
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 14:35:21
|
Revision: 611
http://themis.svn.sourceforge.net/themis/?rev=611&view=rev
Author: mark_hellegers
Date: 2011-01-16 14:35:13 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Moved include to the right part.
Modified Paths:
--------------
trunk/themis/modules/HTMLParser/HTMLParser.cpp
Modified: trunk/themis/modules/HTMLParser/HTMLParser.cpp
===================================================================
--- trunk/themis/modules/HTMLParser/HTMLParser.cpp 2011-01-16 14:09:08 UTC (rev 610)
+++ trunk/themis/modules/HTMLParser/HTMLParser.cpp 2011-01-16 14:35:13 UTC (rev 611)
@@ -18,7 +18,6 @@
// HTMLParser headers
#include "HTMLParser.h"
-#include "DOMEntry.hpp"
// DOM headers
#include "TDocument.h"
@@ -35,6 +34,7 @@
#include "commondefs.h"
#include "plugman.h"
#include "PrefsDefs.h"
+#include "DOMEntry.hpp"
HTMLParser * parser;
BMessage ** appSettings_p;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 14:09:14
|
Revision: 610
http://themis.svn.sourceforge.net/themis/?rev=610&view=rev
Author: mark_hellegers
Date: 2011-01-16 14:09:08 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Moved sending message to open a new url to its own function.
Modified Paths:
--------------
trunk/themis/framework/win.cpp
trunk/themis/framework/win.h
Modified: trunk/themis/framework/win.cpp
===================================================================
--- trunk/themis/framework/win.cpp 2011-01-16 13:54:14 UTC (rev 609)
+++ trunk/themis/framework/win.cpp 2011-01-16 14:09:08 UTC (rev 610)
@@ -162,6 +162,19 @@
}
+void Win :: SendUrlOpenMessage(const char * aUrl, bool aAddToHistory) {
+
+ BMessage * message = new BMessage(URL_OPEN);
+ message->AddString("url_to_open", aUrl);
+ if (!aAddToHistory) {
+ message->AddBool("no_history_add", true);
+ }
+ BMessenger msgr(this);
+ msgr.SendMessage(message);
+ delete message;
+
+}
+
bool Win :: QuitRequested() {
if (fQuitConfirmed == false) {
@@ -181,6 +194,8 @@
void Win :: MessageReceived(BMessage * msg) {
+ msg->PrintToStream();
+
switch (msg->what) {
case B_ABOUT_REQUESTED: {
be_app_messenger.SendMessage(B_ABOUT_REQUESTED);
@@ -221,13 +236,7 @@
const char * previous = NULL;
previous = ((ThemisTab *)tabview->TabAt(tabview->Selection()))->GetHistory()->GetPreviousEntry();
if (previous != NULL) {
- BMessage * backmsg = new BMessage(URL_OPEN);
- backmsg->AddString("url_to_open", previous);
- backmsg->AddBool("no_history_add", true);
- BMessenger * msgr = new BMessenger(this);
- msgr->SendMessage(backmsg);
- delete backmsg;
- delete msgr;
+ SendUrlOpenMessage(previous, false);
}
break;
}
@@ -235,13 +244,7 @@
const char * next = NULL;
next = ((ThemisTab *)tabview->TabAt(tabview->Selection()))->GetHistory()->GetNextEntry();
if (next != NULL) {
- BMessage * fwdmsg = new BMessage(URL_OPEN);
- fwdmsg->AddString("url_to_open", next);
- fwdmsg->AddBool("no_history_add", true);
- BMessenger* msgr = new BMessenger(this);
- msgr->SendMessage(fwdmsg);
- delete fwdmsg;
- delete msgr;
+ SendUrlOpenMessage(next, false);
}
else
{
@@ -255,14 +258,7 @@
case BUTTON_HOME: {
BString homepage;
AppSettings->FindString(kPrefsHomePage, &homepage);
-
- BMessage * homemsg = new BMessage(URL_OPEN);
- homemsg->AddString("url_to_open", homepage.String());
- BMessenger * msgr = new BMessenger(this);
- msgr->SendMessage(homemsg);
- delete homemsg;
- delete msgr;
-
+ SendUrlOpenMessage(homepage.String());
break;
}
case CLOSE_OTHER_TABS: {
Modified: trunk/themis/framework/win.h
===================================================================
--- trunk/themis/framework/win.h 2011-01-16 13:54:14 UTC (rev 609)
+++ trunk/themis/framework/win.h 2011-01-16 14:09:08 UTC (rev 610)
@@ -68,6 +68,8 @@
ThemisTabView * tabview;
ThemisStatusView * statusview;
BBitmap * bitmaps[10];
+
+ void SendUrlOpenMessage(const char * aUrl, bool aAddToHistory = true);
public:
Win(BRect frame,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 13:54:20
|
Revision: 609
http://themis.svn.sourceforge.net/themis/?rev=609&view=rev
Author: mark_hellegers
Date: 2011-01-16 13:54:14 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Converted the break code to if !=, so it is easier to see how the code flows.
Modified Paths:
--------------
trunk/themis/framework/win.cpp
Modified: trunk/themis/framework/win.cpp
===================================================================
--- trunk/themis/framework/win.cpp 2011-01-16 13:45:17 UTC (rev 608)
+++ trunk/themis/framework/win.cpp 2011-01-16 13:54:14 UTC (rev 609)
@@ -943,35 +943,32 @@
case RENDERVIEW_POINTER: {
int32 site_id = 0;
message->FindInt32("site_id", &site_id);
- if (site_id == 0)
- break;
-
- int32 tabindex;
- ThemisTab * tab = FindTabFor(site_id, &tabindex);
- if (tab == NULL)
- break;
-
- BView * renderview = NULL;
- message->FindPointer("renderview_pointer", (void**)&renderview);
- if (renderview == NULL)
- break;
-
- /* Attach the renderview to the correct tab. */
- Lock();
- /*
- * We don't need to resize the renderview here, as this is done in
- * ThemisTabView::Select().
- */
- tabview->TabAt(tabindex)->SetView(renderview);
-
- if (tabview->Selection() == tabindex) {
- tabview->Select(tabindex);
-
- if (CurrentFocus() != NULL)
- CurrentFocus()->MakeFocus(false);
- tabview->TabAt(tabindex)->View()->MakeFocus(true);
+ if (site_id != 0) {
+ int32 tabindex;
+ ThemisTab * tab = FindTabFor(site_id, &tabindex);
+ if (tab != NULL) {
+ BView * renderview = NULL;
+ message->FindPointer("renderview_pointer", (void**)&renderview);
+ if (renderview != NULL) {
+ /* Attach the renderview to the correct tab. */
+ Lock();
+ /*
+ * We don't need to resize the renderview here, as this is done in
+ * ThemisTabView::Select().
+ */
+ tabview->TabAt(tabindex)->SetView(renderview);
+
+ if (tabview->Selection() == tabindex) {
+ tabview->Select(tabindex);
+
+ if (CurrentFocus() != NULL)
+ CurrentFocus()->MakeFocus(false);
+ tabview->TabAt(tabindex)->View()->MakeFocus(true);
+ }
+ Unlock();
+ }
+ }
}
- Unlock();
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 13:45:23
|
Revision: 608
http://themis.svn.sourceforge.net/themis/?rev=608&view=rev
Author: mark_hellegers
Date: 2011-01-16 13:45:17 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
SiteEntry now derives from UrlEntry.
Modified Paths:
--------------
trunk/themis/framework/SiteEntry.cpp
trunk/themis/framework/SiteEntry.h
trunk/themis/framework/UrlEntry.h
Modified: trunk/themis/framework/SiteEntry.cpp
===================================================================
--- trunk/themis/framework/SiteEntry.cpp 2011-01-16 13:40:37 UTC (rev 607)
+++ trunk/themis/framework/SiteEntry.cpp 2011-01-16 13:45:17 UTC (rev 608)
@@ -14,36 +14,19 @@
#include "UrlEntry.h"
// Constants declared
-const string kUrl = "Url";
-const string kTitle = "Title";
const string kStatusText = "StatusText";
-const string kSecureConnection = "SecureConnection";
const string kCookiesDisabled = "CookiesDisabled";
-const string kLoadingProgress = "LoadingProgress";
const string kFavIcon = "FavIcon";
SiteEntry :: SiteEntry(int32 id,
- const char * url) : BaseEntry(id) {
+ const char * url)
+ : UrlEntry(id, url) {
- set(kLoadingProgress, -1);
- set(kUrl, url);
-
string statusText = "Transfering data from ";
statusText += url;
statusText += " ...";
set(kStatusText, statusText);
- /*
- * The page title is set to "loading..." now.
- * When loading is finished, its set to the sites url.
- * Then we got two options. Either I do grab the page title
- * from the DOM tree, when the HTML parser is finished, or
- * I wait for the renderer to finish, which then delivers me
- * the page title.
- */
- set(kTitle, "loading...");
-
- set(kSecureConnection, false);
set(kCookiesDisabled, false);
}
@@ -77,38 +60,20 @@
}
-bool SiteEntry :: GetSecureConnection() {
-
- return getBoolean(kSecureConnection);
-
-}
-
const char * SiteEntry :: GetStatusText() {
return getString(kStatusText).c_str();
}
-const char * SiteEntry :: GetTitle() {
-
- return getString(kTitle).c_str();
-
-}
-
-const char * SiteEntry :: GetUrl() {
-
- return getString(kUrl).c_str();
-
-}
-
void SiteEntry :: Print() {
printf("------------------------------------\n");
- printf("SiteEntry: ID[%ld] URL[%s] TITLE[%s]\n", getId(), getString(kUrl).c_str(), getString(kTitle).c_str());
+ printf("SiteEntry: ID[%ld] URL[%s] TITLE[%s]\n", getId(), GetUrl(), GetTitle());
printf(" LoadingProgess[%d] CookiesDisabled[%s], SecureConnection[%s]\n",
- getInteger(kLoadingProgress),
+ GetLoadingProgress(),
getBoolean(kCookiesDisabled) ? "true" : "false",
- getBoolean(kSecureConnection) ? "true" : "false");
+ GetSecureConnection() ? "true" : "false");
printf(" -- SiteEntry UrlEntries --\n");
@@ -141,22 +106,15 @@
void SiteEntry :: SetLoadingProgress(int loadingprogress) {
- set(kLoadingProgress, loadingprogress);
+ UrlEntry::SetLoadingProgress(loadingprogress);
if (loadingprogress == 100) {
set(kStatusText, "Done.");
- set(kTitle, getString(kUrl));
}
}
-void SiteEntry :: SetSecureConnection(bool value) {
-
- set(kSecureConnection, value);
-
+void SiteEntry :: SetStatusText(const char * text) {
+
+ set(kStatusText, text);
+
}
-
-void SiteEntry :: SetTitle(const char * title) {
-
- set(kTitle, title);
-
-}
Modified: trunk/themis/framework/SiteEntry.h
===================================================================
--- trunk/themis/framework/SiteEntry.h 2011-01-16 13:40:37 UTC (rev 607)
+++ trunk/themis/framework/SiteEntry.h 2011-01-16 13:45:17 UTC (rev 608)
@@ -5,20 +5,13 @@
#ifndef SITEENTRY_H
#define SITEENTRY_H
-// Standard C++ headers
-#include <vector.h>
-
// Themis headers
-#include "BaseEntry.hpp"
+#include "UrlEntry.h"
-// Namespaces used
-using namespace std;
-
// Declarations used
class BBitmap;
-class UrlEntry;
-class SiteEntry : public BaseEntry {
+class SiteEntry : public UrlEntry {
public:
SiteEntry(int32 id,
@@ -26,18 +19,13 @@
bool GetCookiesDisabled();
BBitmap * GetFavIcon();
- int GetLoadingProgress();
- bool GetSecureConnection();
+ virtual int GetLoadingProgress();
const char * GetStatusText();
- const char * GetTitle();
- const char * GetUrl();
- void Print();
+ virtual void Print();
void SetCookiesDisabled(bool value);
void SetFavIcon(BBitmap * bmp);
- void SetLoadingProgress(int loadingprogress);
- void SetSecureConnection(bool value);
+ virtual void SetLoadingProgress(int loadingprogress);
void SetStatusText(const char * text);
- void SetTitle(const char * title);
};
Modified: trunk/themis/framework/UrlEntry.h
===================================================================
--- trunk/themis/framework/UrlEntry.h 2011-01-16 13:40:37 UTC (rev 607)
+++ trunk/themis/framework/UrlEntry.h 2011-01-16 13:45:17 UTC (rev 608)
@@ -13,13 +13,13 @@
UrlEntry(int32 id,
const char * url);
- int GetLoadingProgress();
+ virtual int GetLoadingProgress();
bool GetSecureConnection();
const char * GetTitle();
const char * GetUrl();
- void Print();
- void SetLoadingProgress(int loadingprogress);
+ virtual void Print();
+ virtual void SetLoadingProgress(int loadingprogress);
void SetSecureConnection(bool value);
void SetTitle(const char * title);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 13:40:43
|
Revision: 607
http://themis.svn.sourceforge.net/themis/?rev=607&view=rev
Author: mark_hellegers
Date: 2011-01-16 13:40:37 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Removed debugging output.
Modified Paths:
--------------
trunk/themis/common/BaseEntry.cpp
Modified: trunk/themis/common/BaseEntry.cpp
===================================================================
--- trunk/themis/common/BaseEntry.cpp 2011-01-16 03:15:07 UTC (rev 606)
+++ trunk/themis/common/BaseEntry.cpp 2011-01-16 13:40:37 UTC (rev 607)
@@ -33,8 +33,6 @@
*/
-#include <stdio.h>
-
// Themis headers
#include "BaseEntry.hpp"
@@ -67,8 +65,6 @@
BaseEntry * BaseEntry :: getEntry(int32 aId) {
- printf("Trying to find %ld\n", aId);
-
BaseEntry * result = NULL;
// browse through the entry list to find the UrlEntry with the matching id
@@ -86,13 +82,6 @@
}
}
- if (result == NULL) {
- printf("Failed to find %ld\n", aId);
- }
- else {
- printf("Found %ld\n", aId);
- }
-
return result;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-16 03:15:14
|
Revision: 606
http://themis.svn.sourceforge.net/themis/?rev=606&view=rev
Author: z3r0_one
Date: 2011-01-16 03:15:07 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
A few more minor fixes in HTTP/Cookies to prevent crashes due to weird situations, and a bit more cleaning up of unnecessary debug messages.
Modified Paths:
--------------
trunk/themis/framework/connection.cpp
trunk/themis/framework/tcpmanager.cpp
trunk/themis/modules/http/cookieman.cpp
trunk/themis/modules/http/httpv4.cpp
Modified: trunk/themis/framework/connection.cpp
===================================================================
--- trunk/themis/framework/connection.cpp 2011-01-15 23:06:22 UTC (rev 605)
+++ trunk/themis/framework/connection.cpp 2011-01-16 03:15:07 UTC (rev 606)
@@ -97,7 +97,7 @@
}
int32 Connection::ConnectionResult() {
- printf("ConnectionResult\n");
+ //printf("ConnectionResult\n");
return connection_result;
}
bool Connection::NotifiedConnect() {
@@ -167,7 +167,7 @@
nonblocking=async;
}
Connection::~Connection() {
- printf("Connection: Connection to %s is going away.\n",host_name);
+ //printf("Connection: Connection to %s is going away.\n",host_name);
if (!IsBufferEmpty())
EmptyBuffer();
session_id=0;
@@ -202,7 +202,7 @@
void Connection::OwnerRelease() {
BAutolock alock(lock);
if (alock.IsLocked()) {
- printf("Connection::OwnerRelease\n");
+ //printf("Connection::OwnerRelease\n");
owner=NULL;
StopUsing();
NewSession();
@@ -216,7 +216,7 @@
}
void Connection::Connect() {
- printf("Connection::Connect()\n");
+ //printf("Connection::Connect()\n");
BAutolock alock(lock);
if (alock.IsLocked()) {
if (IsConnected()) {
@@ -255,7 +255,7 @@
}
- printf("Connection::Connect() done\n");
+ //printf("Connection::Connect() done\n");
}
void Connection::ConnectionEstablished(){
@@ -263,13 +263,13 @@
if (alock.IsLocked()) {
if (use_ssl) {
int cryptstatus;
- printf("CRYPT_OK: %d\n",CRYPT_OK);
+ //printf("CRYPT_OK: %d\n",CRYPT_OK);
cryptstatus=cryptCreateSession(&cryptSession,CRYPT_UNUSED,CRYPT_SESSION_SSL);
- printf("session creation: %d\n",cryptstatus);
+ //printf("session creation: %d\n",cryptstatus);
cryptstatus=cryptSetAttribute(cryptSession,CRYPT_SESSINFO_NETWORKSOCKET,socket_id);
- printf("passing network socket: %d\n",cryptstatus);
+ //printf("passing network socket: %d\n",cryptstatus);
cryptstatus=cryptSetAttribute(cryptSession,CRYPT_SESSINFO_ACTIVE,1);
- printf("activating session: %d\n",cryptstatus);
+ //printf("activating session: %d\n",cryptstatus);
if (cryptStatusError(cryptstatus))
{
int errorcode,errorstrlen;
@@ -281,7 +281,7 @@
cryptGetAttributeString(cryptSession,CRYPT_ATTRIBUTE_INT_ERRORMESSAGE,errstring,&errorstrlen);
printf("error: %d - %s\n",errorcode,errstring);
delete errstring;
- printf("Closing connection.\n");
+ //printf("Closing connection.\n");
last_error=ERROR_CONNECTION_RESET;
Disconnect();
NotifyDisconnect();
@@ -327,7 +327,7 @@
// if (owner!=NULL)
// owner->ConnectionEstablished(this);
// atomic_add(¬ified_connect,1);
- printf("connection %p: notified connect %ld\n",this,notified_connect);
+ //printf("connection %p: notified connect %ld\n",this,notified_connect);
}
}
@@ -371,7 +371,7 @@
//Error!! Call NetworkableObject's error function.
switch(errno) {
case EWOULDBLOCK:
- printf("Connection::IsConnected Would Block\n");
+ //printf("Connection::IsConnected Would Block\n");
last_error=ERROR_WOULD_BLOCK;
break;
case EINTR:
@@ -549,7 +549,7 @@
return id;
}
int32 Connection::NewSession() {
- printf("[NewSession]\n");
+ //printf("[NewSession]\n");
fflush(stdout);
int32 id=0;
BAutolock alock(lock);
@@ -598,12 +598,12 @@
current->buffer=new Buffer(data,size);
status=B_OK;
lastusedtime=real_time_clock();
- printf("[Connection::AppendData] Buffer is now %Ld bytes long\n",DataSize());
+ //printf("[Connection::AppendData] Buffer is now %Ld bytes long\n",DataSize());
// }
return status;
}
off_t Connection::Receive(void *data, off_t max_size) {
- printf("[Receive]\n");
+ //printf("[Receive]\n");
fflush(stdout);
off_t size=0L;
// BAutolock alock(lock);
@@ -619,10 +619,10 @@
break;
}
bytes=0;
- printf("[Receive] at most %Ld can be read now.\n", max_size-size);
+ //printf("[Receive] at most %Ld can be read now.\n", max_size-size);
bytes=current->buffer->GetData((unsigned char*)data+size,max_size-size);
size+=bytes;
- printf("[Receive] %ld (%Ld) bytes were copied into protocol buffer.\n",bytes,size);
+ //printf("[Receive] %ld (%Ld) bytes were copied into protocol buffer.\n",bytes,size);
prev=current;
current=current->next;
delete prev->buffer;
@@ -632,7 +632,7 @@
buffer_in=current;
lastusedtime=real_time_clock();
session_bytes_out+=size;
- printf("[Connection::Receive] %Ld bytes have been transferred to owner. %Ld bytes left in buffer.\n\n",session_bytes_received,DataSize());
+ //printf("[Connection::Receive] %Ld bytes have been transferred to owner. %Ld bytes left in buffer.\n\n",session_bytes_received,DataSize());
fflush(stdout);
lock.Unlock();
}
@@ -751,7 +751,7 @@
}
void Connection::StartUsing()
{
- printf("Connection::StartUsing beginning.\n");
+ //printf("Connection::StartUsing beginning.\n");
BAutolock alock(lock);
if (alock.IsLocked())
if (in_use==0)
@@ -766,7 +766,7 @@
// atomic_add(¬ified_connect,1);
}
- printf("Connection::StartUsing done.\n");
+ //printf("Connection::StartUsing done.\n");
}
void Connection::StopUsing()
{
Modified: trunk/themis/framework/tcpmanager.cpp
===================================================================
--- trunk/themis/framework/tcpmanager.cpp 2011-01-15 23:06:22 UTC (rev 605)
+++ trunk/themis/framework/tcpmanager.cpp 2011-01-16 03:15:07 UTC (rev 606)
@@ -51,7 +51,7 @@
}
TCPManager::~TCPManager() {
- printf("destroying connections...");
+ //printf("destroying connections...");
fflush(stdout);
if (Connection::CountConnections()>0) {
@@ -66,7 +66,7 @@
}
}
}
- printf("done.\n");
+ //printf("done.\n");
// delete lock;
delete Connection::ListLock;
delete_sem(process_sem_1);
@@ -218,7 +218,7 @@
}
Connection *TCPManager::CreateConnection(NetworkableObject *net_obj,const char *host,uint16 port,bool secure,bool asynch) {
- printf("CreateConnection begun\n");
+ //printf("CreateConnection begun\n");
Connection *connection=NULL;
BAutolock alock(lock);
if (alock.IsLocked()) {
@@ -239,7 +239,7 @@
}
}
if (existing_available) {
- printf("TCP Manager: found available connection for use. (n: %p\tc: %p)\n",net_obj,connection);
+ //printf("TCP Manager: found available connection for use. (n: %p\tc: %p)\n",net_obj,connection);
connection->AssignNetObject(net_obj);
connection->StartUsing();
// connection->Connect();
@@ -252,7 +252,7 @@
}
}
- printf("CreateConnection is done: %p\n",connection);
+ //printf("CreateConnection is done: %p\n",connection);
return connection;
}
void TCPManager::Disconnect(Connection *connection) {
Modified: trunk/themis/modules/http/cookieman.cpp
===================================================================
--- trunk/themis/modules/http/cookieman.cpp 2011-01-15 23:06:22 UTC (rev 605)
+++ trunk/themis/modules/http/cookieman.cpp 2011-01-16 03:15:07 UTC (rev 606)
@@ -136,6 +136,7 @@
// printf("Finding cookie directory...\n");
FindCookieDirectory();
LoadAllCookies();
+ ClearExpiredCookies();
}
CookieManager::~CookieManager() {
@@ -642,7 +643,7 @@
HTTP->AppSettings->FindString(kPrefsSettingsDirectory,&temp);
temp<<"/cookies";
}
- printf("Cookie Directory: %s\n",temp.String() );
+ //printf("Cookie Directory: %s\n",temp.String() );
BEntry ent;
FindCookieDirPoint1:
ent.SetTo(temp.String());
@@ -847,7 +848,7 @@
if( nvpairs[i] == ',' && strchr((nvpairs+i),'=') != NULL)
nvpair_counter++;
}// kick it old school
- printf("name=value pairs: %d\n",nvpair_counter);
+ //printf("name=value pairs: %d\n",nvpair_counter);
cookie_array = new char*[nvpair_counter];
int32 pair_length = 0;
if( nvpair_counter > 1)
@@ -933,7 +934,7 @@
//printf("\t\tcookie attributes: %s\n",attributes[i]);
for(int8 kac = 0; kac < 10; kac++)
{
- if(strncasecmp(attributes[i],known_attributes[kac],min_c(strlen(known_attributes[kac]),strlen(attributes[i]))) == 0)
+ if(attributes[i] != NULL && strncasecmp(attributes[i],known_attributes[kac],min_c(strlen(known_attributes[kac]),strlen(attributes[i]))) == 0)
{
//printf("\t\t\tattrib: %s\n",known_attributes[kac]);
if( strcasecmp(known_attributes[kac],"path") == 0 ) {
@@ -981,7 +982,7 @@
*/
}
else if( strcasecmp(known_attributes[kac],"domain") == 0 ) {
- printf("\t\t\t\tdomain: %s\n",attvalue(attributes[i]));
+ //printf("\t\t\t\tdomain: %s\n",attvalue(attributes[i]));
if( default_cookie->domain != NULL)
{
memset(default_cookie->domain,0,strlen(default_cookie->domain)+1);
@@ -1098,7 +1099,7 @@
if( DuplicatedCookie(new_cookie) )
{
original = FindCookie(new_cookie->name,new_cookie->path, new_cookie->domain);
- printf("found cookie %s, updating value from \"%s\" to \"%s\"\n",new_cookie->name,original->value,new_cookie->value);
+ //printf("found cookie %s, updating value from \"%s\" to \"%s\"\n",new_cookie->name,original->value,new_cookie->value);
if( original->secure == new_cookie->secure )
{
original->discard = new_cookie->discard;
@@ -1213,10 +1214,10 @@
return false;
while (current!=NULL)
{
- if (
- strcmp(cookie->name,current->name)==0 &&
- strcmp(cookie->path,current->path)==0 &&
- strcasecmp(cookie->domain,current->domain)==0 && cookie->secure == current->secure
+ if ( ((cookie->name == NULL && current->name == NULL) ||
+ strcmp(cookie->name,current->name)==0) && ((cookie->path == NULL && current->path == NULL) ||
+ strcmp(cookie->path,current->path)==0) && ((cookie->domain == NULL && current->domain == NULL) ||
+ strcasecmp(cookie->domain,current->domain)==0) && cookie->secure == current->secure
)
{
found=true;
@@ -1348,10 +1349,10 @@
while (cur!=NULL) {
// printf("Expire %s: current time: %ld\texpire time: %ld\tdifference: %2.2f\n",cur->name,currenttime,cur->expiredate,difftime(cur->expiredate,currenttime));
if (cur->session == false && cur->discard == false && cur->expiredate<=currenttime) {
-// printf("The following cookie has expired:\n");
-// PrintCookie(cur);
+ //printf("The following cookie has expired:\n");
+ //PrintCookie(cur);
if (cur==cookie_head) {
- printf("ClearExpiredCookies line 1764: cur %p\n",cur);
+ //printf("ClearExpiredCookies line 1764: cur %p\n",cur);
cookie_head=cookie_head->next;
BEntry ent(&cur->ref);
if (ent.InitCheck() == B_OK && ent.Exists())
@@ -1453,8 +1454,8 @@
if ((cookie->maxage+cookie->datereceived)<=currenttime)
return ValidateFail("Cookie has already expired.");
}
- else if( cookie->discard ) printf("Cookie is marked for discarding.\n");
- else if( cookie->session ) printf("Cookie is a session cookie.\n");
+ //else if( cookie->discard ) printf("Cookie is marked for discarding.\n");
+ //else if( cookie->session ) printf("Cookie is a session cookie.\n");
if (cookie->domain==NULL)
return ValidateFail("Cookie domain is NULL.");
else {
@@ -1507,8 +1508,10 @@
memset(attname,0,B_ATTR_NAME_LENGTH+1);
BNode node(&cookie->ref);
cookie->discard=false;
+ cookie->session = false;
unsigned char *data=NULL;
BString aname;
+ int32 current_time = real_time_clock();
node.Lock();
while (node.GetNextAttrName(attname)==B_OK) {
node.GetAttrInfo(attname,&ai);
@@ -1520,6 +1523,7 @@
}
if (strcasecmp(attname,"Themis:expiredate")==0) {
node.ReadAttr("Themis:expiredate",B_INT32_TYPE,0,&cookie->expiredate,ai.size);
+ cookie->maxage = cookie->expiredate - current_time;
}
}break;
@@ -1625,7 +1629,8 @@
else
{
status_t res = node.RemoveAttr("Themis:cookievalue");
- printf("removal of cookievalue attribute (null cookie value) successful? %s\n", (res == B_OK ? "yes":"no"));
+ //printf("removal of cookievalue attribute (null cookie value) successful? %s\n", (res == B_OK ? "yes":"no"));
+ if( res != B_OK) node.WriteAttr("Themis:cookievalue",B_STRING_TYPE,0,"",1);
}
if (cookie->version==1)
if (cookie->ports!=NULL)
Modified: trunk/themis/modules/http/httpv4.cpp
===================================================================
--- trunk/themis/modules/http/httpv4.cpp 2011-01-15 23:06:22 UTC (rev 605)
+++ trunk/themis/modules/http/httpv4.cpp 2011-01-16 03:15:07 UTC (rev 606)
@@ -1672,10 +1672,12 @@
strcpy(request->header_buffer,data);
} else
{
+ if( eol != NULL) {
int32 Length=strlen(eol)-2;
request->header_buffer=(char*)malloc(Length+1);
memset(request->header_buffer,0,Length+1);
strcpy(request->header_buffer,eol+2);
+ }
}
}
} else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-15 23:06:28
|
Revision: 605
http://themis.svn.sourceforge.net/themis/?rev=605&view=rev
Author: mark_hellegers
Date: 2011-01-15 23:06:22 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
Added DOMEntry class. Now used to pass around the DOM from the HTML parser instead of passing the pointer directly. Doesn't include any other information yet. Converted the renderer and the dom viewer addons to find the information the new way.
Modified Paths:
--------------
trunk/themis/common/BaseEntry.cpp
trunk/themis/common/BaseEntry.hpp
trunk/themis/framework/SiteHandler.cpp
trunk/themis/framework/SiteHandler.h
trunk/themis/makefile
trunk/themis/modules/DOMView/DOMViewer.cpp
trunk/themis/modules/HTMLParser/HTMLParser.cpp
trunk/themis/modules/HTMLParser/HTMLParser.h
trunk/themis/modules/Renderer/TRenderer.cpp
Added Paths:
-----------
trunk/themis/common/DOMEntry.cpp
trunk/themis/common/DOMEntry.hpp
Modified: trunk/themis/common/BaseEntry.cpp
===================================================================
--- trunk/themis/common/BaseEntry.cpp 2011-01-15 21:28:55 UTC (rev 604)
+++ trunk/themis/common/BaseEntry.cpp 2011-01-15 23:06:22 UTC (rev 605)
@@ -33,6 +33,8 @@
*/
+#include <stdio.h>
+
// Themis headers
#include "BaseEntry.hpp"
@@ -65,19 +67,32 @@
BaseEntry * BaseEntry :: getEntry(int32 aId) {
+ printf("Trying to find %ld\n", aId);
+
BaseEntry * result = NULL;
// browse through the entry list to find the UrlEntry with the matching id
vector<BaseEntry *>::iterator it = fChildEntries.begin();
while (it != fChildEntries.end() && result == NULL) {
- if (((BaseEntry *)*it)->getId() == aId) {
+ BaseEntry * entry = (BaseEntry *)*it;
+ if (entry->getId() == aId) {
result = *it;
}
else {
- it++;
+ result = entry->getEntry(aId);
+ if (result == NULL) {
+ it++;
+ }
}
}
+ if (result == NULL) {
+ printf("Failed to find %ld\n", aId);
+ }
+ else {
+ printf("Found %ld\n", aId);
+ }
+
return result;
}
@@ -136,22 +151,38 @@
};
}
+void BaseEntry :: set(const string aName, SharedPtr aValue) {
+
+ if (mSharedPtrs.count(aName) == 0) {
+ mSharedPtrs.insert(
+ map<string, SharedPtr>::value_type(aName, aValue));
+ }
+ else {
+ mSharedPtrs[aName] = aValue;
+ };
+}
+
string BaseEntry :: getString(const string aName) {
return mStrings[aName];
}
bool BaseEntry :: getBoolean(const string aName) {
-
+
return mBooleans[aName];
}
int BaseEntry :: getInteger(const string aName) {
-
+
return mIntegers[aName];
}
void * BaseEntry :: getPointer(const string aName) {
-
+
return mPointers[aName];
}
+
+SharedPtr BaseEntry :: getSharedPtr(const string aName) {
+
+ return mSharedPtrs[aName];
+}
Modified: trunk/themis/common/BaseEntry.hpp
===================================================================
--- trunk/themis/common/BaseEntry.hpp 2011-01-15 21:28:55 UTC (rev 604)
+++ trunk/themis/common/BaseEntry.hpp 2011-01-15 23:06:22 UTC (rev 605)
@@ -47,11 +47,18 @@
// BeOS headers
#include <be/support/SupportDefs.h>
+// Boost headers
+#include "boost/shared_ptr.hpp"
+#include "boost/weak_ptr.hpp"
+
// Namespaces used
using std::map;
using std::string;
using std::vector;
+// Typedefs declared.
+typedef boost::shared_ptr<void> SharedPtr;
+
class BaseEntry {
private:
@@ -61,6 +68,7 @@
map<string, bool> mBooleans;
map<string, int> mIntegers;
map<string, void *> mPointers;
+ map<string, SharedPtr> mSharedPtrs;
protected:
vector<BaseEntry *> fChildEntries;
@@ -76,10 +84,12 @@
void set(const string aName, const bool aValue);
void set(const string aName, const int aValue);
void set(const string aName, void * aValue);
+ void set(const string aName, SharedPtr aValue);
string getString(const string aName);
bool getBoolean(const string aName);
int getInteger(const string aName);
void * getPointer(const string aName);
+ SharedPtr getSharedPtr(const string aName);
};
Added: trunk/themis/common/DOMEntry.cpp
===================================================================
--- trunk/themis/common/DOMEntry.cpp (rev 0)
+++ trunk/themis/common/DOMEntry.cpp 2011-01-15 23:06:22 UTC (rev 605)
@@ -0,0 +1,57 @@
+/*
+ Copyright (c) 2011 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: January 15, 2011
+*/
+
+/* DOMEntry implementation
+ See DOMEntry.hpp for more information
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// DOM headers
+#include "TDocument.h"
+
+// SGMLParser headers
+#include "DOMEntry.hpp"
+
+// Constants declared
+const string kDOMDocument = "DOM Document";
+
+DOMEntry :: DOMEntry(int32 aId, TDocumentPtr aDocument)
+ : BaseEntry(aId) {
+
+ set(kDOMDocument, shared_static_cast<void>(aDocument));
+
+}
+
+TDocumentPtr DOMEntry :: getDocument() {
+
+ return shared_static_cast<TDocument>(getSharedPtr(kDOMDocument));
+}
Added: trunk/themis/common/DOMEntry.hpp
===================================================================
--- trunk/themis/common/DOMEntry.hpp (rev 0)
+++ trunk/themis/common/DOMEntry.hpp 2011-01-15 23:06:22 UTC (rev 605)
@@ -0,0 +1,49 @@
+/*
+ Copyright (c) 2011 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: January 15, 2011
+*/
+
+#ifndef DOMENTRY_HPP
+#define DOMENTRY_HPP
+
+// DOM headers
+#include "DOMSupport.h"
+
+// Themis headers
+#include "BaseEntry.hpp"
+
+class DOMEntry : public BaseEntry {
+
+ public:
+ DOMEntry(int32 aId, TDocumentPtr aDocument);
+
+ TDocumentPtr getDocument();
+
+};
+
+#endif
Modified: trunk/themis/framework/SiteHandler.cpp
===================================================================
--- trunk/themis/framework/SiteHandler.cpp 2011-01-15 21:28:55 UTC (rev 604)
+++ trunk/themis/framework/SiteHandler.cpp 2011-01-15 23:06:22 UTC (rev 605)
@@ -15,6 +15,7 @@
#include "ThemisIcons.h"
#include "../common/commondefs.h"
#include "../common/cacheplug.h"
+#include "../common/BaseEntry.hpp"
#include "UrlEntry.h"
#include "SiteEntry.h"
#include "SiteHandler.h"
@@ -102,6 +103,23 @@
fLocker->Unlock();
}
+void SiteHandler :: AddEntry(BaseEntry * aEntry,
+ int32 aSiteId,
+ int32 aParentId) {
+
+ SiteEntry * site = GetEntry(aSiteId);
+
+ if (site != NULL) {
+ fLocker->Lock();
+
+ BaseEntry * parent = site->getEntry(aParentId);
+ parent->addEntry(aEntry);
+
+ fLocker->Unlock();
+ }
+
+}
+
BBitmap * SiteHandler :: GetFavIconFor(int32 id) {
fLocker->Lock();
Modified: trunk/themis/framework/SiteHandler.h
===================================================================
--- trunk/themis/framework/SiteHandler.h 2011-01-15 21:28:55 UTC (rev 604)
+++ trunk/themis/framework/SiteHandler.h 2011-01-15 23:06:22 UTC (rev 605)
@@ -19,6 +19,7 @@
class BBitmap;
class BMessage;
class SiteEntry;
+class BaseEntry;
class CachePlug;
class SiteHandler : public MessageSystem {
@@ -35,6 +36,7 @@
SiteEntry * GetEntry(int32 id);
void AddEntry(SiteEntry * aEntry);
+ void AddEntry(BaseEntry * aEntry, int32 aSiteId, int32 aParentId);
void BroadcastFinished();
uint32 BroadcastTarget();
status_t BroadcastReply(BMessage * msg);
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2011-01-15 21:28:55 UTC (rev 604)
+++ trunk/themis/makefile 2011-01-15 23:06:22 UTC (rev 605)
@@ -119,7 +119,8 @@
common/TTextView.cpp \
common/prefsman.cpp \
common/BasePrefsView.cpp \
- common/BaseEntry.cpp
+ common/BaseEntry.cpp \
+ common/DOMEntry.cpp
#add similar lines for new plugins, libraries, etc.
HTTPADDONSOURCES= \
http/optionshandler.cpp \
@@ -540,11 +541,11 @@
$(COMMON_DEPENDS_DIR)%.d: common/%.cpp
@echo "Common: Updating dependency file $(notdir $@)"
- @set -e;VAR1=$(shell echo "$(COMMON_DEPENDS_DIR)$(notdir $@)"|sed 's/\//\\\//g');VAR2=$(shell echo "$(COMMON_OBJECT_DIR)"|sed 's/\//\\\//g'); $(CC) -Icommon -I./ -M $(CPPFLAGS) $< | sed 's/\($*\)\.o[ :]*/objects\/common\/\1.o depends\/common\/\1.d : /g' > $@;[ -s $@ ] || rm -f $@
+ @set -e;VAR1=$(shell echo "$(COMMON_DEPENDS_DIR)$(notdir $@)"|sed 's/\//\\\//g');VAR2=$(shell echo "$(COMMON_OBJECT_DIR)"|sed 's/\//\\\//g'); $(CC) -Icommon -I./ -Iframework/DOM -M $(CPPFLAGS) $< | sed 's/\($*\)\.o[ :]*/objects\/common\/\1.o depends\/common\/\1.d : /g' > $@;[ -s $@ ] || rm -f $@
$(COMMON_OBJECT_DIR)%.o: common/%.cpp $(COMMON_DEPENDS_DIR)%.d
@echo "Common: Updating object file $(notdir $@)"
- @$(CC) $(CFLAGS) $(COMPILE_FLAGS) -Icommon -I./ -c $< -o $@
+ @$(CC) $(CFLAGS) $(COMPILE_FLAGS) -Icommon -I./ -Iframework/DOM -c $< -o $@
#renderer
Modified: trunk/themis/modules/DOMView/DOMViewer.cpp
===================================================================
--- trunk/themis/modules/DOMView/DOMViewer.cpp 2011-01-15 21:28:55 UTC (rev 604)
+++ trunk/themis/modules/DOMView/DOMViewer.cpp 2011-01-15 23:06:22 UTC (rev 605)
@@ -44,158 +44,164 @@
#include <Autolock.h>
// Themis headers
+#include "framework/app.h"
+#include "framework/SiteHandler.h"
+#include "framework/SiteEntry.h"
+#include "DOMEntry.hpp"
#include "commondefs.h"
DOMViewer * viewer;
BMessage ** appSettings_p;
BMessage * appSettings;
-status_t Initialize( void * aInfo ) {
-
+status_t Initialize(void * aInfo) {
+
viewer = NULL;
- if ( aInfo != NULL ) {
+ if (aInfo != NULL) {
BMessage * message = (BMessage *) aInfo;
- if ( message->HasPointer( "settings_message_ptr" ) ) {
- message->FindPointer( "settings_message_ptr", (void **) & appSettings_p );
+ if (message->HasPointer("settings_message_ptr")) {
+ message->FindPointer("settings_message_ptr", (void **) & appSettings_p);
appSettings = *appSettings_p;
}
- viewer = new DOMViewer( message );
+ viewer = new DOMViewer(message);
}
- else {
+ else {
viewer = new DOMViewer();
}
-
+
return B_OK;
-
+
}
-status_t Shutdown( bool aNow ) {
-
+status_t Shutdown(bool aNow) {
+
delete viewer;
-
+
return B_OK;
-
+
}
-PlugClass * GetObject() {
-
+PlugClass * GetObject() {
+
return viewer;
-
+
}
-DOMViewer :: DOMViewer( BMessage * aInfo )
- : BHandler( "DOMViewer" ), PlugClass( aInfo ) {
-
+DOMViewer :: DOMViewer(BMessage * aInfo)
+ : BHandler("DOMViewer"), PlugClass(aInfo) {
+
mView = NULL;
-
+
}
-DOMViewer :: ~DOMViewer() {
+DOMViewer :: ~DOMViewer() {
- if ( mView ) {
- BMessenger messenger( mView );
- messenger.SendMessage( B_QUIT_REQUESTED );
+ if (mView) {
+ BMessenger messenger(mView);
+ messenger.SendMessage(B_QUIT_REQUESTED);
}
-
+
}
-void DOMViewer :: MessageReceived( BMessage * aMessage ) {
-
+void DOMViewer :: MessageReceived( BMessage * aMessage) {
+
}
-bool DOMViewer :: IsHandler() {
-
+bool DOMViewer :: IsHandler() {
+
return true;
-
+
}
-BHandler * DOMViewer :: Handler() {
-
+BHandler * DOMViewer :: Handler() {
+
return this;
-
+
}
-bool DOMViewer :: IsPersistent() {
-
+bool DOMViewer :: IsPersistent() {
+
return true;
-
+
}
-uint32 DOMViewer :: PlugID() {
-
+uint32 DOMViewer :: PlugID() {
+
return 'tree';
-
+
}
-char * DOMViewer :: PlugName() {
-
+char * DOMViewer :: PlugName() {
+
return "DOM Viewer";
-
+
}
-float DOMViewer :: PlugVersion() {
-
- return 0.1;
-
+float DOMViewer :: PlugVersion() {
+
+ return 0.2;
+
}
-void DOMViewer :: Heartbeat() {
-
+void DOMViewer :: Heartbeat() {
+
}
-status_t DOMViewer :: ReceiveBroadcast( BMessage * aMessage ) {
-
+status_t DOMViewer :: ReceiveBroadcast(BMessage * aMessage) {
+
int32 command = 0;
- aMessage->FindInt32( "command", &command );
-
- switch ( command ) {
- case COMMAND_INFO: {
+ aMessage->FindInt32("command", &command);
+
+ switch (command) {
+ case COMMAND_INFO: {
// Check if it is dom data
- BString type;
- aMessage->FindString( "type", &type );
- if ( type == "dom" ) {
- // Get the pointer out
- void * document = NULL;
- aMessage->FindPointer( "dom_tree_pointer", &document );
- if ( document ) {
- TDocumentPtr * temp = (TDocumentPtr *) document;
- TDocumentPtr copy = *temp;
- if ( ! mView ) {
- mView = new DOMView( copy );
- }
- else {
- BAutolock viewLock( mView );
- if ( viewLock.IsLocked() ) {
- mView->setDocument( copy );
+ BString typeOfDocument;
+ aMessage->FindString("type", &typeOfDocument);
+ if (typeOfDocument == "dom") {
+ int32 siteId = aMessage->FindInt32("site_id");
+ SiteEntry * site = ((App *)be_app)->GetSiteHandler()->GetEntry(siteId);
+ if (site != NULL) {
+ int32 domId = aMessage->FindInt32("dom_id");
+ DOMEntry * entry = (DOMEntry *) site->getEntry(domId);
+ if (entry != NULL) {
+ TDocumentPtr document = entry->getDocument();
+ if (!mView) {
+ mView = new DOMView(document);
}
+ else {
+ BAutolock viewLock(mView);
+ if (viewLock.IsLocked()) {
+ mView->setDocument(document);
+ }
+ }
}
}
}
break;
}
- default: {
+ default: {
return PLUG_DOESNT_HANDLE;
}
}
-
+
return PLUG_HANDLE_GOOD;
-
+
}
-status_t DOMViewer::BroadcastReply( BMessage * aMessage ) {
+status_t DOMViewer :: BroadcastReply(BMessage * aMessage) {
return B_OK;
}
-uint32 DOMViewer::BroadcastTarget() {
+uint32 DOMViewer :: BroadcastTarget() {
return MS_TARGET_DOM_VIEWER;
}
-int32 DOMViewer :: Type() {
-
+int32 DOMViewer :: Type() {
+
return TARGET_DOM;
-
+
}
Modified: trunk/themis/modules/HTMLParser/HTMLParser.cpp
===================================================================
--- trunk/themis/modules/HTMLParser/HTMLParser.cpp 2011-01-15 21:28:55 UTC (rev 604)
+++ trunk/themis/modules/HTMLParser/HTMLParser.cpp 2011-01-15 23:06:22 UTC (rev 605)
@@ -18,9 +18,7 @@
// HTMLParser headers
#include "HTMLParser.h"
-#include "commondefs.h"
-#include "plugman.h"
-#include "PrefsDefs.h"
+#include "DOMEntry.hpp"
// DOM headers
#include "TDocument.h"
@@ -31,6 +29,13 @@
#include "SGMLScanner.hpp"
#include "HTMLParserPrefsView.hpp"
+// Themis headers
+#include "framework/app.h"
+#include "framework/SiteHandler.h"
+#include "commondefs.h"
+#include "plugman.h"
+#include "PrefsDefs.h"
+
HTMLParser * parser;
BMessage ** appSettings_p;
BMessage * appSettings;
@@ -199,21 +204,27 @@
}
-void HTMLParser :: NotifyParseFinished(void * aDocument,
+void HTMLParser :: NotifyParseFinished(TDocumentPtr aDocument,
string aType,
BMessage * aOriginalMessage) {
- int32 siteID = 0;
- int32 urlID = 0;
- aOriginalMessage->FindInt32("site_id", &siteID);
- aOriginalMessage->FindInt32("url_id", &urlID);
+ int32 siteId = 0;
+ int32 urlId = 0;
+ aOriginalMessage->FindInt32("site_id", &siteId);
+ aOriginalMessage->FindInt32("url_id", &urlId);
+ /* Get an unique ID from the app for the DOM entry */
+ int32 domId = ((App *)be_app)->GetNewID();
+ DOMEntry * entry = new DOMEntry(domId, aDocument);
+ ((App *)be_app)->GetSiteHandler()->AddEntry(entry, siteId, urlId);
+
BMessage * done = new BMessage(SH_PARSE_DOC_FINISHED);
done->AddInt32("command", COMMAND_INFO);
done->AddString("type", aType.c_str());
- done->AddPointer("dom_tree_pointer", aDocument);
- done->AddInt32("site_id", siteID);
- done->AddInt32("url_id", urlID);
+ done->AddInt32("site_id", siteId);
+ done->AddInt32("url_id", urlId);
+ done->AddInt32("dom_id", domId);
+
// Message created. Broadcast it.
Broadcast(MS_TARGET_ALL, done);
@@ -269,7 +280,7 @@
document->setDocumentURI(aURL);
mDocuments.push_back(document);
- NotifyParseFinished(mDocuments.end() - 1, "dom", aOriginalMessage);
+ NotifyParseFinished(document, "dom", aOriginalMessage);
}
}
}
Modified: trunk/themis/modules/HTMLParser/HTMLParser.h
===================================================================
--- trunk/themis/modules/HTMLParser/HTMLParser.h 2011-01-15 21:28:55 UTC (rev 604)
+++ trunk/themis/modules/HTMLParser/HTMLParser.h 2011-01-15 23:06:22 UTC (rev 605)
@@ -64,7 +64,7 @@
// Function to check if the document is a supported one.
bool IsDocumentSupported(BMessage * aMessage);
// Function to notify plugins that parsing is finished.
- void NotifyParseFinished(void * aDocument,
+ void NotifyParseFinished(TDocumentPtr aDocument,
string aType,
BMessage * aOriginalMessage);
// Function to parse a document.
Modified: trunk/themis/modules/Renderer/TRenderer.cpp
===================================================================
--- trunk/themis/modules/Renderer/TRenderer.cpp 2011-01-15 21:28:55 UTC (rev 604)
+++ trunk/themis/modules/Renderer/TRenderer.cpp 2011-01-15 23:06:22 UTC (rev 605)
@@ -27,6 +27,16 @@
Project Start Date: October 18, 2000
*/
+// BeOS headers
+#include <String.h>
+
+// Themis headers
+#include "framework/app.h"
+#include "framework/SiteHandler.h"
+#include "framework/SiteEntry.h"
+#include "DOMEntry.hpp"
+
+// Renderer headers
#include "Globals.h"
#include "TRenderer.h"
@@ -120,60 +130,33 @@
cache = NULL;
}break;
case SH_PARSE_DOC_FINISHED: {
- void *buffer = NULL;
- TDocumentPtr document;
- message->FindPointer("dom_tree_pointer",&buffer);
- if (!buffer)
- break;
- TDocumentPtr *typer = (TDocumentPtr *)buffer;
- document = *typer;
- DOMTrees.push_back(document);
- //Start Processing in a new thread
- // allocate the struct on the heap now ;) (thx emwe)
- preprocess_thread_param* param = new preprocess_thread_param;
- param->document = document;
- param->renderer = this;
- param->siteID = message->FindInt32("site_id");
- param->urlID = message->FindInt32("url_id");
- //feeding the random generator
- srand(time(NULL));
- thread_id id = spawn_thread(PreProcess,THREAD_NAME[rand()%THREAD_NAMES],30,(void *)param);
- resume_thread(id);
- } break;
-/* case ReturnedData:{ //OLD WAY TO DO
- BString type = message->FindString("type");
- if (type == "dom"){
- void *buffer = NULL;
- TDocumentPtr document;
- message->FindPointer("data_pointer", &buffer);
- if (!buffer)
- break;
- TDocumentPtr *typer = (TDocumentPtr *)buffer;
- document = *typer;
-
- //Start Processing
- preprocess_thread_param param = {document,new TRenderView(UIBox(800,450),document),this};
- thread_id id = spawn_thread(PreProcess,"\"boing boing\" says the renderer",30,(void *)¶m);
- resume_thread(id);
+ BString typeOfDocument;
+ message->FindString("type", &typeOfDocument);
+ if (typeOfDocument == "dom") {
+ int32 siteId = message->FindInt32("site_id");
+ SiteEntry * site = ((App *)be_app)->GetSiteHandler()->GetEntry(siteId);
+ if (site != NULL) {
+ int32 domId = message->FindInt32("dom_id");
+ DOMEntry * entry = (DOMEntry *) site->getEntry(domId);
+ if (entry != NULL) {
+ TDocumentPtr document = entry->getDocument();
+ DOMTrees.push_back(document);
+ //Start Processing in a new thread
+ // allocate the struct on the heap now ;) (thx emwe)
+ preprocess_thread_param* param = new preprocess_thread_param;
+ param->document = document;
+ param->renderer = this;
+ param->siteID = siteId;
+ param->urlID = message->FindInt32("url_id");
+ //feeding the random generator
+ srand(time(NULL));
+ thread_id id = spawn_thread(PreProcess,THREAD_NAME[rand()%THREAD_NAMES],30,(void *)param);
+ resume_thread(id);
+ }
+ }
}
- }break; */
-/* case R_WELCOME:{
- printf("RENDERER: R_WELCOME received\n");
- BRect rect;
- int32 doc_number, view_number;
- BMessenger userInterface;
-
- //Retrieve data sent by UI
- message->FindRect("rect",&rect);
- message->FindInt32("document_number",&doc_number);
- message->FindInt32("view_number",&view_number);
- message->FindMessenger("messenger",&userInterface);
-
- //Start Processing
- PreProcess(doc_number,view_number,rect,userInterface);
- }break; */
+ } break;
default:{
-// printf("Renderer doesn't handle this broadcast\n");
return PLUG_DOESNT_HANDLE;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-15 21:29:01
|
Revision: 604
http://themis.svn.sourceforge.net/themis/?rev=604&view=rev
Author: mark_hellegers
Date: 2011-01-15 21:28:55 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
Fixed the makefile. Because the BaseEntry uses the shared pointer code it has to be able to find the boost directory.
Modified Paths:
--------------
trunk/themis/makefile
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2011-01-14 18:47:40 UTC (rev 603)
+++ trunk/themis/makefile 2011-01-15 21:28:55 UTC (rev 604)
@@ -540,11 +540,11 @@
$(COMMON_DEPENDS_DIR)%.d: common/%.cpp
@echo "Common: Updating dependency file $(notdir $@)"
- @set -e;VAR1=$(shell echo "$(COMMON_DEPENDS_DIR)$(notdir $@)"|sed 's/\//\\\//g');VAR2=$(shell echo "$(COMMON_OBJECT_DIR)"|sed 's/\//\\\//g'); $(CC) -Icommon -M $(CPPFLAGS) $< | sed 's/\($*\)\.o[ :]*/objects\/common\/\1.o depends\/common\/\1.d : /g' > $@;[ -s $@ ] || rm -f $@
+ @set -e;VAR1=$(shell echo "$(COMMON_DEPENDS_DIR)$(notdir $@)"|sed 's/\//\\\//g');VAR2=$(shell echo "$(COMMON_OBJECT_DIR)"|sed 's/\//\\\//g'); $(CC) -Icommon -I./ -M $(CPPFLAGS) $< | sed 's/\($*\)\.o[ :]*/objects\/common\/\1.o depends\/common\/\1.d : /g' > $@;[ -s $@ ] || rm -f $@
$(COMMON_OBJECT_DIR)%.o: common/%.cpp $(COMMON_DEPENDS_DIR)%.d
@echo "Common: Updating object file $(notdir $@)"
- @$(CC) $(CFLAGS) $(COMPILE_FLAGS) -Icommon -c $< -o $@
+ @$(CC) $(CFLAGS) $(COMPILE_FLAGS) -Icommon -I./ -c $< -o $@
#renderer
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-14 18:47:46
|
Revision: 603
http://themis.svn.sourceforge.net/themis/?rev=603&view=rev
Author: z3r0_one
Date: 2011-01-14 18:47:40 +0000 (Fri, 14 Jan 2011)
Log Message:
-----------
Defaulting cookie discarding to false. I should have made this change when I added the session member to the cookie_st structure.
Modified Paths:
--------------
trunk/themis/modules/http/cookieman.h
Modified: trunk/themis/modules/http/cookieman.h
===================================================================
--- trunk/themis/modules/http/cookieman.h 2011-01-09 19:32:38 UTC (rev 602)
+++ trunk/themis/modules/http/cookieman.h 2011-01-14 18:47:40 UTC (rev 603)
@@ -101,7 +101,7 @@
//! Location of the cookie on disk (if applicable)
entry_ref ref;
cookie_st() {
- discard=true;//discard cookie on shutdown if not set to false later
+ discard=false;//discard cookie on shutdown if not set to false later
session = true; //same as discard, mostly, except there is a specific cookie flag for discard, but not for session
secure=false;
httponly = false;//not particularly useful right now. RR 1/9/2011
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-09 19:32:45
|
Revision: 602
http://themis.svn.sourceforge.net/themis/?rev=602&view=rev
Author: z3r0_one
Date: 2011-01-09 19:32:38 +0000 (Sun, 09 Jan 2011)
Log Message:
-----------
The fix to the cookie system (at long last). The changes
in this commit should have the cookie system working much
better than it previously had been, shouldn't crash,
and will actually load the cookies at Themis start-up as
expected. There are still somethings that will probably
need work, but it should be stable enough for actual use
as of this moment. Also a minor bug fix in common/cacheobject.cpp
that should prevent a potential seg fault, but the cache system
will be getting a thorough review in the not too distant future.
(Normal disclaimers apply for that statement considering who
they're coming from. ;-) )
Modified Paths:
--------------
trunk/themis/common/cacheobject.cpp
trunk/themis/common/prefsman.cpp
trunk/themis/modules/http/cookieman.cpp
trunk/themis/modules/http/cookieman.h
trunk/themis/modules/http/httpv4.cpp
trunk/themis/modules/http/httpv4.h
trunk/themis/modules/http/uriprocessor.cpp
Modified: trunk/themis/common/cacheobject.cpp
===================================================================
--- trunk/themis/common/cacheobject.cpp 2011-01-09 19:06:43 UTC (rev 601)
+++ trunk/themis/common/cacheobject.cpp 2011-01-09 19:32:38 UTC (rev 602)
@@ -174,7 +174,7 @@
{
BAutolock alock(lock);
if (alock.IsLocked()) {
- if (FindUser(user->Token())==NULL) {
+ if (user != NULL && FindUser(user->Token())==NULL) {
ulist->AddItem(new CacheUser(user));
UpdateAccessTime();
Modified: trunk/themis/common/prefsman.cpp
===================================================================
--- trunk/themis/common/prefsman.cpp 2011-01-09 19:06:43 UTC (rev 601)
+++ trunk/themis/common/prefsman.cpp 2011-01-09 19:32:38 UTC (rev 602)
@@ -15,14 +15,14 @@
{
//BEntry entry();
int32 length = strlen(PREF_FILENAME);
- strncpy((char*)this->pref_filename,PREF_FILENAME,min(length,B_FILE_NAME_LENGTH));
+ strncpy((char*)this->pref_filename,PREF_FILENAME,min_c(length,B_FILE_NAME_LENGTH));
BPath settingsFilePath(this->base_dir_entry);
settingsFilePath.Append(this->pref_filename,false);
BEntry settingsFileEntry(settingsFilePath.Path(),true);
- printf("Settings File Path: %s\tExists? %s\n",settingsFilePath.Path(),settingsFileEntry.Exists()?"yes":"no");
+// printf("Settings File Path: %s\tExists? %s\n",settingsFilePath.Path(),settingsFileEntry.Exists()?"yes":"no");
status_t error = get_ref_for_path(settingsFilePath.Path(), &this->ref);
BPath testPath(&this->ref);
- printf("Test result: %s\n",testPath.Path());
+ //printf("Test result: %s\n",testPath.Path());
if( (FLAGS & PrefsManager::FLAG_CREATE_FILE) != 0 )
{
this->createPrefsFile(PREF_FILENAME,FLAGS);
@@ -46,7 +46,7 @@
void PrefsManager::init(void)
{
this->pref_filename = new char[B_FILE_NAME_LENGTH+1];
- memset(this->pref_filename,0,B_FILE_NAME_LENGTH+1);
+ memset((char*)this->pref_filename,0,B_FILE_NAME_LENGTH+1);
BPath path;
if( find_directory(B_USER_SETTINGS_DIRECTORY,&path) == B_OK)
{
@@ -89,7 +89,7 @@
BMessage *PrefsManager::loadPrefs(status_t *RESULT)
{
BMessage *prefs = NULL;
- status_t result = B__OK;
+ status_t result = B_OK;
BEntry prefsFileEntry(&this->ref,true);
if( prefsFileEntry.Exists() )
{
@@ -129,9 +129,9 @@
{
if(this->pref_filename != NULL)
{
- memset(this->pref_filename,0,B_FILE_NAME_LENGTH+1);
+ memset((char*)this->pref_filename,0,B_FILE_NAME_LENGTH+1);
}
- strncpy(this->pref_filename,FILENAME,min(strlen(FILENAME),B_FILE_NAME_LENGTH));
+ strncpy((char*)this->pref_filename,FILENAME,min_c(strlen(FILENAME),B_FILE_NAME_LENGTH));
}
status_t PrefsManager::renameTo(const char *NEW_FILENAME, bool CLOBBER)
{
Modified: trunk/themis/modules/http/cookieman.cpp
===================================================================
--- trunk/themis/modules/http/cookieman.cpp 2011-01-09 19:06:43 UTC (rev 601)
+++ trunk/themis/modules/http/cookieman.cpp 2011-01-09 19:32:38 UTC (rev 602)
@@ -44,11 +44,13 @@
#include <Entry.h>
#include <VolumeRoster.h>
#include <Node.h>
+#include <NodeInfo.h>
#include <Volume.h>
#include <kernel/fs_index.h>
#include <fs_attr.h>
#include <Query.h>
#include "commondefs.h"
+#include "prefsman.h"
#include "httpv4.h"
#include "date.h"
#include "uriprocessor.h"
@@ -80,7 +82,12 @@
return NULL;
}
#endif
-
+char *attvalue(char *attrib)
+{
+ char *eq = strchr(attrib,'=');
+ if( eq != NULL) eq = (eq+1);
+ return eq;
+}
int qsort_cookies(const void *Alpha, const void *Beta) {
cookie_st **alpha=(cookie_st**)Alpha,**beta=(cookie_st**)Beta;
cookie_st *one=*alpha,*two=*beta;
@@ -101,15 +108,19 @@
CookieManager::CookieManager():MessageSystem("Cookie Manager") {
MsgSysRegister(this);
+ prefMan = new PrefsManager("cookie_settings",PrefsManager::FLAG_CREATE_FILE|PrefsManager::FLAG_REPLACE_FILE);
// printf("CookieManager()\n");
- CookieSettings=new BMessage();
+ CookieSettings = prefMan->loadPrefs();
+ if( CookieSettings == NULL) CookieSettings=new BMessage();
+ if( CookieSettings->HasBool("strict_mode") ) strictMode = CookieSettings->FindBool("strict_mode");
+ else
+ {
+ strictMode = false;
+ CookieSettings->AddBool("strict_mode",strictMode);
+ }
cookie_head=NULL;
// lock=new BLocker("cookie manager lock",true);
// printf("HTTPv4: %p\n",HTTP);
-// printf("AppSettings: %p\n",HTTP->AppSettings);
- if ((HTTP!=NULL) && (HTTP->AppSettings!=NULL))
- if (HTTP->AppSettings->HasMessage("cookie_settings"))
- HTTP->AppSettings->FindMessage("cookie_settings",CookieSettings);
// printf("Checking MIME...\n");
CheckMIME();
/*
@@ -130,6 +141,7 @@
CookieManager::~CookieManager() {
// printf("~CookieManager()\n");
MsgSysUnregister(this);
+ ClearExpiredCookies();
SaveAllCookies();
BAutolock alock(lock);
if (alock.IsLocked()) {
@@ -142,10 +154,12 @@
}
}
}
+ prefMan->savePrefs(CookieSettings);
// delete lock;
delete CookieSettings;
// printf("cookie mime: %s\n",ThemisCookieFile);
// printf("shutting down at: %ld\n",time(NULL));
+ delete prefMan;
}
void CookieManager::CheckMIME() {
BMimeType mime(ThemisCookieFile);//application/x-Themis-cookie
@@ -323,6 +337,27 @@
attrinf.AddBool("attr:extra",false);
} else
found=false;
+ //Make Themis:httponly a visible attribute
+ for (int32 i=0;i<attrcount;i++) {
+ BString item;
+ attrinf.FindString("attr:name",i,&item);
+ if (item=="Themis:httponly") {
+ found=true;
+ break;
+ }
+ }
+ if ((!found) || (installall)) {
+ attrinf.AddString("attr:name","Themis:httponly");
+ attrinf.AddString("attr:public_name","HTTP Only");
+ attrinf.AddInt32("attr:type",B_BOOL_TYPE);
+ attrinf.AddInt32("attr:width",50);
+ attrinf.AddInt32("attr:alignment",B_ALIGN_CENTER);
+ attrinf.AddBool("attr:public",true);
+ attrinf.AddBool("attr:editable",true);
+ attrinf.AddBool("attr:viewable",true);
+ attrinf.AddBool("attr:extra",false);
+ } else
+ found=false;
//Make Themis:cookieports a visible attribute
for (int32 i=0;i<attrcount;i++) {
BString item;
@@ -604,9 +639,10 @@
path.SetTo(&cookiedirref);
temp=path.Path();
} else {
- HTTP->AppSettings->FindString(kPrefsSettingsFilePath,&temp);
+ HTTP->AppSettings->FindString(kPrefsSettingsDirectory,&temp);
temp<<"/cookies";
}
+ printf("Cookie Directory: %s\n",temp.String() );
BEntry ent;
FindCookieDirPoint1:
ent.SetTo(temp.String());
@@ -735,13 +771,22 @@
}
int32 CookieManager::SetCookie(const char *header, const char *request_host, const char *request_uri,uint16 port,bool secure)
{
-// printf("CookieManager::SetCookie() header info: %s\n",header);
+ BAutolock alock(lock);
+ if (alock.IsLocked()) {
+ //printf("CookieManager::SetCookie() header info: %s\n",header);
/*
Determine how many cookies we might be receiving in this header. The default
is 1 as that seems to be the common and simplest case, however RFC 2109 specifies
that multiple may be sent separated by commas. Bastards. RFC 2965 doesn't really
state whether or not there can be multiple cookies in a Set-Cookie2 header...
*/
+ bool reject_cookie = false;
+ URIProcessor *URI = new URIProcessor(request_uri), *parentURI = new URIProcessor(), *pathURI = new URIProcessor();
+ if( request_uri[strlen(request_uri)-1] == '/') parentURI->Set(request_uri);
+ else URI->GetParent(parentURI);
+ const char *a = URI->String(), *b = parentURI->String();
+ //printf("URI/Parent:\n\t%s\n\t%s\n",a,b);
+ //printf("moving on...\n");
const char *known_attributes[]= {
"Comment",
"CommentURL",
@@ -753,509 +798,396 @@
"Port",
"Secure",//secure and discard don't have values
"Discard",
+ "HTTPOnly",
NULL
};
int32 header_length=strlen(header);
char *header_copy=new char[header_length+1];
memset(header_copy,0,header_length+1);
- strcpy(header_copy,header);
+ strncpy(header_copy,header,header_length);
int32 cookie_count=1;
int32 comma_count=0;
char *comma=NULL;
char *equal=NULL;
- char *temp=NULL,*temp2=NULL;
+ char *temp=NULL,*temp2=NULL, *nvpairs = NULL;
int32 distance=0;
int32 counter=0;
+ int32 current_time = real_time_clock();
+ bool abort = false;
bool found=false;
- comma=strchr(header_copy,',');
+ char **cookie_array=NULL;
+ bool has_attributes = false;
+// comma=strchr(header_copy,',');
// printf("comma: %s\n",comma);
- while (comma!=NULL)
- {
-// printf("searching for cookies...\n");
- comma_count++;
- if (comma!=NULL)
+ // First, lets deal only with the cookie setting portion. If there are any attributes, they will be after a semicolon, so we're going to deal only with the part before any
+ // present semicolons.
+ char *semicolon = strchr(header_copy,';');
+ if( semicolon != NULL)
+ {// semicolon found, isolate cookie name-value pairs
+ distance = semicolon-header_copy;
+ has_attributes = true;
+ }// semicolon found, isolate cookie name-value pairs
+ else
+ {// no semicolon found, no attributes, so just copy the header portion
+ distance = header_length;
+ }// no semicolon found, no attributes, so just copy the header portion
+ //printf("distance (cookie bytes): %d\n",distance);
+ nvpairs = new char[distance+1];
+ memset(nvpairs,0,distance+1);
+ strncpy(nvpairs,header_copy,distance);
+ //printf("isolated pair(s): %s\n",nvpairs);
+ // Check to see if there are multiple name-value pairs within the nvpairs variable
+ comma = strchr(nvpairs,',');
+ uint32 nvpair_counter = 0;
+ if( comma != NULL)
+ { // we have at least one comma, check out the rest for nv pairs
+ nvpair_counter = 1;
+ for(int32 i=0; i< (strlen(nvpairs)-1); i++)
+ {// kick it old school
+ if( nvpairs[i] == ',' && strchr((nvpairs+i),'=') != NULL)
+ nvpair_counter++;
+ }// kick it old school
+ printf("name=value pairs: %d\n",nvpair_counter);
+ cookie_array = new char*[nvpair_counter];
+ int32 pair_length = 0;
+ if( nvpair_counter > 1)
{
- //Check to see if there is a attribute-value pair after this comma
- equal=strchr(comma,'=');
- if (equal!=NULL)
+ for(uint32 i=0; i<nvpair_counter; i++)
{
- //Ok, there is at least one attribute-value pair after this comma.
- //Let's copy the data and do some analyzing.
- distance=equal-(comma+1);
- temp=new char[distance+1];
- memset(temp,0,distance+1);
- strncpy(temp,comma+1,distance);
- temp2=trim(temp);//strip away extra whitespace
- delete temp;
- temp=temp2;//I prefer working with the original temp variable
- temp2=NULL;
- //we should now have the attribute part of the attribute-value pair.
- //either that or we have everything after the day of the week of an
- //expiration date expression plus semicolon, and the attribute part of
- //an attribute-value pair.
-// printf("temp: %s\n",temp);
- found=false;
- //Make sure we don't have part of the date stuck in there...
- int32 length=strlen(temp);
- found=false;
- for (int i=0; i<length; i++)
- if (isspace(temp[i]))
- {
- found=true;
- break;
- }
- if (found)
- {
- int32 real_length=0;
- //we do have white space in the string, probably part of the date.
- //lets start at the end of the string, and work backwards...
- for (int32 i=length; i>=0; i--)
- {
- if (isspace(temp[i]))
- {
- //we found the first white space character, stop moving backwards.
- real_length=length-i;
- temp2=new char[real_length+1];
- memset(temp2,0,real_length+1);
- strncpy(temp2,temp+i+1,real_length);
- memset(temp,0,length);
- delete temp;
- temp=temp2;
- temp2=NULL;
-// printf("New version of temp: %s\n",temp);
- break;
- }
- }
- }
- while (known_attributes[counter]!=NULL)
+ if( i == 0)
{
- if (strcasecmp(temp,known_attributes[counter])==0)
- {
-// printf("This is a known attribute.\n");
- found=true;
- break;
- }
- counter++;
+ temp = strtok(nvpairs,",");
}
- if (!found)
+ else
{
- //if there are spaces in the string, then we likely have the date
- //and part of an attribute string...
-// printf("This is an excellent cookie attribute candidate: %s\n",temp);
- cookie_count++;
+ temp = strtok(NULL,",");
+ }
+ if( temp != NULL)
+ {
+ temp2 = trim(temp);
+ pair_length = strlen(temp2);
+ cookie_array[i] = new char[pair_length+1];
+ memset(cookie_array[i],0,pair_length+1);
+ strncpy(cookie_array[i],temp2,pair_length);
+ memset(temp2,0,pair_length+1);
+ delete temp2;
}
- counter=0;
- delete temp;
- temp=NULL;
}
}
- comma=strchr(comma+1,',');
- }
-// printf("estimated cookie count: %ld\n",cookie_count);
- /*
- Rinse and repeat: make it count this time.
- */
- char **cookie_array=new char*[cookie_count];
- cookie_array[0]=header_copy;
- if (cookie_count>1)
- {
- comma=strchr(header_copy,',');
-// printf("comma: %s\n",comma);
-// char *start=NULL;
- int32 offset=0;
- int32 cookie_count2=1;
- while (comma!=NULL)
- {
- comma_count++;
- if (comma!=NULL)
+ else
{
- //Check to see if there is a attribute-value pair after this comma
- equal=strchr(comma,'=');
- if (equal!=NULL)
+ cookie_array = new char*[1];
+ cookie_array[0] = new char[distance+1];
+ memset(cookie_array[0],0,distance+1);
+ strncpy(cookie_array[0],nvpairs,distance);
+ }
+ } // we have at least one comma, check out the rest for nv pairs
+ else
+ {// we only have the one name-value pair, so fake it for simplicity's sake
+ nvpair_counter = 1;
+ cookie_array = new char*[1];
+ cookie_array[0] = new char[distance+1];
+ memset(cookie_array[0],0,distance+1);
+ strncpy(cookie_array[0],nvpairs,distance);
+ }// we only have the one name-value pair, so fake it for simplicity's sake
+ //for(uint32 i = 0; i < nvpair_counter; i++)
+ // printf("\t\tcookie pair %d: %s\n",(i+1),cookie_array[i]);
+ // ok, create entries for each name-value pair.
+ cookie_st *default_cookie = new cookie_st;
+ int32 tlen = strlen(parentURI->String());
+ default_cookie->path = new char[tlen+1];
+ memset(default_cookie->path,0,tlen+1);
+ strcpy(default_cookie->path,parentURI->String());
+ default_cookie->datereceived = current_time;
+ tlen = strlen(request_host);
+ default_cookie->domain = new char[tlen+1];
+ memset(default_cookie->domain,0,tlen+1);
+ strncpy(default_cookie->domain,request_host,tlen);
+ if( semicolon != NULL)
+ { // process the remaining cookie header info
+ int semicolons = 0, segments = 0;
+ char **attributes=NULL;
+ bool loop_first = true;
+ do
+ {
+ if( loop_first )
{
- //Ok, there is at least one attribute-value pair after this comma.
- //Let's copy the data and do some analyzing.
- offset=equal-header_copy+1;
- distance=equal-(comma+1);
- temp=new char[distance+1];
- memset(temp,0,distance+1);
- strncpy(temp,comma+1,distance);
- temp2=trim(temp);//strip away extra whitespace
- delete temp;
- temp=temp2;//I prefer working with the original temp variable
- temp2=NULL;
- //we should now have the attribute part of the attribute-value pair.
- //either that or we have everything after the day of the week of an
- //expiration date expression plus semicolon, and the attribute part of
- //an attribute-value pair.
-// printf("temp: %s\n",temp);
- found=false;
- //Make sure we don't have part of the date stuck in there...
- //If it's the date, there will be a semicolon between the comma and equal sign.
- int32 length=strlen(temp);
- found=false;
- if (strchr(temp,';')!=NULL)
- found=true;
-// for (int i=0; i<length; i++)
-// if (temp[i]==';')
-// {
-// found=true;
-// break;
-// }
- if (found)
- {
- int32 real_length=0;
- //we do have a semicolon in the string, we probably have part of the date.
- //lets start at the end of the string, and work backwards...
- for (int32 i=length; i>=0; i--)
- {
- offset--;
- if (isspace(temp[i]))
- {
- //we found the first white space character, stop moving backwards.
- offset++;
- real_length=length-i;
- temp2=new char[real_length+1];
- memset(temp2,0,real_length+1);
- strncpy(temp2,temp+i+1,real_length);
- memset(temp,0,length);
- delete temp;
- temp=temp2;
- temp2=NULL;
-// printf("New version of temp: %s\n",temp);
-// printf("header copy offset: %ld - %s\n",offset,header_copy+offset);
- break;
- }
- }
- } else
- {
- for (int32 i=length; i>=0; i--)
- {
- offset--;
- if (isspace(temp[i]))
- {
- offset++;
-// printf("header copy offset: %ld - %s\n",offset,header_copy+offset);
- break;
- }
- }
- }
- while (known_attributes[counter]!=NULL)
- {
- if (strcasecmp(temp,known_attributes[counter])==0)
- {
-// printf("This is a known attribute.\n");
- found=true;
- break;
- }
- counter++;
- }
- if (!found)
- {
- //if there are spaces in the string, then we likely have the date
- //and part of an attribute string...
-// printf("This is an excellent cookie attribute candidate: %s\n",temp);
-// start=
-// printf("header copy offset: %ld - %s\n",offset,header_copy+offset);
- cookie_array[cookie_count2]=header_copy+offset;
- *(header_copy+offset-1)=(char)NULL;
- cookie_count2++;
- *comma=(char)NULL;
- }
- counter=0;
- delete temp;
- temp=NULL;
+ temp = strchr(semicolon+1,';');
+ loop_first = false;
}
- }
- comma=strchr(comma+1,',');
- }
- }
-// for (int32 i=0; i<cookie_count; i++)
-// printf("cookie %d:\t%s\n",i+1,cookie_array[i]);
- /*
- Now lets start eating those cookies...
- */
- int32 semicolons=0,segments=1;;
- char *semicolon=NULL;
- char **attributes=NULL;
- cookie_st /**current_cookie=cookie_head,*/*new_cookie=NULL,*last_cookie=cookie_head;
- int32 currenttime=0;
- while(last_cookie!=NULL)
- {
- if (last_cookie->next==NULL)
- break;
- last_cookie=last_cookie->next;
- }
- for (int32 i=0; i<cookie_count; i++)
- {
- /*
- Count the attributes
- */
- semicolons=0;
- segments=1;
- semicolon=strchr(cookie_array[i],';');
- while (semicolon!=NULL)
+ else if( temp != NULL)
+ temp = strchr(temp+1,';');
+ if( temp != NULL) semicolons++;
+ } while( temp != NULL);
+ segments = semicolons+1;
+ printf("segments: %d\n",segments);
+ attributes = new char *[segments];
+ attributes[0] = trim(strtok(semicolon+1,";"));
+ for( int32 i=1; i<segments; i++)
{
- semicolons++;
- semicolon=strchr(semicolon+1,';');
+ attributes[i] = trim(strtok(NULL,";"));
}
- segments=semicolons+1;
- attributes=new char *[segments];
- if (semicolons>0)
+ for(int32 i = 0; i< segments; i++)
{
- attributes[0]=trim(strtok(cookie_array[i],";"));
- for (int32 j=1; j<segments; j++)
- attributes[j]=trim(strtok(NULL,";"));
- }
- new_cookie=new cookie_st;
- currenttime=real_time_clock();
- new_cookie->datereceived=mktime(localtime(¤ttime));
- bool saved=false;
- for (int32 j=0; j<segments; j++)
- {
- saved=false;
-// printf("segments: %s\n",attributes[j]);
- if (attributes[j]!=NULL)
+ //printf("\t\tcookie attributes: %s\n",attributes[i]);
+ for(int8 kac = 0; kac < 10; kac++)
{
- equal=strchr(attributes[j],'=');
- if (equal==NULL)
+ if(strncasecmp(attributes[i],known_attributes[kac],min_c(strlen(known_attributes[kac]),strlen(attributes[i]))) == 0)
{
- if (strcasecmp("secure",attributes[j])==0)
- new_cookie->secure=false;
- if (strcasecmp("discard",attributes[j])==0)
- new_cookie->discard=true;
- } else
- {
- int32 alen=equal-attributes[j];
- int32 vlen=strlen(attributes[j])-(alen+1);
- if (strncasecmp("expires",attributes[j],min_c(alen,7))==0)
+ //printf("\t\t\tattrib: %s\n",known_attributes[kac]);
+ if( strcasecmp(known_attributes[kac],"path") == 0 ) {
+ pathURI->Set(attvalue(attributes[i]));
+ if( default_cookie->path != NULL)
{
- if (vlen>0)
- {
- temp=new char[vlen+1];
- memset(temp,0,vlen+1);
- strncpy(temp,equal+1,vlen);
- Date date(temp);
- memset(temp,0,vlen+1);
- delete temp;
- temp=NULL;
- new_cookie->expiredate=date.Timestamp();
-// new_cookie->expiredate=mktime(localtime(&new_cookie->expiredate));
- new_cookie->maxage=new_cookie->expiredate-currenttime;
- new_cookie->discard=false;
- }
- continue;
+ memset(default_cookie->path,0,strlen(default_cookie->path)+1);
+ delete default_cookie->path;
+ default_cookie->path = NULL;
}
- if (strncasecmp("max-age",attributes[j],min_c(alen,7))==0)
- {
- if (vlen>0)
+ if( strictMode)
{
- temp=new char[vlen+1];
- memset(temp,0,vlen+1);
- strncpy(temp,equal+1,vlen);
- new_cookie->maxage=atol(temp);
- memset(temp,0,vlen+1);
- delete temp;
- temp=NULL;
- new_cookie->expiredate=currenttime+new_cookie->maxage;
- new_cookie->discard=false;
+ default_cookie->path = new char[pathURI->Length()+1];
+ memset(default_cookie->path,0,pathURI->Length()+1);
+ strncpy(default_cookie->path,pathURI->String(),pathURI->Length());
+ if( pathURI->Contains(parentURI->String()) || parentURI->Contains(pathURI->String()) )
+ {
+ //printf("\t\t\t\tsetting cookie path to %s\n",pathURI->String());
+ }
+ else
+ {
+ //printf("cookie path isn't parent of request uri and isn't a child of the request uri's parent path; flagging cookie for rejection.\n");
+ reject_cookie = true;
+ }
}
- continue;
- }
- if (strncasecmp("version",attributes[j],min_c(alen,7))==0)
- {
- if (vlen>0)
+ else
{
- temp=new char[vlen+1];
- memset(temp,0,vlen+1);
- strncpy(temp,equal+1,vlen);
- new_cookie->version=atoi(temp);
- memset(temp,0,vlen+1);
- delete temp;
- temp=NULL;
+ default_cookie->path = new char[pathURI->Length()+1];
+ memset(default_cookie->path,0,pathURI->Length()+1);
+ strncpy(default_cookie->path,pathURI->String(),pathURI->Length());
}
- continue;
}
- if (strncasecmp("domain",attributes[j],min_c(alen,6))==0)
- {
- if (vlen>0)
+ else if( strcasecmp(known_attributes[kac],"expires") == 0) {
+ Date date(attvalue(attributes[i]));
+ default_cookie->expiredate = date.Timestamp();
+ default_cookie->expiredate = mktime(localtime(&default_cookie->expiredate));
+ default_cookie->maxage = default_cookie->expiredate - current_time;
+ default_cookie->session = false;
+ /*
+ if( default_cookie->expiredate < current_time)
{
- new_cookie->domain=new char[vlen+1];
- memset(new_cookie->domain,0,vlen+1);
- strncpy(new_cookie->domain,equal+1,vlen);
- } else
- {
- new_cookie->domain=new char[strlen(request_host)+1];
- memset(new_cookie->domain,0,strlen(request_host)+1);
- strcpy(new_cookie->domain,request_host);
+ printf("expiration time has already passed\n");
+ //default_cookie->discard = true;
}
- continue;
+ */
}
- if (strncasecmp("path",attributes[j],min_c(alen,4))==0)
- {
-/*
- This section should eventually be migrated to utilize the URI processor with code
- similar to:
- URIProcessor uri(equal+1);
- if ((uri.String())[uri.Length()-1]!='/')
- uri.GetParent(&uri);
- new_cookie->path=new char[uri.Length()+1];
- memset(new_cookie->path,0,uri.Length()+1);
- strcpy(new_cookie->path,uri.String());
- The catch is that cookie paths are not supposed to end in a '/' unless the path is
- the root path. There is another instance with similar needs below for path, in case
- the Set-cookie processing exits with a NULL value for path.
-*/
- if (vlen>0)
+ else if( strcasecmp(known_attributes[kac],"domain") == 0 ) {
+ printf("\t\t\t\tdomain: %s\n",attvalue(attributes[i]));
+ if( default_cookie->domain != NULL)
{
- new_cookie->path=new char[vlen+1];
- memset(new_cookie->path,0,vlen+1);
- strncpy(new_cookie->path,equal+1,vlen);
- } else
- {
- if (strlen(request_uri)>1)
- {
- char *last_slash=strrchr(request_uri,'/');
- int32 len=(last_slash-request_uri);
- new_cookie->path=new char[len+1];
- memset(new_cookie->path,0,len+1);
- strncpy(new_cookie->path,request_uri,len);
- } else
- {
- new_cookie->path=new char[2];
- strcpy(new_cookie->path,"/\0");
- }
+ memset(default_cookie->domain,0,strlen(default_cookie->domain)+1);
+ delete default_cookie->domain;
+ default_cookie->domain = NULL;
}
- continue;
+ char *d = attvalue(attributes[i]);
+ int32 len = strlen(d);
+ default_cookie->domain = new char[len+1];
+ memset(default_cookie->domain,0,len+1);
+ strncpy(default_cookie->domain,d,len);
}
- if (strncasecmp("comment",attributes[j],min_c(alen,7))==0)
- {
- if (vlen>0)
+ else if( strcasecmp(known_attributes[kac],"secure") == 0) {
+ default_cookie->secure = true;
+ }
+ else if( strcasecmp(known_attributes[kac],"httponly") == 0 ) {
+ default_cookie->httponly = true;
+ }
+ else if( strcasecmp(known_attributes[kac],"comment") == 0 ) {
+ if( default_cookie->comment != NULL)
{
- new_cookie->comment=new char[vlen+1];
- memset(new_cookie->comment,0,vlen+1);
- strncpy(new_cookie->comment,equal+1,vlen);
+ memset(default_cookie->comment,0,strlen(default_cookie->comment)+1);
+ delete default_cookie->comment;
+ default_cookie->comment = NULL;
}
- continue;
+ char *comment = attvalue(attributes[i]);
+ int32 len = strlen(comment);
+ default_cookie->comment = new char[len+1];
+ memset(default_cookie->comment,0,len+1);
+ strncpy(default_cookie->comment,comment,len);
}
- if (strncasecmp("commenturl",attributes[j],min_c(alen,10))==0)
- {
- if (vlen>0)
+ else if( strcasecmp(known_attributes[kac],"commenturl") == 0 ) {
+ if( default_cookie->commenturl != NULL)
{
- new_cookie->commenturl=new char[vlen+1];
- memset(new_cookie->commenturl,0,vlen+1);
- strncpy(new_cookie->commenturl,equal+1,vlen);
+ memset(default_cookie->commenturl,0,strlen(default_cookie->commenturl)+1);
+ delete default_cookie->commenturl;
+ default_cookie->commenturl = NULL;
}
- continue;
+ char *commenturl = attvalue(attributes[i]);
+ int32 len = strlen(commenturl);
+ default_cookie->commenturl = new char[len+1];
+ memset(default_cookie->commenturl,0,len+1);
+ strncpy(default_cookie->commenturl,commenturl,len);
}
- if (strncasecmp("port",attributes[j],min_c(alen,4))==0)
- {
- if (vlen>0)
+ else if( strcasecmp(known_attributes[kac],"max-age") == 0) {
+ default_cookie->session = false;
+ default_cookie->maxage = atol(attvalue(attributes[i]));
+ default_cookie->expiredate = current_time+default_cookie->maxage;
+ if( default_cookie->maxage == 0)
{
- new_cookie->ports=new char[vlen+1];
- memset(new_cookie->ports,0,vlen+1);
- strncpy(new_cookie->ports,equal+1,vlen);
- } else
- {
- new_cookie->ports=new char[8];
- memset(new_cookie->ports,0,8);
- sprintf(new_cookie->ports,"\"%u\"",port);
+ abort = true;
+ default_cookie->discard = true;
}
- continue;
}
- /*
- If it's none of the above attributes, then it has to be the
- cookie name as set by the URL.
- */
- new_cookie->name=new char[alen+1];
- new_cookie->value=new char[vlen+1];
- memset(new_cookie->name,0,alen+1);
- memset(new_cookie->value,0,vlen+1);
- strncpy(new_cookie->name,attributes[j],alen);
- strncpy(new_cookie->value,equal+1,vlen);
+ else if( strcasecmp(known_attributes[kac],"discard") == 0) {
+ default_cookie->discard = true;
+ default_cookie->session = true;
+ }
+ else if( strcasecmp(known_attributes[kac],"ports") == 0 ) {
+ }
+ else if( strcasecmp(known_attributes[kac],"version") == 0) {
+ default_cookie->version = atoi(attvalue(attributes[i]));
+ }
+ break;
}
- memset(attributes[j],0,strlen(attributes[j])+1);
- delete attributes[j];
- attributes[j]=NULL;
}
}
- if (new_cookie->domain==NULL)
+ delete []attributes;
+ } // process the remaining cookie header info
+ cookie_st *new_cookie = NULL,*last_cookie = cookie_head, *original = NULL;
+ char **nvarr = new char*[2];
+ if( last_cookie != NULL)
+ {
+ while( last_cookie->next != NULL)
+ last_cookie = last_cookie->next;
+ }
+ char *buf = NULL,*eq = NULL;
+ for( int32 i=0; i< nvpair_counter; i++)
+ {
+ tlen = strlen(cookie_array[i]);
+ buf = new char[tlen+1];
+ memset(buf,0,tlen+1);
+ strncpy(buf,cookie_array[i],tlen);
+ eq = strchr(buf,'=');
+ tlen = eq-buf;
+ nvarr[0] = strtok(buf,"=");
+ nvarr[1] = strtok(NULL,"=");
+ //printf("name: %s\tvalue: %s\n",nvarr[0],nvarr[1]);
+ new_cookie = new cookie_st(default_cookie);
+ if( nvarr[0] != NULL ) {
+ tlen = strlen(nvarr[0]);
+ new_cookie->name = new char[tlen+1];
+ memset(new_cookie->name,0,tlen+1);
+ strncpy(new_cookie->name,nvarr[0],tlen);
+ }
+ else
{
- new_cookie->domain=new char[strlen(request_host)+1];
- memset(new_cookie->domain,0,strlen(request_host)+1);
- strcpy(new_cookie->domain,request_host);
+ new_cookie->name = NULL;
}
- if (new_cookie->path==NULL)
+ if(nvarr[1] != NULL) {
+ tlen = strlen(nvarr[1]);
+ new_cookie->value = new char[tlen+1];
+ memset(new_cookie->value,0,tlen+1);
+ strncpy(new_cookie->value,nvarr[1],tlen);
+ }
+ else
{
- if (strlen(request_uri)>1)
- {
- char *last_slash=strrchr(request_uri,'/');
- int32 len=(last_slash-request_uri);
- new_cookie->path=new char[len+1];
- memset(new_cookie->path,0,len+1);
- strncpy(new_cookie->path,request_uri,len);
- } else
- {
- new_cookie->path=new char[2];
- strcpy(new_cookie->path,"/\0");
- }
+ new_cookie->value = NULL;
+
}
- if (new_cookie->expiredate==0)
- new_cookie->expiredate=currenttime+new_cookie->maxage;
- /*
- The DuplicatedCookie check was moved to before the validation check
- to make sure that any attempt to expire a cookie (by updating the expiration
- date to an already past date/time) will succeed. The original will then die
- off on its own. Otherwise, the original would linger until its original
- expiration date/time passed.
- */
- if (DuplicatedCookie(new_cookie))
+ delete buf;
+// delete nvarr[0];
+// delete nvarr[1];
+ if( DuplicatedCookie(new_cookie) )
{
- cookie_st *original=FindCookie(new_cookie->name,new_cookie->path,new_cookie->domain);
- original->expiredate=new_cookie->expiredate;
- original->discard=new_cookie->discard;
- original->secure=new_cookie->secure;
- original->version=new_cookie->version;
- original->maxage=new_cookie->maxage;
- if (!original->discard)
+ original = FindCookie(new_cookie->name,new_cookie->path, new_cookie->domain);
+ printf("found cookie %s, updating value from \"%s\" to \"%s\"\n",new_cookie->name,original->value,new_cookie->value);
+ if( original->secure == new_cookie->secure )
{
+ original->discard = new_cookie->discard;
+ original->session = new_cookie->session;
+ original->httponly = new_cookie->httponly;
+ original->expiredate = new_cookie->expiredate;
+ original->maxage = new_cookie->maxage;
+ original->datereceived = new_cookie->datereceived;
+ original->version = new_cookie->version;
+ if( original->value != NULL) {
+ tlen = strlen(original->value);
+ memset(original->value,0,tlen+1);
+ delete original->value;
+ original->value = NULL;
+ }
+ if( new_cookie->value != NULL ) {
+ tlen = strlen(new_cookie->value);
+ original->value = new char[tlen+1];
+ memset(original->value,0,tlen+1);
+ strncpy(original->value,new_cookie->value,tlen);
+ }
+ if( original->comment != NULL)
+ {
+ tlen = strlen(original->comment);
+ memset(original->comment,0,tlen+1);
+ delete original->comment;
+ if(new_cookie->comment != NULL)
+ {
+ tlen = strlen(new_cookie->comment);
+ original->comment = new char[tlen+1];
+ memset(original->comment,0,tlen+1);
+ strncpy(original->comment,new_cookie->comment,tlen);
+ }
+ }
+ if( original->commenturl != NULL)
+ {
+ tlen = strlen(original->commenturl);
+ memset(original->commenturl,0,tlen+1);
+ delete original->commenturl;
+ if(new_cookie->commenturl != NULL)
+ {
+ tlen = strlen(new_cookie->commenturl);
+ original->commenturl = new char[tlen+1];
+ memset(original->commenturl,0,tlen+1);
+ strncpy(original->commenturl,new_cookie->commenturl,tlen);
+ }
+ }
SaveCookie(original);
- saved=true;
+ delete new_cookie;
+ continue;
}
-// printf("Original Cookie Updated\n");
-// PrintCookie(original);
- original->maxage=-1;//trigger a validation failure to delete the new copy.
}
- if (!Validate(new_cookie,request_host,request_uri))
+ if( Validate(new_cookie,request_host,request_uri) )
{
- delete new_cookie;
- continue;
+ //printf("Validation succeeded\n discard? %s\n", (new_cookie->discard ? "yes":"no"));
+ if( new_cookie->discard != true) SaveCookie(new_cookie);
+ if(cookie_head == NULL )
+ {
+ cookie_head = new_cookie;
+ last_cookie = cookie_head;
+ }
+ else
+ {
+ last_cookie->next = new_cookie;
+ last_cookie = last_cookie->next;
+ }
}
- if (!saved)
+ else
{
- SaveCookie(new_cookie);
- saved=true;
+ //printf("Validation failed\n");
+ delete new_cookie;
}
- delete []attributes;
- if (cookie_head==NULL)
- {
- cookie_head=new_cookie;
- last_cookie=cookie_head;
-
- } else
- {
- last_cookie->next=new_cookie;
- last_cookie=last_cookie->next;
- }
+ //PrintCookie(new_cookie);
+ //delete new_cookie;
}
+ delete default_cookie;
+ delete []nvarr;
delete []cookie_array;
cookie_array=NULL;
memset(header_copy,0,header_length+1);
delete header_copy;
header_copy=NULL;
+}
+ //ClearExpiredCookies();
return B_OK;
}
+void CookieManager::ProcessAttributes(char **attributes, cookie_st *cookie, const char *request_host, const char *request_uri)
+{
+}
cookie_st *CookieManager::FindCookie(const char *name,const char *path,const char *domain)
{
cookie_st *current=cookie_head;
@@ -1284,7 +1216,7 @@
if (
strcmp(cookie->name,current->name)==0 &&
strcmp(cookie->path,current->path)==0 &&
- strcasecmp(cookie->domain,current->domain)==0
+ strcasecmp(cookie->domain,current->domain)==0 && cookie->secure == current->secure
)
{
found=true;
@@ -1415,13 +1347,14 @@
cookie_st *cur=cookie_head, *last=NULL;
while (cur!=NULL) {
// printf("Expire %s: current time: %ld\texpire time: %ld\tdifference: %2.2f\n",cur->name,currenttime,cur->expiredate,difftime(cur->expiredate,currenttime));
- if (cur->expiredate<=currenttime) {
+ if (cur->session == false && cur->discard == false && cur->expiredate<=currenttime) {
// printf("The following cookie has expired:\n");
// PrintCookie(cur);
if (cur==cookie_head) {
+ printf("ClearExpiredCookies line 1764: cur %p\n",cur);
cookie_head=cookie_head->next;
BEntry ent(&cur->ref);
- if (ent.Exists())
+ if (ent.InitCheck() == B_OK && ent.Exists())
ent.Remove();
delete cur;
last=cur=cookie_head;
@@ -1463,6 +1396,7 @@
printf("\tName:\t%s\n\tValue:\t%s\n",cookie->name,cookie->value);
printf("\tExpiration Date:\t%s\n\tMax-Age:\t%ld\n",ctime(&cookie->expiredate),cookie->maxage);
printf("\tDate Received:\t%s\n",ctime(&cookie->datereceived));
+ printf("\tSession Cookie:\t%s\n",(cookie->session?"yes":"no"));
printf("\tDiscard On Close:\t%s\n",cookie->discard?"yes":"no");
printf("\tRequires Secure Connection:\t%s\n",cookie->secure?"yes":"no");
printf("\tVersion:\t%d\n",cookie->version);
@@ -1504,7 +1438,7 @@
return NULL;
}
bool CookieManager::Validate(cookie_st *cookie, const char *request_host, const char *request_uri) {
- PrintCookie(cookie);
+ //PrintCookie(cookie);
BAutolock alock(lock);
bool valid=false;
if (alock.IsLocked()) {
@@ -1512,10 +1446,15 @@
time_t currenttime=time(NULL);
currenttime=mktime(localtime(¤ttime));
// printf("expiredate: %ld\ncurrent time: %ld\n",cookie->expiredate, currenttime);
+ if( cookie->discard == false && cookie->session == false )
+ {
if (cookie->expiredate<=currenttime)
return ValidateFail("Cookie has already expired.");
if ((cookie->maxage+cookie->datereceived)<=currenttime)
return ValidateFail("Cookie has already expired.");
+ }
+ else if( cookie->discard ) printf("Cookie is marked for discarding.\n");
+ else if( cookie->session ) printf("Cookie is a session cookie.\n");
if (cookie->domain==NULL)
return ValidateFail("Cookie domain is NULL.");
else {
@@ -1540,7 +1479,7 @@
dots++;
}
if (dots<2)
- return ValidateFail("There domain contained no embedded dots. (4.3.2:2)");
+ return ValidateFail("Their domain contained no embedded dots. (4.3.2:2)");
if (strlen(cookie->domain)>strlen(request_host)) {
return ValidateFail("Cookie domain is longer than request host's domain.");
}
@@ -1632,6 +1571,8 @@
case B_BOOL_TYPE:{
if (strcasecmp(attname,"Themis:cookiesecure")==0)
node.ReadAttr("Themis:cookiesecure",B_BOOL_TYPE,0,&cookie->secure,ai.size);
+ if(strcasecmp(attname,"Themis:httponly") == 0 )
+ node.ReadAttr("Themis:httponly",B_BOOL_TYPE,0,&cookie->httponly,ai.size);
}break;
}
delete data;
@@ -1642,28 +1583,35 @@
if ((cookie->datereceived!=0) && (cookie->expiredate!=0)) {
cookie->maxage=cookie->expiredate-cookie->datereceived;
}
-
+ //PrintCookie(cookie);
return B_OK;
}
status_t CookieManager::SaveCookie(cookie_st *cookie) {
if (cookie==NULL)
return B_ERROR;
- if (cookie->discard)
+ if (cookie->discard || cookie->session)
return B_NO_ERROR;
BEntry ent(&cookie->ref,true);
if (ent.InitCheck()==B_OK) {
SaveCookiePoint1:
+ BPath testPath;
+ ent.GetPath(&testPath);
+ //printf("Saving cookie to: %s\n",testPath.Path());
BFile file(&ent,B_CREATE_FILE|B_ERASE_FILE|B_WRITE_ONLY);
+ BNodeInfo nodeInfo(&file);
+ nodeInfo.SetType(ThemisCookieFile);
+ nodeInfo.SetTo(NULL);
file.Unset();
BNode node(&cookie->ref);
node.Lock();
- char *type=new char[strlen(ThemisCookieFile)+1];
- memset(type,0,strlen(ThemisCookieFile)+1);
- strcpy(type,ThemisCookieFile);
- node.WriteAttr("BEOS:TYPE",B_STRING_TYPE,0,type,strlen(ThemisCookieFile)+1);
- delete type;
+ //char *type=new char[strlen(ThemisCookieFile)+1];
+ //memset(type,0,strlen(ThemisCookieFile)+1);
+ //strcpy(type,ThemisCookieFile);
+ //node.WriteAttr("BEOS:TYPE",B_STRING_TYPE,0,type,strlen(ThemisCookieFile)+1);
+ //delete type;
node.WriteAttr("Themis:cookiesecure",B_BOOL_TYPE,0,&cookie->secure,sizeof(cookie->secure));
+ node.WriteAttr("Themis:httponly",B_BOOL_TYPE,0,&cookie->httponly,sizeof(cookie->httponly));
node.WriteAttr("Themis:creceivedate",B_INT32_TYPE,0,&cookie->datereceived,sizeof(cookie->datereceived));
node.WriteAttr("Themis:expiredate",B_INT32_TYPE,0,&cookie->expiredate,sizeof(cookie->expiredate));
if (cookie->domain!=NULL)
@@ -1674,6 +1622,11 @@
node.WriteAttr("Themis:cookiename",B_STRING_TYPE,0,cookie->name,strlen(cookie->name)+1);
if (cookie->value!=NULL)
node.WriteAttr("Themis:cookievalue",B_STRING_TYPE,0,cookie->value,strlen(cookie->value)+1);
+ else
+ {
+ status_t res = node.RemoveAttr("Themis:cookievalue");
+ printf("removal of cookievalue attribute (null cookie value) successful? %s\n", (res == B_OK ? "yes":"no"));
+ }
if (cookie->version==1)
if (cookie->ports!=NULL)
node.WriteAttr("Themis:cookieports",B_STRING_TYPE,0,cookie->ports,strlen(cookie->ports)+1);
@@ -1691,6 +1644,7 @@
path.Append(fname.String());
ent.SetTo(path.Path());
ent.GetRef(&cookie->ref);
+ printf("Cookie will be saved to: %s\n",path.Path());
goto SaveCookiePoint1;
}
@@ -1699,8 +1653,59 @@
}
void CookieManager::LoadAllCookies() {
+ uint32 count = 0;
BAutolock alock(lock);
if (alock.IsLocked()) {
+ entry_ref cookiedirref,current_ref;
+
+ if (CookieSettings->FindRef("cookie_ref",&cookiedirref)==B_OK) {
+ BDirectory *dir = new BDirectory(&cookiedirref);
+ BPath path;
+ BNode node;
+ BNodeInfo nodeinfo;
+ char mime[B_MIME_TYPE_LENGTH+1];
+ cookie_st *curcookie=cookie_head;
+ cookie_st *nucookie=NULL;
+ if( curcookie != NULL)
+ {
+ //This function should only get called at initialization; if there are already cookies loaded, remove them...
+ while( cookie_head != NULL)
+ {
+ curcookie = cookie_head->next;
+ delete cookie_head;
+ cookie_head = curcookie;
+ }
+ }
+ while( dir->GetNextRef(¤t_ref) == B_OK) {
+ path.SetTo(¤t_ref);
+ //printf("Looking at: %s\n",path.Path());
+ node.SetTo(¤t_ref);
+ nodeinfo.SetTo(&node);
+ memset(mime,0,B_MIME_TYPE_LENGTH+1);
+ nodeinfo.GetType(mime);
+ if( strcasecmp(mime,ThemisCookieFile) == 0 )
+ {
+ //printf("We have a cookie!\n");
+ nucookie = new cookie_st;
+ nucookie->ref = current_ref;
+ LoadCookie(nucookie);
+ count++;
+ if(cookie_head == NULL)
+ {
+ cookie_head = nucookie;
+ curcookie = cookie_head;
+ }
+ else
+ {
+ curcookie->next = nucookie;
+ curcookie = curcookie->next;
+ }
+ }
+ node.Unset();
+ nodeinfo.SetTo(NULL);
+ }
+ }
+ /*
BPath trashpath;
BDirectory *trashdir;
if (find_directory(B_TRASH_DIRECTORY,&trashpath)==B_OK) {
@@ -1709,6 +1714,8 @@
trashdir=new BDirectory("/boot/home/Desktop/Trash");
}
BEntry ent(&cookiedirref,true);
+ BPath tempP(&ent);
+ printf("Looking for cookies at %s\n",tempP.Path());
struct stat devstat;
ent.GetStat(&devstat);
BVolume vol(devstat.st_dev);
@@ -1717,7 +1724,22 @@
query.PushAttr("BEOS:TYPE");
query.PushString(ThemisCookieFile);
query.PushOp(B_EQ);
- query.Fetch();
+ status_t status = query.Fetch();
+ switch(status)
+ {
+ case B_OK: {
+ printf("Query is fine, still may not have a result though...\n");
+ }break;
+ case B_NO_INIT: {
+ printf("Query fetch returned B_NO_INIT\n");
+ }break;
+ case B_BAD_VALUE: {
+ printf("Query fetch returned B_BAD_VALUE\n");
+ }break;
+ case B_NOT_ALLOWED: {
+ printf("Query fetch returned B_NOT_ALLOWED, you already fetched?\n");
+ }break;
+ }
ent.Unset();
BPath path;
entry_ref ref;
@@ -1729,7 +1751,7 @@
continue;
ent.GetRef(&ref);
path.SetTo(&ref);
-// printf("cookie file at: %s\n",path.Path());
+ printf("cookie file at: %s\n",path.Path());
nucookie=new cookie_st;
nucookie->ref=ref;
if (curcookie==NULL) {
@@ -1754,8 +1776,10 @@
}
// printf("%ld cookie(s) loaded.\n",count);
delete trashdir;
+ */
}
- PrintCookies();
+ //PrintCookies();
+ printf("%u cookie(s) loaded\n",count);
}
void CookieManager::SaveAllCookies() {
Modified: trunk/themis/modules/http/cookieman.h
===================================================================
--- trunk/themis/modules/http/cookieman.h 2011-01-09 19:06:43 UTC (rev 601)
+++ trunk/themis/modules/http/cookieman.h 2011-01-09 19:32:38 UTC (rev 602)
@@ -43,6 +43,7 @@
#include <Locker.h>
#include <Message.h>
#include "msgsystem.h"
+#include "prefsman.h"
//Set-Cookie: VisitorID=4; expires=Wed, 18-Feb-2004 04:15:52 GMT; path=/
//Set-Cookie: NewVisitor=Yes; expires=Wed, 19-Feb-2003 06:15:52 GMT; path=/
@@ -77,6 +78,10 @@
bool secure;
//! Determines whether the cookie will be stored more permanently than the current browser session.
bool discard;
+ //! Session cookie
+ bool session;
+ //! Determines whether the cookie should be transmitted for HTTP requests only, or should allow Javascript ones as well.
+ bool httponly;
//! The Unix time stamp of when the cookie should expire.
int32 expiredate;
//! The Unix time stamp from when the cookie was received. Used in combination with maxage.
@@ -97,7 +102,9 @@
entry_ref ref;
cookie_st() {
discard=true;//discard cookie on shutdown if not set to false later
+ session = true; //same as discard, mostly, except there is a specific cookie flag for discard, but not for session
secure=false;
+ httponly = false;//not particularly useful right now. RR 1/9/2011
name=NULL;
value=NULL;
path=NULL;
@@ -111,9 +118,45 @@
next=NULL;
version=0;
}
+ cookie_st(cookie_st *DEFAULT) {
+ discard = DEFAULT->discard;
+ session = DEFAULT->session;
+ secure = DEFAULT->secure;
+ httponly = DEFAULT->httponly;
+ int len = strlen(DEFAULT->path);
+ path = new char[len+1];
+ memset(path,0,len+1);
+ strncpy(path,DEFAULT->path,len);
+ len = strlen(DEFAULT->domain);
+ domain = new char[len+1];
+ memset(domain,0,len+1);
+ strncpy(domain,DEFAULT->domain,len);
+ expiredate = DEFAULT->expiredate;
+ datereceived = DEFAULT->datereceived;
+ maxage = DEFAULT->maxage;
+ ports = NULL;
+ next = NULL;
+ version = DEFAULT->version;
+ if( DEFAULT->comment != NULL)
+ {
+ len = strlen(DEFAULT->comment);
+ comment = new char[len+1];
+ memset(comment,0,len+1);
+ strncpy(comment,DEFAULT->comment,len);
+ }
+ else comment = NULL;
+ if( DEFAULT->commenturl != NULL)
+ {
+ len = strlen(DEFAULT->commenturl);
+ commenturl = new char[len+1];
+ memset(commenturl,0,len+1);
+ strncpy(commenturl,DEFAULT->commenturl,len);
+ }
+ else commenturl = NULL;
+ }
~cookie_st() {
if (name) {
- printf("%p - name: %s\n",this,name);
+ //printf("%p - name: %s\n",this,name);
memset(name,0,strlen(name));
delete name;
@@ -170,6 +213,8 @@
*/
class CookieManager:public MessageSystem {
private:
+ PrefsManager *prefMan;
+ bool strictMode;
/*!
\brief This function breaks a cookie header up into it's name value pairs.
@@ -181,7 +226,7 @@
/*!
\brief This function processes a cookie's attributes into the provided cookie structure.
*/
- void ProcessAttributes(const char *attributes, cookie_st *cookie, const char *request_host, const char *request_uri);
+ void ProcessAttributes(char **attributes, cookie_st *cookie, const char *request_host, const char *request_uri);
//! The start of the cookie linked list.
cookie_st *cookie_head;
@@ -231,6 +276,7 @@
*/
bool DuplicatedCookie(cookie_st *cookie);
public:
+ static const uint32 EXPIRED = 'expc';
BMessage *CookieSettings;
/*!
\brief Finds cookies appropriate for the requested domain and URI.
Modified: trunk/themis/modules/http/httpv4.cpp
===================================================================
--- trunk/themis/modules/http/httpv4.cpp 2011-01-09 19:06:43 UTC (rev 601)
+++ trunk/themis/modules/http/httpv4.cpp 2011-01-09 19:32:38 UTC (rev 602)
@@ -925,7 +925,7 @@
case SupportedMIMEType:
{
// printf("Supported MIME Types returned\n");
-#warning Rewrite this section if at all possible...
+//#warning Rewrite this section if at all possible...
BString str;
int32 count=0;
type_code type;
@@ -1117,13 +1117,13 @@
switch (use_useragent)
{
case USER_AGENT_THEMIS:
- {
- new_item->request_string<<"User-Agent: Themis (http://themis.sourceforge.net)\r\n";
-
- }break;
+// {
+// new_item->request_string<<"User-Agent: Themis (http://themis.sourceforge.net)\r\n";
+//
+// }break;
case USER_AGENT_MOZILLA:
{
- new_item->request_string<<"User-Agent: Mozilla/5.0 (BeOS; BePC; rv: 4.0) Themis http://themis.sourceforge.net)\r\n";
+ new_item->request_string<<"User-Agent: Mozilla/5.0 (BeOS/Haiku; BePC; rv: 4.0) Themis\r\n";
}break;
case USER_AGENT_INTERNETEXPLORER:
{
@@ -2355,7 +2355,7 @@
BString temp;//available for anything that might need it.
while (current!=NULL)
{
-// printf("\t%s:\t%s\n",current->attribute,current->value);
+// printf("%s:%d\t%s:\t%s\n",__FILE__,__LINE__,current->attribute,current->value);
if (strcasecmp("warning",current->attribute)==0)
{
BString warning;
@@ -2410,6 +2410,7 @@
{
if (enable_cookies)
{
+ printf("Calling SetCookie:\n\theader: %s\n\thost: %s\n\turi: %s\n",current->value,request->host,request->uri);
CookieMonster->SetCookie(current->value,request->host, request->uri,request->port,request->secure);
}
}
@@ -2915,3 +2916,12 @@
else
return false;
}
+
+char * HTTPv4::SettingsViewLabel()
+{
+ return "HTTP";
+}
+BView * HTTPv4::SettingsView(BRect frame)
+{
+ return NULL;
+}
Modified: trunk/themis/modules/http/httpv4.h
===================================================================
--- trunk/themis/modules/http/httpv4.h 2011-01-09 19:06:43 UTC (rev 601)
+++ trunk/themis/modules/http/httpv4.h 2011-01-09 19:32:38 UTC (rev 602)
@@ -395,6 +395,8 @@
*/
bool Compressed(http_request_info_st *request);
public:
+ char *SettingsViewLabel();
+ BView *SettingsView(BRect frame);
/*!
\brief Find the specified header for the given HTTP request.
Modified: trunk/themis/modules/http/uriprocessor.cpp
===================================================================
--- trunk/themis/modules/http/uriprocessor.cpp 2011-01-09 19:06:43 UTC (rev 601)
+++ trunk/themis/modules/http/uriprocessor.cpp 2011-01-09 19:32:38 UTC (rev 602)
@@ -120,7 +120,7 @@
bool URIProcessor::Contains(const char *URI)
{
uint32 length=strlen(uri);
- if (strlen(URI)>length)
+ if (strlen(URI)<length)
return false;
if (strncmp(uri,URI,min_c(length,strlen(URI)))==0)
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-09 19:06:49
|
Revision: 601
http://themis.svn.sourceforge.net/themis/?rev=601&view=rev
Author: z3r0_one
Date: 2011-01-09 19:06:43 +0000 (Sun, 09 Jan 2011)
Log Message:
-----------
Adding prefsman.cpp to the makefile... it technically should have been there already, but wasn't
Modified Paths:
--------------
trunk/themis/makefile
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2011-01-09 17:48:40 UTC (rev 600)
+++ trunk/themis/makefile 2011-01-09 19:06:43 UTC (rev 601)
@@ -117,6 +117,7 @@
common/cacheobject.cpp \
common/stripwhite.cpp \
common/TTextView.cpp \
+ common/prefsman.cpp \
common/BasePrefsView.cpp \
common/BaseEntry.cpp
#add similar lines for new plugins, libraries, etc.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-09 17:48:46
|
Revision: 600
http://themis.svn.sourceforge.net/themis/?rev=600&view=rev
Author: mark_hellegers
Date: 2011-01-09 17:48:40 +0000 (Sun, 09 Jan 2011)
Log Message:
-----------
Moved sending the retrieve request from the SiteHandler to the window.
Modified Paths:
--------------
trunk/themis/framework/SiteHandler.cpp
trunk/themis/framework/SiteHandler.h
trunk/themis/framework/win.cpp
Modified: trunk/themis/framework/SiteHandler.cpp
===================================================================
--- trunk/themis/framework/SiteHandler.cpp 2011-01-09 16:23:31 UTC (rev 599)
+++ trunk/themis/framework/SiteHandler.cpp 2011-01-09 17:48:40 UTC (rev 600)
@@ -93,13 +93,13 @@
}
-SiteEntry * SiteHandler :: AddEntry(int32 aSiteID, const char * aUrl) {
-
- SiteEntry * entry = new SiteEntry(aSiteID, aUrl);
- fEntryList.push_back(entry);
+void SiteHandler :: AddEntry(SiteEntry * aEntry) {
- return entry;
-
+ fLocker->Lock();
+
+ fEntryList.push_back(aEntry);
+
+ fLocker->Unlock();
}
BBitmap * SiteHandler :: GetFavIconFor(int32 id) {
@@ -202,46 +202,9 @@
}
break;
}
- case SH_LOAD_NEW_PAGE:
- case SH_RELOAD_PAGE: {
- /* create a SiteEntry, and add it to fEntryList */
- int32 siteID;
- BString url;
- msg->FindInt32("site_id", &siteID);
- msg->FindString("url", &url);
-
- printf( "SiteHandler: adding following item: ID[%ld] URL[%s]\n", siteID, url.String() );
-
- SiteEntry * entry = AddEntry(siteID, url.String());
- /* Get an unique ID from the app */
- int32 urlID = ((App *)be_app)->GetNewID();
- UrlEntry * urlEntry = new UrlEntry(urlID, url.String());
- entry->addEntry(urlEntry);
-
- /*
- * Inform the protocol(s) to retrieve the site.
- * Remember, this is the workaround way, with an url_id > 0.
- */
-
- BMessage* retrieve = new BMessage(SH_RETRIEVE_START);
- retrieve->AddInt32("command", COMMAND_RETRIEVE);
- retrieve->AddInt32("site_id", siteID);
- retrieve->AddInt32("url_id", urlID);
- retrieve->AddString("url", url.String());
- if (msg->what == SH_RELOAD_PAGE)
- retrieve->AddBool("reload", true);
-
- Broadcast(MS_TARGET_PROTOCOL, retrieve);
- delete retrieve;
-
- break;
- }
}
break;
}
- case COMMAND_RETRIEVE: {
- break;
- }
}
return B_OK;
Modified: trunk/themis/framework/SiteHandler.h
===================================================================
--- trunk/themis/framework/SiteHandler.h 2011-01-09 16:23:31 UTC (rev 599)
+++ trunk/themis/framework/SiteHandler.h 2011-01-09 17:48:40 UTC (rev 600)
@@ -34,7 +34,7 @@
~SiteHandler();
SiteEntry * GetEntry(int32 id);
- SiteEntry * AddEntry(int32 aSiteID, const char * aUrl);
+ void AddEntry(SiteEntry * aEntry);
void BroadcastFinished();
uint32 BroadcastTarget();
status_t BroadcastReply(BMessage * msg);
Modified: trunk/themis/framework/win.cpp
===================================================================
--- trunk/themis/framework/win.cpp 2011-01-09 16:23:31 UTC (rev 599)
+++ trunk/themis/framework/win.cpp 2011-01-09 17:48:40 UTC (rev 600)
@@ -367,17 +367,24 @@
break;
uint32 selection = tabview->Selection();
- int32 site_id = ((App *)be_app)->GetNewID();
+ /* Get an unique ID from the app for the site entry*/
+ int32 siteId = ((App *)be_app)->GetNewID();
+ SiteEntry * siteEntry = new SiteEntry(siteId, url.String());
+ /* Get an unique ID from the app for the url entry */
+ int32 urlId = ((App *)be_app)->GetNewID();
+ UrlEntry * urlEntry = new UrlEntry(urlId, url.String());
+ siteEntry->addEntry(urlEntry);
+ ((App *)be_app)->GetSiteHandler()->AddEntry(siteEntry);
if (msg->HasInt32("tab_to_open_in")) {
int32 tab_index = msg->FindInt32("tab_to_open_in");
- ((ThemisTab *)tabview->TabAt(tab_index))->SetSiteID(site_id);
+ ((ThemisTab *)tabview->TabAt(tab_index))->SetSiteID(siteId);
// add history entry for tab
if (msg->HasBool("no_history_add") == false)
((ThemisTab *)tabview->TabAt(tab_index))->GetHistory()->AddEntry(url.String());
}
else {
- ((ThemisTab *)tabview->TabAt(selection))->SetSiteID(site_id);
+ ((ThemisTab *)tabview->TabAt(selection))->SetSiteID(siteId);
// add history entry for tab
if(msg->HasBool("no_history_add") == false)
((ThemisTab *)tabview->TabAt(selection))->GetHistory()->AddEntry(url.String());
@@ -395,19 +402,15 @@
// I don't want to destroy anything working right now. So let's just
// get something new in.
- BMessage * load = NULL;
- if (msg->what == URL_OPEN)
- load = new BMessage(SH_LOAD_NEW_PAGE);
- else
- load = new BMessage(SH_RELOAD_PAGE);
-
- load->AddInt32("command", COMMAND_INFO);
- load->AddInt32("site_id", site_id);
+ BMessage * load = new BMessage(SH_RETRIEVE_START);
+ load->AddInt32("command", COMMAND_RETRIEVE);
+ load->AddInt32("site_id", siteId);
+ load->AddInt32("url_id", urlId);
load->AddString("url", url.String());
+ if (msg->what != URL_OPEN)
+ load->AddBool("reload", true);
- /* We need to directly trigger the SiteHandler. Yap, bad. */
- ((App *)be_app)->GetSiteHandler()->ReceiveBroadcast(load);
-
+ Broadcast(MS_TARGET_PROTOCOL, load);
delete load;
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-09 16:23:37
|
Revision: 599
http://themis.svn.sourceforge.net/themis/?rev=599&view=rev
Author: mark_hellegers
Date: 2011-01-09 16:23:31 +0000 (Sun, 09 Jan 2011)
Log Message:
-----------
- Added BaseEntry class that will be used to store general information about parts of a web page.
- Converted UrlEntry and SiteEntry to use the new BaseEntry class.
- Made small adjustments in other code to make it all work.
This is basically just a straight conversion of the old code, so there is no actual improvement yet.
Modified Paths:
--------------
trunk/themis/framework/SiteEntry.cpp
trunk/themis/framework/SiteEntry.h
trunk/themis/framework/SiteHandler.cpp
trunk/themis/framework/UrlEntry.cpp
trunk/themis/framework/UrlEntry.h
trunk/themis/framework/win.cpp
trunk/themis/makefile
Added Paths:
-----------
trunk/themis/common/BaseEntry.cpp
trunk/themis/common/BaseEntry.hpp
Added: trunk/themis/common/BaseEntry.cpp
===================================================================
--- trunk/themis/common/BaseEntry.cpp (rev 0)
+++ trunk/themis/common/BaseEntry.cpp 2011-01-09 16:23:31 UTC (rev 599)
@@ -0,0 +1,157 @@
+/*
+ Copyright (c) 2011 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: January 08, 2011
+*/
+
+/* BaseEntry implementation
+ See BaseEntry.hpp for more information
+
+*/
+
+// Themis headers
+#include "BaseEntry.hpp"
+
+BaseEntry :: BaseEntry(int32 aId) {
+
+ fId = aId;
+
+}
+
+BaseEntry :: ~BaseEntry() {
+
+ unsigned int size = fChildEntries.size();
+ for (unsigned int i = 0; i < size; i++) {
+ delete fChildEntries[i];
+ }
+
+}
+
+int32 BaseEntry :: getId() const {
+
+ return fId;
+
+}
+
+void BaseEntry :: addEntry(BaseEntry * aEntry) {
+
+ fChildEntries.push_back(aEntry);
+
+}
+
+BaseEntry * BaseEntry :: getEntry(int32 aId) {
+
+ BaseEntry * result = NULL;
+
+ // browse through the entry list to find the UrlEntry with the matching id
+ vector<BaseEntry *>::iterator it = fChildEntries.begin();
+ while (it != fChildEntries.end() && result == NULL) {
+ if (((BaseEntry *)*it)->getId() == aId) {
+ result = *it;
+ }
+ else {
+ it++;
+ }
+ }
+
+ return result;
+}
+
+void BaseEntry :: set(const string aName, const char * aValue) {
+
+ if (mStrings.count(aName) == 0) {
+ mStrings.insert(
+ map<string, string>::value_type(aName, aValue));
+ }
+ else {
+ mStrings[aName] = aValue;
+ };
+}
+
+void BaseEntry :: set(const string aName, const string aValue) {
+
+ if (mStrings.count(aName) == 0) {
+ mStrings.insert(
+ map<string, string>::value_type(aName, aValue));
+ }
+ else {
+ mStrings[aName] = aValue;
+ };
+}
+
+void BaseEntry :: set(const string aName, const bool aValue) {
+
+ if (mBooleans.count(aName) == 0) {
+ mBooleans.insert(
+ map<string, bool>::value_type(aName, aValue));
+ }
+ else {
+ mBooleans[aName] = aValue;
+ };
+}
+
+void BaseEntry :: set(const string aName, const int aValue) {
+
+ if (mIntegers.count(aName) == 0) {
+ mIntegers.insert(
+ map<string, int>::value_type(aName, aValue));
+ }
+ else {
+ mIntegers[aName] = aValue;
+ };
+}
+
+void BaseEntry :: set(const string aName, void * aValue) {
+
+ if (mPointers.count(aName) == 0) {
+ mPointers.insert(
+ map<string, void *>::value_type(aName, aValue));
+ }
+ else {
+ mPointers[aName] = aValue;
+ };
+}
+
+string BaseEntry :: getString(const string aName) {
+
+ return mStrings[aName];
+}
+
+bool BaseEntry :: getBoolean(const string aName) {
+
+ return mBooleans[aName];
+}
+
+int BaseEntry :: getInteger(const string aName) {
+
+ return mIntegers[aName];
+}
+
+void * BaseEntry :: getPointer(const string aName) {
+
+ return mPointers[aName];
+}
Added: trunk/themis/common/BaseEntry.hpp
===================================================================
--- trunk/themis/common/BaseEntry.hpp (rev 0)
+++ trunk/themis/common/BaseEntry.hpp 2011-01-09 16:23:31 UTC (rev 599)
@@ -0,0 +1,86 @@
+/*
+ Copyright (c) 2011 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: January 08, 2011
+*/
+
+/* BaseEntry
+ The basic class for every entry in the system
+
+ Mark Hellegers (ma...@fi...)
+ 08-01-2011
+
+*/
+
+#ifndef BASEENTRY_HPP
+#define BASEENTRY_HPP
+
+// Standard C++ headers
+#include <map>
+#include <string>
+#include <vector>
+
+// BeOS headers
+#include <be/support/SupportDefs.h>
+
+// Namespaces used
+using std::map;
+using std::string;
+using std::vector;
+
+class BaseEntry {
+
+ private:
+ int32 fId;
+
+ map<string, string> mStrings;
+ map<string, bool> mBooleans;
+ map<string, int> mIntegers;
+ map<string, void *> mPointers;
+
+ protected:
+ vector<BaseEntry *> fChildEntries;
+
+ public:
+ BaseEntry(int32 aId);
+ virtual ~BaseEntry();
+ int32 getId() const;
+ void addEntry(BaseEntry * aEntry);
+ BaseEntry * getEntry(int32 aId);
+ void set(const string aName, const char * aValue);
+ void set(const string aName, const string aValue);
+ void set(const string aName, const bool aValue);
+ void set(const string aName, const int aValue);
+ void set(const string aName, void * aValue);
+ string getString(const string aName);
+ bool getBoolean(const string aName);
+ int getInteger(const string aName);
+ void * getPointer(const string aName);
+
+};
+
+#endif
Modified: trunk/themis/framework/SiteEntry.cpp
===================================================================
--- trunk/themis/framework/SiteEntry.cpp 2011-01-09 00:34:48 UTC (rev 598)
+++ trunk/themis/framework/SiteEntry.cpp 2011-01-09 16:23:31 UTC (rev 599)
@@ -13,17 +13,26 @@
#include "SiteEntry.h"
#include "UrlEntry.h"
+// Constants declared
+const string kUrl = "Url";
+const string kTitle = "Title";
+const string kStatusText = "StatusText";
+const string kSecureConnection = "SecureConnection";
+const string kCookiesDisabled = "CookiesDisabled";
+const string kLoadingProgress = "LoadingProgress";
+const string kFavIcon = "FavIcon";
+
SiteEntry :: SiteEntry(int32 id,
- const char* url) {
- fID = id;
- fLoadingProgress = -1;
+ const char * url) : BaseEntry(id) {
+
+ set(kLoadingProgress, -1);
+ set(kUrl, url);
+
+ string statusText = "Transfering data from ";
+ statusText += url;
+ statusText += " ...";
+ set(kStatusText, statusText);
- fUrl = new BString(url);
-
- fStatusText = new BString("Transfering data from ");
- fStatusText->Append(url);
- fStatusText->Append(" ...");
-
/*
* The page title is set to "loading..." now.
* When loading is finished, its set to the sites url.
@@ -32,188 +41,122 @@
* I wait for the renderer to finish, which then delivers me
* the page title.
*/
- fTitle = new BString("loading...");
+ set(kTitle, "loading...");
- fCookiesDisabled = false;
- fSecureConnection = false;
+ set(kSecureConnection, false);
+ set(kCookiesDisabled, false);
- fFavIcon = NULL;
}
-SiteEntry :: ~SiteEntry() {
-
- if (fUrl != NULL)
- delete fUrl;
- if (fStatusText != NULL)
- delete fStatusText;
- if (fTitle != NULL)
- delete fTitle;
-
- unsigned int size = fEntryList.size();
- for (unsigned int i = 0; i < size; i++) {
- delete fEntryList[i];
- }
-
-}
-
-void SiteEntry :: AddEntry(int32 id,
- const char* url) {
-
- UrlEntry* entry = new UrlEntry(id, url);
- fEntryList.push_back(entry);
-
-}
-
bool SiteEntry :: GetCookiesDisabled() {
- return fCookiesDisabled;
+ return getBoolean(kCookiesDisabled);
}
BBitmap * SiteEntry :: GetFavIcon() {
- return fFavIcon;
+ return (BBitmap *) getPointer(kFavIcon);
}
-UrlEntry * SiteEntry :: GetEntry(int32 id) {
+int SiteEntry :: GetLoadingProgress() {
- UrlEntry* entry = NULL;
-
- // browse through the entry list to find the UrlEntry with the matching id
- vector<UrlEntry *>::iterator it = fEntryList.begin();
- while (it != fEntryList.end() && entry == NULL) {
- if (((UrlEntry *)*it)->GetID() == id) {
- entry = *it;
- }
- else {
- it++;
- }
- }
-
- return entry;
-
-}
-
-UrlEntry * SiteEntry :: GetEntry(const char * aUrl) {
-
- UrlEntry * entry = NULL;
- BString urlString = aUrl;
-
- // browse through the entry list to find the UrlEntry with the matching url
- vector<UrlEntry *>::iterator it = fEntryList.begin();
- while (it != fEntryList.end() && entry == NULL) {
- BString listUrlString = ((UrlEntry *)*it)->GetUrl();
- if (urlString == listUrlString) {
- entry = *it;
- }
- else {
- it++;
- }
- }
-
- return entry;
-
-}
-
-int32 SiteEntry :: GetID() {
-
- return fID;
-
-}
-
-int8 SiteEntry :: GetLoadingProgress() {
-
/* cycle through the list of UrlEntries and calculate the loading progress */
- uint32 progress = 0;
- unsigned int nrOfEntries = fEntryList.size();
+ int progress = 0;
+ unsigned int nrOfEntries = fChildEntries.size();
for (unsigned int i = 0; i < nrOfEntries; i++) {
- progress += fEntryList[i]->GetLoadingProgress();
+ UrlEntry * entry = (UrlEntry *) fChildEntries[i];
+ progress += entry->GetLoadingProgress();
}
- progress = (uint32)(progress / nrOfEntries);
- SetLoadingProgress((uint8)progress);
+ progress = (int)(progress / nrOfEntries);
+ SetLoadingProgress(progress);
- return fLoadingProgress;
+ return progress;
}
bool SiteEntry :: GetSecureConnection() {
- return fSecureConnection;
+ return getBoolean(kSecureConnection);
}
const char * SiteEntry :: GetStatusText() {
- return fStatusText ? fStatusText->String() : "";
+ return getString(kStatusText).c_str();
}
const char * SiteEntry :: GetTitle() {
- return fTitle ? fTitle->String() : "";
+ return getString(kTitle).c_str();
}
const char * SiteEntry :: GetUrl() {
- return fUrl ? fUrl->String() : "";
+ return getString(kUrl).c_str();
}
void SiteEntry :: Print() {
printf("------------------------------------\n");
- printf("SiteEntry: ID[%ld] URL[%s] TITLE[%s]\n", fID, fUrl->String(), fTitle->String());
+ printf("SiteEntry: ID[%ld] URL[%s] TITLE[%s]\n", getId(), getString(kUrl).c_str(), getString(kTitle).c_str());
printf(" LoadingProgess[%d] CookiesDisabled[%s], SecureConnection[%s]\n",
- fLoadingProgress,
- fCookiesDisabled ? "true" : "false",
- fSecureConnection ? "true" : "false");
+ getInteger(kLoadingProgress),
+ getBoolean(kCookiesDisabled) ? "true" : "false",
+ getBoolean(kSecureConnection) ? "true" : "false");
- printf(" -- SiteEntrys UrlEntries --\n");
-
- vector<UrlEntry *>::iterator it;
- for (it = fEntryList.begin(); it != fEntryList.end(); it++) {
+ printf(" -- SiteEntry UrlEntries --\n");
+
+ vector<BaseEntry *>::iterator it;
+ for (it = fChildEntries.begin(); it != fChildEntries.end(); it++) {
((UrlEntry *)*it)->Print();
}
+
printf( "------------------------------------\n" );
}
void SiteEntry :: SetCookiesDisabled(bool value) {
- fCookiesDisabled = value;
+ set(kCookiesDisabled, value);
}
void SiteEntry :: SetFavIcon(BBitmap * bmp) {
if (bmp) {
- if (!fFavIcon)
- fFavIcon = new BBitmap(BRect(0, 0, 15, 15), B_RGB32);
- memcpy(fFavIcon->Bits(), bmp->Bits(), 1024);
+ BBitmap * favIcon = GetFavIcon();
+ if (!favIcon) {
+ favIcon = new BBitmap(BRect(0, 0, 15, 15), B_RGB32);
+ set(kFavIcon, favIcon);
+ }
+ memcpy(favIcon->Bits(), bmp->Bits(), 1024);
}
}
-void SiteEntry :: SetLoadingProgress(int8 loadingprogress) {
+void SiteEntry :: SetLoadingProgress(int loadingprogress) {
- fLoadingProgress = loadingprogress;
+ set(kLoadingProgress, loadingprogress);
- if (fLoadingProgress == 100) {
- fStatusText->SetTo("Done.");
- fTitle->SetTo(fUrl->String());
+ if (loadingprogress == 100) {
+ set(kStatusText, "Done.");
+ set(kTitle, getString(kUrl));
}
}
void SiteEntry :: SetSecureConnection(bool value) {
- fSecureConnection = value;
+ set(kSecureConnection, value);
}
-void SiteEntry :: SetTitle(const char* title) {
+void SiteEntry :: SetTitle(const char * title) {
- fTitle->SetTo(title);
+ set(kTitle, title);
}
Modified: trunk/themis/framework/SiteEntry.h
===================================================================
--- trunk/themis/framework/SiteEntry.h 2011-01-09 00:34:48 UTC (rev 598)
+++ trunk/themis/framework/SiteEntry.h 2011-01-09 16:23:31 UTC (rev 599)
@@ -8,51 +8,36 @@
// Standard C++ headers
#include <vector.h>
+// Themis headers
+#include "BaseEntry.hpp"
+
// Namespaces used
using namespace std;
// Declarations used
-class BString;
class BBitmap;
class UrlEntry;
-class SiteEntry {
+class SiteEntry : public BaseEntry {
- private:
- vector<UrlEntry*> fEntryList;
- int32 fID;
- int8 fLoadingProgress;
- BString * fUrl;
- BString * fTitle;
- BString * fStatusText;
- bool fCookiesDisabled;
- bool fSecureConnection;
- BBitmap * fFavIcon;
-
public:
SiteEntry(int32 id,
- const char* url);
- ~SiteEntry();
+ const char * url);
- void AddEntry(int32 id,
- const char* url);
bool GetCookiesDisabled();
BBitmap * GetFavIcon();
- UrlEntry * GetEntry(int32 id);
- UrlEntry * GetEntry(const char * aUrl);
- int32 GetID();
- int8 GetLoadingProgress();
+ int GetLoadingProgress();
bool GetSecureConnection();
const char * GetStatusText();
const char * GetTitle();
const char * GetUrl();
void Print();
void SetCookiesDisabled(bool value);
- void SetFavIcon(BBitmap* bmp);
- void SetLoadingProgress(int8 loadingprogress);
+ void SetFavIcon(BBitmap * bmp);
+ void SetLoadingProgress(int loadingprogress);
void SetSecureConnection(bool value);
- void SetStatusText(const char* text);
- void SetTitle(const char* title);
+ void SetStatusText(const char * text);
+ void SetTitle(const char * title);
};
Modified: trunk/themis/framework/SiteHandler.cpp
===================================================================
--- trunk/themis/framework/SiteHandler.cpp 2011-01-09 00:34:48 UTC (rev 598)
+++ trunk/themis/framework/SiteHandler.cpp 2011-01-09 16:23:31 UTC (rev 599)
@@ -83,7 +83,7 @@
vector< SiteEntry* >::iterator it;
for (it = fEntryList.begin(); it != fEntryList.end(); it++) {
- if (((SiteEntry *)*it)->GetID() == id) {
+ if (((SiteEntry *)*it)->getId() == id) {
entry = *it;
}
}
@@ -98,10 +98,6 @@
SiteEntry * entry = new SiteEntry(aSiteID, aUrl);
fEntryList.push_back(entry);
- /* Get an unique ID from the app */
- int32 urlID = ((App *)be_app)->GetNewID();
- entry->AddEntry(urlID, aUrl);
-
return entry;
}
@@ -217,8 +213,11 @@
printf( "SiteHandler: adding following item: ID[%ld] URL[%s]\n", siteID, url.String() );
SiteEntry * entry = AddEntry(siteID, url.String());
- UrlEntry * urlEntry = entry->GetEntry(url.String());
-
+ /* Get an unique ID from the app */
+ int32 urlID = ((App *)be_app)->GetNewID();
+ UrlEntry * urlEntry = new UrlEntry(urlID, url.String());
+ entry->addEntry(urlEntry);
+
/*
* Inform the protocol(s) to retrieve the site.
* Remember, this is the workaround way, with an url_id > 0.
@@ -227,7 +226,7 @@
BMessage* retrieve = new BMessage(SH_RETRIEVE_START);
retrieve->AddInt32("command", COMMAND_RETRIEVE);
retrieve->AddInt32("site_id", siteID);
- retrieve->AddInt32("url_id", urlEntry->GetID());
+ retrieve->AddInt32("url_id", urlID);
retrieve->AddString("url", url.String());
if (msg->what == SH_RELOAD_PAGE)
retrieve->AddBool("reload", true);
@@ -255,7 +254,7 @@
vector<SiteEntry *>::iterator it;
for (it = fEntryList.begin(); it != fEntryList.end(); it++) {
- if (((SiteEntry *)*it)->GetID() == id) {
+ if (((SiteEntry *)*it)->getId() == id) {
SiteEntry * entry = *(it);
delete entry;
fEntryList.erase(it);
Modified: trunk/themis/framework/UrlEntry.cpp
===================================================================
--- trunk/themis/framework/UrlEntry.cpp 2011-01-09 00:34:48 UTC (rev 598)
+++ trunk/themis/framework/UrlEntry.cpp 2011-01-09 16:23:31 UTC (rev 599)
@@ -5,22 +5,29 @@
// Standard C headers
#include <stdio.h>
+// Standard C++ headers
+#include <string>
+
// BeOS headers
#include <String.h>
// Themis headers
#include "UrlEntry.h"
-UrlEntry::UrlEntry(
- int32 id,
- const char* url )
-{
+// Namespaces used
+using std::string;
+
+// Constants declared
+const string kUrl = "Url";
+const string kTitle = "Title";
+const string kSecureConnection = "SecureConnection";
+const string kLoadingProgress = "LoadingProgress";
+
+UrlEntry :: UrlEntry(int32 id, const char * url) : BaseEntry(id) {
- fID = id;
- fLoadingProgress = -1;
+ set(kLoadingProgress, -1);
+ set(kUrl, url);
- fUrl = new BString( url );
-
/*
* The page title is set to "loading..." now.
* When loading is finished, its set to the sites url.
@@ -29,83 +36,63 @@
* I wait for the renderer to finish, which then delivers me
* the page title.
*/
- fTitle = new BString( "loading..." );
+ set(kTitle, "loading...");
- fSecureConnection = false;
+ set(kSecureConnection, false);
}
-UrlEntry::~UrlEntry()
-{
-
- if( fUrl != NULL )
- delete fUrl;
- if( fTitle != NULL )
- delete fTitle;
-}
+int UrlEntry :: GetLoadingProgress() {
-int32
-UrlEntry::GetID()
-{
- return fID;
-}
+ return getInteger(kLoadingProgress);
-int8
-UrlEntry::GetLoadingProgress()
-{
- return fLoadingProgress;
}
-bool
-UrlEntry::GetSecureConnection()
-{
- return fSecureConnection;
+bool UrlEntry :: GetSecureConnection() {
+
+ return getBoolean(kSecureConnection);
+
}
-const char*
-UrlEntry::GetTitle()
-{
- return fTitle ? fTitle->String() : "";
+const char * UrlEntry :: GetTitle() {
+
+ return getString(kTitle).c_str();
+
}
-const char*
-UrlEntry::GetUrl()
-{
- return fUrl ? fUrl->String() : "";
+const char * UrlEntry :: GetUrl() {
+
+ return getString(kUrl).c_str();
+
}
-void
-UrlEntry::Print()
-{
- printf( " URLENTRY: ID[%ld] URL[%s] TITLE[%s]\n", fID, fUrl->String(), fTitle->String() );
+void UrlEntry :: Print() {
+
+ printf( " URLENTRY: ID[%ld] URL[%s] TITLE[%s]\n", getId(), getString(kUrl).c_str(), getString(kTitle).c_str());
printf( " LoadingProgess[%d] SecureConnection[%s]\n",
- fLoadingProgress,
- fSecureConnection ? "true" : "false" );
+ getInteger(kLoadingProgress),
+ getBoolean(kSecureConnection) ? "true" : "false" );
}
-void
-UrlEntry::SetLoadingProgress(
- int8 loadingprogress )
-{
- fLoadingProgress = loadingprogress;
+void UrlEntry :: SetLoadingProgress(int loadingprogress) {
+
+ set(kLoadingProgress, loadingprogress);
- if( fLoadingProgress == 100 )
- {
- fTitle->SetTo( fUrl->String() );
+ if (loadingprogress == 100) {
+ set(kTitle, getString(kUrl));
}
+
}
-void
-UrlEntry::SetSecureConnection(
- bool value )
-{
- fSecureConnection = value;
+void UrlEntry :: SetSecureConnection(bool value) {
+
+ set(kSecureConnection, value);
+
}
-void
-UrlEntry::SetTitle(
- const char* title )
-{
- fTitle->SetTo( title );
+void UrlEntry :: SetTitle(const char* title) {
+
+ set(kTitle, title);
+
}
Modified: trunk/themis/framework/UrlEntry.h
===================================================================
--- trunk/themis/framework/UrlEntry.h 2011-01-09 00:34:48 UTC (rev 598)
+++ trunk/themis/framework/UrlEntry.h 2011-01-09 16:23:31 UTC (rev 599)
@@ -5,31 +5,21 @@
#ifndef URLENTRY_H
#define URLENTRY_H
-// Declarations used
-class BString;
+#include "BaseEntry.hpp"
-class UrlEntry {
+class UrlEntry : public BaseEntry {
- private:
- int32 fID;
- int8 fLoadingProgress;
- BString * fUrl;
- BString * fTitle;
- bool fSecureConnection;
-
public:
UrlEntry(int32 id,
- const char* url);
- ~UrlEntry();
+ const char * url);
- int32 GetID();
- int8 GetLoadingProgress();
+ int GetLoadingProgress();
bool GetSecureConnection();
const char * GetTitle();
const char * GetUrl();
void Print();
- void SetLoadingProgress(int8 loadingprogress);
+ void SetLoadingProgress(int loadingprogress);
void SetSecureConnection(bool value);
void SetTitle(const char * title);
Modified: trunk/themis/framework/win.cpp
===================================================================
--- trunk/themis/framework/win.cpp 2011-01-09 00:34:48 UTC (rev 598)
+++ trunk/themis/framework/win.cpp 2011-01-09 16:23:31 UTC (rev 599)
@@ -984,7 +984,7 @@
if (site_entry != NULL) {
int32 url_id = 0;
message->FindInt32("url_id", &url_id);
- url_entry = site_entry->GetEntry(url_id);
+ url_entry = (UrlEntry *) site_entry->getEntry(url_id);
if (url_entry != NULL) {
int64 content_length = 0;
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2011-01-09 00:34:48 UTC (rev 598)
+++ trunk/themis/makefile 2011-01-09 16:23:31 UTC (rev 599)
@@ -117,7 +117,8 @@
common/cacheobject.cpp \
common/stripwhite.cpp \
common/TTextView.cpp \
- common/BasePrefsView.cpp
+ common/BasePrefsView.cpp \
+ common/BaseEntry.cpp
#add similar lines for new plugins, libraries, etc.
HTTPADDONSOURCES= \
http/optionshandler.cpp \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-09 00:34:54
|
Revision: 598
http://themis.svn.sourceforge.net/themis/?rev=598&view=rev
Author: mark_hellegers
Date: 2011-01-09 00:34:48 +0000 (Sun, 09 Jan 2011)
Log Message:
-----------
Fixed the destructor. It wasn't cleaning up the UrlEntries.
Modified Paths:
--------------
trunk/themis/framework/SiteEntry.cpp
Modified: trunk/themis/framework/SiteEntry.cpp
===================================================================
--- trunk/themis/framework/SiteEntry.cpp 2011-01-02 20:32:10 UTC (rev 597)
+++ trunk/themis/framework/SiteEntry.cpp 2011-01-09 00:34:48 UTC (rev 598)
@@ -48,6 +48,11 @@
delete fStatusText;
if (fTitle != NULL)
delete fTitle;
+
+ unsigned int size = fEntryList.size();
+ for (unsigned int i = 0; i < size; i++) {
+ delete fEntryList[i];
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-02 20:32:16
|
Revision: 597
http://themis.svn.sourceforge.net/themis/?rev=597&view=rev
Author: mark_hellegers
Date: 2011-01-02 20:32:10 +0000 (Sun, 02 Jan 2011)
Log Message:
-----------
Always test your changes. Grr. Return the entry you add.
Modified Paths:
--------------
trunk/themis/framework/SiteHandler.cpp
Modified: trunk/themis/framework/SiteHandler.cpp
===================================================================
--- trunk/themis/framework/SiteHandler.cpp 2011-01-02 20:21:26 UTC (rev 596)
+++ trunk/themis/framework/SiteHandler.cpp 2011-01-02 20:32:10 UTC (rev 597)
@@ -101,6 +101,8 @@
/* Get an unique ID from the app */
int32 urlID = ((App *)be_app)->GetNewID();
entry->AddEntry(urlID, aUrl);
+
+ return entry;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-01-02 20:21:32
|
Revision: 596
http://themis.svn.sourceforge.net/themis/?rev=596&view=rev
Author: mark_hellegers
Date: 2011-01-02 20:21:26 +0000 (Sun, 02 Jan 2011)
Log Message:
-----------
Moved adding entry to its own method.
Modified Paths:
--------------
trunk/themis/framework/SiteEntry.cpp
trunk/themis/framework/SiteEntry.h
trunk/themis/framework/SiteHandler.cpp
trunk/themis/framework/SiteHandler.h
Modified: trunk/themis/framework/SiteEntry.cpp
===================================================================
--- trunk/themis/framework/SiteEntry.cpp 2011-01-02 19:22:26 UTC (rev 595)
+++ trunk/themis/framework/SiteEntry.cpp 2011-01-02 20:21:26 UTC (rev 596)
@@ -76,17 +76,41 @@
UrlEntry* entry = NULL;
// browse through the entry list to find the UrlEntry with the matching id
- vector<UrlEntry *>::iterator it;
- for (it = fEntryList.begin(); it != fEntryList.end(); it++) {
+ vector<UrlEntry *>::iterator it = fEntryList.begin();
+ while (it != fEntryList.end() && entry == NULL) {
if (((UrlEntry *)*it)->GetID() == id) {
entry = *it;
}
+ else {
+ it++;
+ }
}
return entry;
}
+UrlEntry * SiteEntry :: GetEntry(const char * aUrl) {
+
+ UrlEntry * entry = NULL;
+ BString urlString = aUrl;
+
+ // browse through the entry list to find the UrlEntry with the matching url
+ vector<UrlEntry *>::iterator it = fEntryList.begin();
+ while (it != fEntryList.end() && entry == NULL) {
+ BString listUrlString = ((UrlEntry *)*it)->GetUrl();
+ if (urlString == listUrlString) {
+ entry = *it;
+ }
+ else {
+ it++;
+ }
+ }
+
+ return entry;
+
+}
+
int32 SiteEntry :: GetID() {
return fID;
Modified: trunk/themis/framework/SiteEntry.h
===================================================================
--- trunk/themis/framework/SiteEntry.h 2011-01-02 19:22:26 UTC (rev 595)
+++ trunk/themis/framework/SiteEntry.h 2011-01-02 20:21:26 UTC (rev 596)
@@ -39,6 +39,7 @@
bool GetCookiesDisabled();
BBitmap * GetFavIcon();
UrlEntry * GetEntry(int32 id);
+ UrlEntry * GetEntry(const char * aUrl);
int32 GetID();
int8 GetLoadingProgress();
bool GetSecureConnection();
Modified: trunk/themis/framework/SiteHandler.cpp
===================================================================
--- trunk/themis/framework/SiteHandler.cpp 2011-01-02 19:22:26 UTC (rev 595)
+++ trunk/themis/framework/SiteHandler.cpp 2011-01-02 20:21:26 UTC (rev 596)
@@ -93,6 +93,17 @@
}
+SiteEntry * SiteHandler :: AddEntry(int32 aSiteID, const char * aUrl) {
+
+ SiteEntry * entry = new SiteEntry(aSiteID, aUrl);
+ fEntryList.push_back(entry);
+
+ /* Get an unique ID from the app */
+ int32 urlID = ((App *)be_app)->GetNewID();
+ entry->AddEntry(urlID, aUrl);
+
+}
+
BBitmap * SiteHandler :: GetFavIconFor(int32 id) {
fLocker->Lock();
@@ -196,69 +207,25 @@
case SH_LOAD_NEW_PAGE:
case SH_RELOAD_PAGE: {
/* create a SiteEntry, and add it to fEntryList */
- int32 site_id;
+ int32 siteID;
BString url;
- msg->FindInt32("site_id", &site_id);
+ msg->FindInt32("site_id", &siteID);
msg->FindString("url", &url);
- printf( "SiteHandler: adding following item: ID[%ld] URL[%s]\n", site_id, url.String() );
+ printf( "SiteHandler: adding following item: ID[%ld] URL[%s]\n", siteID, url.String() );
- SiteEntry * siteentry = new SiteEntry(site_id, url.String());
- fEntryList.push_back(siteentry);
+ SiteEntry * entry = AddEntry(siteID, url.String());
+ UrlEntry * urlEntry = entry->GetEntry(url.String());
/*
- * GENERAL PROCESSING IDEA:
- *
- * The main idea now would be to tell the network, to retrieve the site. When loading is
- * finished, the parser would be given the url for parsing. The parser then tells us if
- * the document is a single-framed or multi-framed document. According to this info,
- * we create the appropriate count of UrlEntry items in the parent SiteEntry.
- * Each UrlEntry for the site is then to be loaded from the network system, and loading
- * states are reported back accordingly.
- * An idea would be, that as soon, an url of the site is retrieved, the parser gets it for
- * parsing, and then returns the pointer to the dom tree, which is stored in the appropriate
- * UrlEntry for later processing by the Renderer.
- * If all URLs for the site are retrieved, we hand over all the dom tree pointers and stuff
- * to the Renderer with the SH_RENDER_START broadcast.
- * Though it is not said, that we may not even tell the Renderer to render parts ( URLs ) of
- * the site in between.
- *
- * Note: The first retrieve will contain an site_id > 0 and an url_id = 0. This makes it clear
- * for the SiteHandler that the response from the network is for the intial URL.
- */
-
- /*
- * WORKAROUND IDEA:
- *
- * As we currently can't ask the parser to tell us about the single- and/or multi-framed-ness
- * of a site, we just create an UrlEntry and store it in the SiteEntry.
- * Then we tell the network to retrieve exactly that site_id/url_id combination.
- * This means site_id > 0 and url_id > 0.
- */
-
- /* Go the workaround way */
-
- /* Get an unique ID from the app */
- int32 url_id = ((App *)be_app)->GetNewID();
- siteentry->AddEntry(url_id, url.String());
-
- /*
- * TODO
- *
- * I was planning to move all urlparsing and handler decision making from the windows
- * URL_OPEN/BUTTON_RELOAD switch in here.
- */
-
-
- /*
* Inform the protocol(s) to retrieve the site.
* Remember, this is the workaround way, with an url_id > 0.
*/
BMessage* retrieve = new BMessage(SH_RETRIEVE_START);
retrieve->AddInt32("command", COMMAND_RETRIEVE);
- retrieve->AddInt32("site_id", site_id);
- retrieve->AddInt32("url_id", url_id);
+ retrieve->AddInt32("site_id", siteID);
+ retrieve->AddInt32("url_id", urlEntry->GetID());
retrieve->AddString("url", url.String());
if (msg->what == SH_RELOAD_PAGE)
retrieve->AddBool("reload", true);
Modified: trunk/themis/framework/SiteHandler.h
===================================================================
--- trunk/themis/framework/SiteHandler.h 2011-01-02 19:22:26 UTC (rev 595)
+++ trunk/themis/framework/SiteHandler.h 2011-01-02 20:21:26 UTC (rev 596)
@@ -34,6 +34,7 @@
~SiteHandler();
SiteEntry * GetEntry(int32 id);
+ SiteEntry * AddEntry(int32 aSiteID, const char * aUrl);
void BroadcastFinished();
uint32 BroadcastTarget();
status_t BroadcastReply(BMessage * msg);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|