(fix) added doc to sogo-tool manage-eas + did cleanups (fixes #3967)

This commit is contained in:
Ludovic Marcotte
2017-06-16 13:25:15 -04:00
parent 0a155d6f67
commit ca43e7d9ca
4 changed files with 22 additions and 43 deletions

View File

@@ -1,8 +1,6 @@
/* SOGoToolDumpDefaults.m - this file is part of SOGo /* SOGoToolDumpDefaults.m - this file is part of SOGo
* *
* Copyright (C) 2012 Inverse inc. * Copyright (C) 2012-2017 Inverse inc.
*
* Author: Jean Raby <jraby@inverse.ca>
* *
* This file is free software; you can redistribute it and/or modify * This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -32,17 +30,13 @@
@implementation SOGoToolDumpDefaults @implementation SOGoToolDumpDefaults
+ (void) initialize
{
}
+ (NSString *) command + (NSString *) command
{ {
return @"dump-defaults"; return @"dump-defaults";
} }
+ (NSString *) description + (NSString *) description
{ {
return @"Prints the sogod GNUstep domain configuration as a property list"; return @"prints the sogod GNUstep domain configuration as a property list";
} }
- (void) usage - (void) usage

View File

@@ -1,8 +1,6 @@
/* SOGoToolExpireUserSessions.m - this file is part of SOGo /* SOGoToolExpireUserSessions.m - this file is part of SOGo
* *
* Copyright (C) 2012 Inverse inc. * Copyright (C) 2012-2017 Inverse inc.
*
* Author: Jean Raby <jraby@inverse.ca>
* *
* This file is free software; you can redistribute it and/or modify * This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -42,10 +40,6 @@
@implementation SOGoToolExpireUserSessions @implementation SOGoToolExpireUserSessions
+ (void) initialize
{
}
+ (NSString *) command + (NSString *) command
{ {
return @"expire-sessions"; return @"expire-sessions";
@@ -53,7 +47,7 @@
+ (NSString *) description + (NSString *) description
{ {
return @"Expires user sessions without activity for specified number of minutes"; return @"expires user sessions without activity for specified number of minutes";
} }
- (void) usage - (void) usage

View File

@@ -1,6 +1,6 @@
/* SOGoToolManageEAS.m - this file is part of SOGo /* SOGoToolManageEAS.m - this file is part of SOGo
* *
* Copyright (C) 2014 Inverse inc. * Copyright (C) 2014-2017 Inverse inc.
* *
* This file is free software; you can redistribute it and/or modify * This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ typedef enum
ManageEASListDevices = 0, ManageEASListDevices = 0,
ManageEASListFolders = 2, ManageEASListFolders = 2,
ManageEASResetDevice = 3, ManageEASResetDevice = 3,
ManageEASRestFolder = 4, ManageEASResetFolder = 4,
ManageEASVCard = 5, ManageEASVCard = 5,
ManageEASVEvent = 6, ManageEASVEvent = 6,
} SOGoManageEASCommand; } SOGoManageEASCommand;
@@ -53,10 +53,6 @@ typedef enum
NSURL *folderTableURL; NSURL *folderTableURL;
+ (void) initialize
{
}
+ (NSString *) command + (NSString *) command
{ {
return @"manage-eas"; return @"manage-eas";
@@ -112,7 +108,13 @@ NSURL *folderTableURL;
- (void) usage - (void) usage
{ {
fprintf (stderr, "manage-eas listdevices|resetdevice|resetfolder|mergevcard|mergevevent user <deviceId | folderId> <YES | NO>\n\n" fprintf (stderr, "manage-eas listdevices|listfolders|resetdevice|resetfolder|mergevcard|mergevevent user <deviceId | folderId> <YES | NO>\n\n"
" listdevices list the devices belonging to user\n"
" listfolders list all folders of deviceId for user\n"
" resetdevice force deviceId of user to resync everything\n"
" resetfolder force folderId of user to resync everything\n"
" mergevcard merge/un-merge all addressbooks into one for deviceId of user\n"
" mergevevent merge/un-merge all calendars into one for deviceId of user\n"
" user the user of whom to reset the whole device or a single folder\n" " user the user of whom to reset the whole device or a single folder\n"
" Examples:\n" " Examples:\n"
" sogo-tool manage-eas listdevices janedoe\n" " sogo-tool manage-eas listdevices janedoe\n"
@@ -135,7 +137,7 @@ NSURL *folderTableURL;
else if ([theString caseInsensitiveCompare: @"resetdevice"] == NSOrderedSame) else if ([theString caseInsensitiveCompare: @"resetdevice"] == NSOrderedSame)
return ManageEASResetDevice; return ManageEASResetDevice;
else if ([theString caseInsensitiveCompare: @"resetfolder"] == NSOrderedSame) else if ([theString caseInsensitiveCompare: @"resetfolder"] == NSOrderedSame)
return ManageEASRestFolder; return ManageEASResetFolder;
else if ([theString caseInsensitiveCompare: @"mergevcard"] == NSOrderedSame) else if ([theString caseInsensitiveCompare: @"mergevcard"] == NSOrderedSame)
return ManageEASVCard; return ManageEASVCard;
else if ([theString caseInsensitiveCompare: @"mergevevent"] == NSOrderedSame) else if ([theString caseInsensitiveCompare: @"mergevevent"] == NSOrderedSame)
@@ -147,7 +149,7 @@ NSURL *folderTableURL;
- (BOOL) run - (BOOL) run
{ {
NSString *urlString, *deviceId, *userId; NSString *urlString, *deviceId, *folderId, *userId;
NSMutableString *ocFSTableName; NSMutableString *ocFSTableName;
SOGoCacheGCSObject *oc, *foc; SOGoCacheGCSObject *oc, *foc;
NSMutableArray *parts; NSMutableArray *parts;
@@ -292,18 +294,13 @@ NSURL *folderTableURL;
break; break;
case ManageEASRestFolder: case ManageEASResetFolder:
if (max > 2) if (max > 2)
{ {
/* value specified on command line */ /* value specified on command line */
deviceId = [sanitizedArguments objectAtIndex: 2]; folderId = [sanitizedArguments objectAtIndex: 2];
//if ([deviceId rangeOfString: @"+"].location == NSNotFound) { oc = [SOGoCacheGCSObject objectWithName: folderId inContainer: nil];
// fprintf(stderr, "ERROR: Deviceid invalid folder \"%@\" not found\n", deviceId);
// return rc;
//}
oc = [SOGoCacheGCSObject objectWithName: deviceId inContainer: nil];
[oc setObjectType: ActiveSyncFolderCacheObject]; [oc setObjectType: ActiveSyncFolderCacheObject];
[oc setContext: localContext]; [oc setContext: localContext];
[oc setTableUrl: folderTableURL]; [oc setTableUrl: folderTableURL];
@@ -311,18 +308,18 @@ NSURL *folderTableURL;
[oc reloadIfNeeded]; [oc reloadIfNeeded];
if ([oc isNew]) { if ([oc isNew]) {
fprintf(stderr, "ERROR: Folder with ID \"%s\" not found\n", [deviceId UTF8String]); fprintf(stderr, "ERROR: Folder with ID \"%s\" not found\n", [folderId UTF8String]);
return rc; return rc;
} }
if ((![deviceId hasSuffix: @"/personal"]) && [[oc properties] objectForKey: @"MergedFolder"]) if ((![folderId hasSuffix: @"/personal"]) && [[oc properties] objectForKey: @"MergedFolder"])
{ {
fprintf(stderr, "ERROR: MergedFolder = true; only personal folder can be reset"); fprintf(stderr, "ERROR: MergedFolder = true; only personal folder can be reset");
return rc; return rc;
} }
else else
{ {
[self _setOrUnsetSyncRequest: YES collections: [NSArray arrayWithObject: deviceId] context: localContext]; [self _setOrUnsetSyncRequest: YES collections: [NSArray arrayWithObject: folderId] context: localContext];
[[oc properties] removeObjectForKey: @"SyncKey"]; [[oc properties] removeObjectForKey: @"SyncKey"];
[[oc properties] removeObjectForKey: @"SyncCache"]; [[oc properties] removeObjectForKey: @"SyncCache"];

View File

@@ -1,8 +1,6 @@
/* SOGoToolUserPreferences.m - this file is part of SOGo /* SOGoToolUserPreferences.m - this file is part of SOGo
* *
* Copyright (C) 2011-2013 Inverse inc. * Copyright (C) 2011-2017 Inverse inc.
*
* Author: Ludovic Marcotte <lmarcotte@inverse.ca>
* *
* This file is free software; you can redistribute it and/or modify * This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -50,10 +48,6 @@ typedef enum
@implementation SOGoToolUserPreferences @implementation SOGoToolUserPreferences
+ (void) initialize
{
}
+ (NSString *) command + (NSString *) command
{ {
return @"user-preferences"; return @"user-preferences";