diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 88f8d2a16e..587995c049 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -2536,7 +2536,20 @@ ServerApp::CountPictures() const ServerPicture * -ServerApp::FindPicture(int32 token) const +ServerApp::CreatePicture(int32 *token) +{ + ServerPicture *picture = new (nothrow) ServerPicture(); + if (picture != NULL) { + fPictureList.AddItem(picture); + if (token != NULL) + *token = picture->Token(); + } + return picture; +} + + +ServerPicture * +ServerApp::FindPicture(const int32 &token) const { // TODO: we need to make sure the picture is ours?! ServerPicture* picture; @@ -2546,7 +2559,23 @@ ServerApp::FindPicture(int32 token) const return NULL; } + +bool +ServerApp::DeletePicture(const int32 &token) +{ + ServerPicture *picture = FindPicture(token); + if (picture == NULL) + return false; + if (!fPictureList.RemoveItem(picture)) + return false; + + delete picture; + + return true; +} + + team_id ServerApp::ClientTeam() const { diff --git a/src/servers/app/ServerApp.h b/src/servers/app/ServerApp.h index 84e0175aaf..ea2a401425 100644 --- a/src/servers/app/ServerApp.h +++ b/src/servers/app/ServerApp.h @@ -71,7 +71,9 @@ class ServerApp : public MessageLooper { ServerBitmap *FindBitmap(int32 token) const; int32 CountPictures() const; - ServerPicture *FindPicture(int32 token) const; + ServerPicture *CreatePicture(int32 *token = NULL); + ServerPicture *FindPicture(const int32 &token) const; + bool DeletePicture(const int32 &token); AreaPool *AppAreaPool() { return &fSharedMem; }