mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-04 00:04:19 +00:00
oc/dbmsgreader: Fix to work again this time basen on BSON format for msg data
Also, implement reading for message data in case only 1 param is passed. This could be usefull when have msg data by other means than by reading it directly from DB Signed-off-by: Kamen Mazdrashki <kmazdrashki@zentyal.com>
This commit is contained in:
committed by
Julio García
parent
86e54989fb
commit
c91741ad1f
@@ -133,7 +133,8 @@ $(PLREADER_TOOL)_OBJC_FILES += \
|
||||
|
||||
DBMSGREADER_TOOL = dbmsgreader
|
||||
$(DBMSGREADER_TOOL)_OBJC_FILES += \
|
||||
dbmsgreader.m
|
||||
dbmsgreader.m \
|
||||
NSObject+PropertyList.m
|
||||
|
||||
$(DBMSGREADER_TOOL)_LIB_DIRS += \
|
||||
-L../SoObjects/SOGo/SOGo.framework/ -lSOGo \
|
||||
|
||||
@@ -36,10 +36,20 @@
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import <SOGo/SOGoCacheGCSObject.h>
|
||||
|
||||
#import "NSObject+PropertyList.m"
|
||||
#import <SOGo/BSONCodec.h>
|
||||
#import "NSObject+PropertyList.h"
|
||||
|
||||
Class MAPIStoreUserContextK, SOGoMAPIDBObjectK;
|
||||
|
||||
static void
|
||||
DumpBSONData(NSData *data)
|
||||
{
|
||||
NSDictionary *dvalue;
|
||||
dvalue = [data BSONValue];
|
||||
[dvalue displayWithIndentation:0];
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
DbDumpObject (NSString *username, NSString *path)
|
||||
{
|
||||
@@ -55,8 +65,9 @@ DbDumpObject (NSString *username, NSString *path)
|
||||
record = [dbobject lookupRecord: path newerThanVersion: -1];
|
||||
if (record)
|
||||
{
|
||||
printf("record found: %p\n", record);
|
||||
content = [[record objectForKey: @"c_content"] dataByDecodingBase64];
|
||||
OCDumpPListData (content);
|
||||
DumpBSONData(content);
|
||||
}
|
||||
else
|
||||
NSLog (@"record not found");
|
||||
@@ -99,9 +110,12 @@ int main (int argc, char *argv[], char *envp[])
|
||||
SOGoMAPIDBObjectK = NSClassFromString (@"SOGoMAPIDBObject");
|
||||
|
||||
arguments = [[NSProcessInfo processInfo] arguments];
|
||||
if ([arguments count] > 2)
|
||||
if ([arguments count] > 2) {
|
||||
DbDumpObject ([arguments objectAtIndex: 1],
|
||||
[arguments objectAtIndex: 2]);
|
||||
} else if ([arguments count] > 1) {
|
||||
DumpBSONData([[arguments objectAtIndex:1] dataByDecodingBase64]);
|
||||
}
|
||||
|
||||
[pool release];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user