mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-05 07:35:12 -04:00
merged with upstream/master
This commit is contained in:
commit
cd4594d0a3
94 changed files with 1010 additions and 1792 deletions
|
@ -113,8 +113,6 @@ int p3GxsTunnelService::tick()
|
|||
|
||||
flush() ;
|
||||
|
||||
rstime::rs_usleep(1000*500);
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,13 @@ struct RsGxsFile : RsSerializable
|
|||
RS_SERIAL_PROCESS(mHash);
|
||||
RS_SERIAL_PROCESS(mSize);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
mName.clear();
|
||||
mHash.clear();
|
||||
mSize = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct RsGxsImage : RsSerializable
|
||||
|
|
|
@ -34,110 +34,57 @@
|
|||
class RsPhoto;
|
||||
extern RsPhoto *rsPhoto;
|
||||
|
||||
/******************* NEW STUFF FOR NEW CACHE SYSTEM *********/
|
||||
|
||||
#define RSPHOTO_MODE_NEW 1
|
||||
#define RSPHOTO_MODE_OWN 2
|
||||
#define RSPHOTO_MODE_REMOTE 3
|
||||
|
||||
/* If these flags are no set - the Photo inherits values from the Album
|
||||
*/
|
||||
|
||||
#define RSPHOTO_FLAGS_ATTRIB_TITLE 0x0001
|
||||
#define RSPHOTO_FLAGS_ATTRIB_CAPTION 0x0002
|
||||
#define RSPHOTO_FLAGS_ATTRIB_DESC 0x0004
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTOGRAPHER 0x0008
|
||||
#define RSPHOTO_FLAGS_ATTRIB_WHERE 0x0010
|
||||
#define RSPHOTO_FLAGS_ATTRIB_WHEN 0x0020
|
||||
#define RSPHOTO_FLAGS_ATTRIB_OTHER 0x0040
|
||||
#define RSPHOTO_FLAGS_ATTRIB_CATEGORY 0x0080
|
||||
#define RSPHOTO_FLAGS_ATTRIB_HASHTAGS 0x0100
|
||||
#define RSPHOTO_FLAGS_ATTRIB_ORDER 0x0200
|
||||
#define RSPHOTO_FLAGS_ATTRIB_THUMBNAIL 0x0400
|
||||
#define RSPHOTO_FLAGS_ATTRIB_MODE 0x0800
|
||||
#define RSPHOTO_FLAGS_ATTRIB_AUTHOR 0x1000 // PUSH UP ORDER
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
|
||||
|
||||
class RsPhotoPhoto
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
RsPhotoPhoto();
|
||||
RsPhotoPhoto();
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
// V2 PhotoMsg - keep it simple.
|
||||
// mMeta.mTitle used for Photo Caption.
|
||||
// mDescription optional field for addtional notes.
|
||||
// mLowResImage - < 50k jpg of image.
|
||||
// mPhotoFile - transfer details for original photo.
|
||||
std::string mDescription;
|
||||
uint32_t mOrder;
|
||||
RsGxsImage mLowResImage;
|
||||
RsGxsFile mPhotoFile;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
uint32_t mSetFlags;
|
||||
|
||||
int mOrder;
|
||||
|
||||
RsGxsImage mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
// These are not saved.
|
||||
std::string path; // if in Mode NEW.
|
||||
uint32_t mModFlags;
|
||||
// These are not saved.
|
||||
std::string mPath; // if New photo
|
||||
};
|
||||
|
||||
class RsPhotoAlbumShare
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t mShareType;
|
||||
std::string mShareGroupId;
|
||||
std::string mPublishKey;
|
||||
uint32_t mCommentMode;
|
||||
uint32_t mResizeMode;
|
||||
};
|
||||
#define RSPHOTO_SHAREMODE_LOWRESONLY (1)
|
||||
#define RSPHOTO_SHAREMODE_ORIGINAL (2)
|
||||
#define RSPHOTO_SHAREMODE_DUP_ORIGINAL (3)
|
||||
#define RSPHOTO_SHAREMODE_DUP_200K (4)
|
||||
#define RSPHOTO_SHAREMODE_DUP_1M (5)
|
||||
|
||||
class RsPhotoAlbum
|
||||
{
|
||||
public:
|
||||
RsPhotoAlbum();
|
||||
public:
|
||||
RsPhotoAlbum();
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
// V2 Album - keep it simple.
|
||||
// mMeta.mTitle.
|
||||
uint32_t mShareMode;
|
||||
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
|
||||
std::string mHashTags;
|
||||
RsGxsImage mThumbnail;
|
||||
|
||||
RsGxsImage mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
std::string mPhotoPath;
|
||||
RsPhotoAlbumShare mShareOptions;
|
||||
|
||||
// These aren't saved.
|
||||
uint32_t mSetFlags;
|
||||
uint32_t mModFlags;
|
||||
// Below is not saved.
|
||||
bool mAutoDownload;
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
||||
|
||||
|
@ -145,14 +92,7 @@ typedef std::map<RsGxsGroupId, std::vector<RsPhotoPhoto> > PhotoResult;
|
|||
|
||||
class RsPhoto: public RsGxsIfaceHelper, public RsGxsCommentService
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static const uint32_t FLAG_MSG_TYPE_PHOTO_POST;
|
||||
static const uint32_t FLAG_MSG_TYPE_PHOTO_COMMENT;
|
||||
static const uint32_t FLAG_MSG_TYPE_MASK;
|
||||
|
||||
|
||||
explicit RsPhoto(RsGxsIface &gxs) : RsGxsIfaceHelper(gxs) { return; }
|
||||
|
||||
virtual ~RsPhoto() { return; }
|
||||
|
|
|
@ -642,14 +642,10 @@ void upnphandler::setExternalPort(unsigned short eport_in)
|
|||
dataMtx.unlock(); /*** UNLOCK MUTEX ***/
|
||||
}
|
||||
|
||||
/* as determined by uPnP */
|
||||
bool upnphandler::getInternalAddress(struct sockaddr_storage &addr)
|
||||
/* as determined by uPnP */
|
||||
bool upnphandler::getInternalAddress(struct sockaddr_storage &addr)
|
||||
{
|
||||
// std::cerr << "UPnPHandler::getInternalAddress() pre Lock!" << std::endl;
|
||||
dataMtx.lock(); /*** LOCK MUTEX ***/
|
||||
// std::cerr << "UPnPHandler::getInternalAddress() postLock!" << std::endl;
|
||||
|
||||
std::cerr << "UPnPHandler::getInternalAddress()" << std::endl;
|
||||
RS_STACK_MUTEX(dataMtx);
|
||||
|
||||
// copy to universal addr.
|
||||
sockaddr_storage_clear(addr);
|
||||
|
@ -657,18 +653,15 @@ bool upnphandler::getInternalAddress(struct sockaddr_storage &addr)
|
|||
|
||||
bool valid = (upnpState >= RS_UPNP_S_ACTIVE);
|
||||
|
||||
dataMtx.unlock(); /*** UNLOCK MUTEX ***/
|
||||
Dbg2() << __PRETTY_FUNCTION__ << " valid: " << valid
|
||||
<< " addr: " << addr << std::endl;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
bool upnphandler::getExternalAddress(struct sockaddr_storage &addr)
|
||||
bool upnphandler::getExternalAddress(sockaddr_storage &addr)
|
||||
{
|
||||
// std::cerr << "UPnPHandler::getExternalAddress() pre Lock!" << std::endl;
|
||||
dataMtx.lock(); /*** LOCK MUTEX ***/
|
||||
// std::cerr << "UPnPHandler::getExternalAddress() postLock!" << std::endl;
|
||||
|
||||
std::cerr << "UPnPHandler::getExternalAddress()" << std::endl;
|
||||
RS_STACK_MUTEX(dataMtx);
|
||||
|
||||
// copy to universal addr.
|
||||
sockaddr_storage_clear(addr);
|
||||
|
@ -676,7 +669,8 @@ bool upnphandler::getExternalAddress(struct sockaddr_storage &addr)
|
|||
|
||||
bool valid = (upnpState == RS_UPNP_S_ACTIVE);
|
||||
|
||||
dataMtx.unlock(); /*** UNLOCK MUTEX ***/
|
||||
Dbg2() << __PRETTY_FUNCTION__ << " valid: " << valid
|
||||
<< " addr: " << addr << std::endl;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
/* platform independent networking... */
|
||||
#include "pqi/pqinetwork.h"
|
||||
#include "pqi/pqiassist.h"
|
||||
|
||||
#include "util/rsdebug.h"
|
||||
#include "util/rsthreads.h"
|
||||
|
||||
class upnpentry
|
||||
|
@ -97,7 +97,7 @@ bool shutdown_upnp();
|
|||
bool initUPnPState();
|
||||
bool printUPnPState();
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
bool background_setup_upnp(bool, bool);
|
||||
bool checkUPnPActive();
|
||||
|
@ -123,4 +123,5 @@ bool checkUPnPActive();
|
|||
/* active port forwarding */
|
||||
std::list<upnpforward> activeForwards;
|
||||
|
||||
RS_SET_CONTEXT_DEBUG_LEVEL(1)
|
||||
};
|
||||
|
|
|
@ -42,55 +42,44 @@ RsItem *RsGxsPhotoSerialiser::create_item(uint16_t service, uint8_t item_sub_id)
|
|||
|
||||
void RsGxsPhotoAlbumItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,TLV_TYPE_UINT32_PARAM,album.mShareMode,"mShareMode");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_CAPTION, album.mCaption, "mCaption");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_CATEGORY, album.mCategory, "mCategory");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR, album.mDescription, "mDescription");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_HASH_TAG, album.mHashTags, "mHashTags");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG, album.mOther, "mOther");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_PATH, album.mPhotoPath, "mPhotoPath");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_NAME, album.mPhotographer, "mPhotographer");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DATE, album.mWhen, "mWhen");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_LOCATION, album.mWhere, "mWhere");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DATE, album.mWhen, "mWhen");
|
||||
|
||||
album.mThumbnail.serial_process(j, ctx);
|
||||
}
|
||||
void RsGxsPhotoPhotoItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_CAPTION, photo.mCaption, "mCaption");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_CATEGORY, photo.mCategory, "mCategory");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_DESCR, photo.mDescription, "mDescription");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_HASH_TAG, photo.mHashTags, "mHashTags");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_MSG, photo.mOther, "mOther");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_PIC_AUTH, photo.mPhotographer, "mPhotographer");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_DATE, photo.mWhen, "mWhen");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_LOCATION, photo.mWhere, "mWhere");
|
||||
|
||||
photo.mThumbnail.serial_process(j, ctx);
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR, photo.mDescription, "mDescription");
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,TLV_TYPE_UINT32_PARAM,photo.mOrder,"mOrder");
|
||||
photo.mLowResImage.serial_process(j, ctx);
|
||||
photo.mPhotoFile.serial_process(j, ctx);
|
||||
}
|
||||
|
||||
void RsGxsPhotoAlbumItem::clear()
|
||||
{
|
||||
album.mShareMode = RSPHOTO_SHAREMODE_LOWRESONLY;
|
||||
album.mCaption.clear();
|
||||
album.mCategory.clear();
|
||||
album.mDescription.clear();
|
||||
album.mHashTags.clear();
|
||||
album.mOther.clear();
|
||||
album.mPhotoPath.clear();
|
||||
album.mPhotographer.clear();
|
||||
album.mWhen.clear();
|
||||
album.mWhere.clear();
|
||||
album.mWhen.clear();
|
||||
album.mThumbnail.clear();
|
||||
|
||||
// not saved
|
||||
album.mAutoDownload = false;
|
||||
}
|
||||
|
||||
void RsGxsPhotoPhotoItem::clear()
|
||||
{
|
||||
photo.mCaption.clear();
|
||||
photo.mCategory.clear();
|
||||
photo.mDescription.clear();
|
||||
photo.mHashTags.clear();
|
||||
photo.mOther.clear();
|
||||
photo.mPhotographer.clear();
|
||||
photo.mWhen.clear();
|
||||
photo.mWhere.clear();
|
||||
photo.mThumbnail.clear();
|
||||
photo.mOrder = 0;
|
||||
photo.mLowResImage.clear();
|
||||
photo.mPhotoFile.clear();
|
||||
|
||||
// not saved
|
||||
photo.mPath.clear();
|
||||
}
|
||||
|
|
|
@ -25,19 +25,14 @@
|
|||
|
||||
RsPhoto *rsPhoto = NULL;
|
||||
|
||||
|
||||
const uint32_t RsPhoto::FLAG_MSG_TYPE_MASK = 0x000f;
|
||||
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_POST = 0x0001;
|
||||
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_COMMENT = 0x0002;
|
||||
|
||||
RsPhotoPhoto::RsPhotoPhoto()
|
||||
:mSetFlags(0), mOrder(0), mMode(0), mModFlags(0)
|
||||
:mOrder(0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RsPhotoAlbum::RsPhotoAlbum()
|
||||
:mMode(0), mSetFlags(0), mModFlags(0)
|
||||
:mShareMode(RSPHOTO_SHAREMODE_LOWRESONLY), mAutoDownload(false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue