Skip to content

Commit

Permalink
new commands for 10.8, AB REMOVE FROM PRIVACY LIST/AB Is access denied
Browse files Browse the repository at this point in the history
  • Loading branch information
miyako committed Jan 11, 2013
1 parent 2a4d2c3 commit b02890e
Show file tree
Hide file tree
Showing 16 changed files with 139 additions and 45 deletions.
6 changes: 3 additions & 3 deletions Address Book/4D Plugin API/Classes/C_TEXT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void C_TEXT::convertFromUTF8(const CUTF8String* fromString, CUTF16String* toStri
#else
CFStringRef str = CFStringCreateWithBytes(kCFAllocatorDefault, fromString->c_str(), fromString->length(), kCFStringEncodingUTF8, true);
if(str){
int len = CFStringGetLength(str)+1;
int len = CFStringGetLength(str) + 1;
std::vector<uint8_t> buf(len * sizeof(PA_Unichar));
CFStringGetCharacters(str, CFRangeMake(0, len), (UniChar *)&buf[0]);
*toString = CUTF16String((const PA_Unichar *)&buf[0]);
Expand All @@ -145,7 +145,7 @@ void C_TEXT::convertToUTF8(const CUTF16String* fromString, CUTF8String* toString
int len = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, (LPCWSTR)fromString->c_str(), fromString->length(), NULL, 0, NULL, NULL);

if(len){
std::vector<uint8_t> buf(len);
std::vector<uint8_t> buf(len + 1);
if(WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, (LPCWSTR)fromString->c_str(), fromString->length(), (LPSTR)&buf[0], len, NULL, NULL)){
*toString = CUTF8String((const uint8_t *)&buf[0]);
}
Expand All @@ -156,7 +156,7 @@ void C_TEXT::convertToUTF8(const CUTF16String* fromString, CUTF8String* toString
if(str){

size_t size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), kCFStringEncodingUTF8) + sizeof(uint8_t);
std::vector<uint8_t> buf(size);
std::vector<uint8_t> buf(size + 1);
CFIndex len = 0;
CFStringGetBytes(str, CFRangeMake(0, CFStringGetLength(str)), kCFStringEncodingUTF8, 0, true, (UInt8 *)&buf[0], size, &len);

Expand Down
34 changes: 34 additions & 0 deletions Address Book/4DPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void CommandDispatcher (int32_t pProcNum, sLONG_PTR *pResult, PackagePtr pParams
switch(pProcNum)
{

case kServerDeinitPlugin:
case kDeinitPlugin:
if(listener)
{
Expand Down Expand Up @@ -233,6 +234,14 @@ void CommandDispatcher (int32_t pProcNum, sLONG_PTR *pResult, PackagePtr pParams

case 42 :
AB_GET_PERSON_GROUPS(pResult, pParams);
break;

case 43 :
AB_REMOVE_FROM_PRIVACY_LIST(pResult, pParams);
break;

case 44 :
AB_Is_access_denied(pResult, pParams);
break;
}
#endif
Expand Down Expand Up @@ -3126,4 +3135,29 @@ void AB_GET_PERSON_GROUPS(sLONG_PTR *pResult, PackagePtr pParams)

Param2.toParamAtIndex(pParams, 2);
}

void AB_REMOVE_FROM_PRIVACY_LIST(sLONG_PTR *pResult, PackagePtr pParams)
{
if(NSClassFromString(@"NSUserNotificationCenter")){

NSMutableArray * arguments = [[NSMutableArray alloc]init];

[arguments addObject:@"reset"];
[arguments addObject:@"AddressBook"];

[NSTask launchedTaskWithLaunchPath:@"/usr/bin/tccutil" arguments:arguments];

[arguments release];

}

}

void AB_Is_access_denied(sLONG_PTR *pResult, PackagePtr pParams)
{
C_LONGINT returnValue;

returnValue.setIntValue(![ABAddressBook sharedAddressBook]);
returnValue.setReturn(pResult);
}
#endif
2 changes: 2 additions & 0 deletions Address Book/4DPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ void AB_LIST_GROUP_PEOPLE(sLONG_PTR *pResult, PackagePtr pParams);
void AB_FIND_PEOPLE(sLONG_PTR *pResult, PackagePtr pParams);
void AB_GET_GROUP_GROUPS(sLONG_PTR *pResult, PackagePtr pParams);
void AB_GET_PERSON_GROUPS(sLONG_PTR *pResult, PackagePtr pParams);
void AB_REMOVE_FROM_PRIVACY_LIST(sLONG_PTR *pResult, PackagePtr pParams);
void AB_Is_access_denied(sLONG_PTR *pResult, PackagePtr pParams);
Binary file modified Address Book/4DPlugin.rsrc
Binary file not shown.
Binary file modified Address Book/Address Book.4dbase/Address Book.4DIndy
Binary file not shown.
Binary file modified Address Book/Address Book.4dbase/Address Book.4db
Binary file not shown.
Binary file modified Address Book/Address Book.4dbase/Address Book.4dd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,23 @@ <h1>Address Book</h1>
<ex4D:plugin-description xmlns:ex4D="http://www.4d.com/plugin">
<!-- write documentation for Address Book here -->
<p>This plugin gives access to the Address Book shared datastore from 4D.</p>
<p>Change list for 2013-01-12</p>
<p>New Commands</p>
<p>
<a href="#command:9,44">AB Is access denied</a>
</p>
<p>
<a href="#command:9,43">AB REMOVE FROM PRIVACY LIST</a>
</p>
<p>Change list for 2012-05-19</p>
<p>New Commands</p>
<p>
<a href="#command:9,44">AB Is access denied</a>
</p>
<p>
<a href="#command:9,43">AB REMOVE FROM PRIVACY LIST</a>
</p>
<p>
<a href="#command:9,41">AB GET GROUP GROUPS</a>
</p>
<p>
Expand Down Expand Up @@ -1430,6 +1444,23 @@ <h3>AB GET PERSON GROUPS</h3>
<!-- write documentation for AB GET PERSON GROUPS here -->
<p>Get the parent groups to which the person belongs.</p>
</ex4D:command-description>
<a name="command:9,44"></a>
<h3>AB Is access denied</h3>
<p>
<code>LONGINT:=AB Is access denied</code>
</p>
<p>
<code>returnValue</code> (LONGINT)<br>
<ex4D:return-value label="" type="L" xmlns:ex4D="http://www.4d.com/plugin">
<!-- write documentation for return value (LONGINT) here-->
</ex4D:return-value>
</p>
<p>
<span class="title">Discussion</span>
</p>
<ex4D:command-description xmlns:ex4D="http://www.4d.com/plugin">
<!-- write documentation for AB Is access denied here -->
</ex4D:command-description>
<a name="command:9,39"></a>
<h3>AB LIST GROUP PEOPLE</h3>
<p>
Expand Down Expand Up @@ -1505,6 +1536,17 @@ <h3>AB LIST GROUP PEOPLE</h3>
<!-- write documentation for AB LIST GROUP PEOPLE here -->
<p>This command allows one to retrive basic information about all the people who belongs to a group in one call.</p>
</ex4D:command-description>
<a name="command:9,43"></a>
<h3>AB REMOVE FROM PRIVACY LIST</h3>
<p>
<code>AB REMOVE FROM PRIVACY LIST</code>
</p>
<p>
<span class="title">Discussion</span>
</p>
<ex4D:command-description xmlns:ex4D="http://www.4d.com/plugin">
<!-- write documentation for AB REMOVE FROM PRIVACY LIST here -->
</ex4D:command-description>
<a name="constant:1"></a>
<h2>AB Labels</h2>
<p>
Expand Down Expand Up @@ -2111,6 +2153,6 @@ <h2>AB Conjunction</h2>
<code><a name="constant:10,2"></a>AB And (1)</code>
</p>
<p class="footer">
<span class="title">Documentation Update: </span>2012-11-04T21:53:1909:00</p>
<span class="title">Documentation Update: </span>2013-01-11T15:29:3609:00</p>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,14 @@ <h3>Commands</h3>
<a target="content" href="./content.html#command:9,42">AB GET PERSON GROUPS</a>
</dd>
<dd>
<a target="content" href="./content.html#command:9,44">AB Is access denied</a>
</dd>
<dd>
<a target="content" href="./content.html#command:9,39">AB LIST GROUP PEOPLE</a>
</dd>
<dd>
<a target="content" href="./content.html#command:9,43">AB REMOVE FROM PRIVACY LIST</a>
</dd>
</dl>
<h3>Constants</h3>
<p>
Expand Down

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
31 changes: 16 additions & 15 deletions Address Book/Address Book.xcodeproj/miyako.mode1v3
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@
<key>Layout</key>
<array>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
Expand Down Expand Up @@ -297,7 +295,7 @@
<real>246</real>
</array>
<key>RubberWindowFrame</key>
<string>607 335 788 504 0 0 1440 878 </string>
<string>629 333 788 504 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
Expand Down Expand Up @@ -325,7 +323,7 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>D1C2F6C51662EB200070B241</string>
<string>D1A0819A16A06695008C3775</string>
<key>history</key>
<array>
<string>D145370516471E1500A7AF39</string>
Expand All @@ -334,7 +332,7 @@
<string>D14537391647212C00A7AF39</string>
<string>D145373A1647212C00A7AF39</string>
<string>D14537461647246500A7AF39</string>
<string>D1C2F65D1662E9080070B241</string>
<string>D159386C16A0625F009C796A</string>
</array>
</dict>
<key>SplitCount</key>
Expand All @@ -346,16 +344,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {535, 242}}</string>
<string>{{0, 0}, {535, 222}}</string>
<key>RubberWindowFrame</key>
<string>607 335 788 504 0 0 1440 878 </string>
<string>629 333 788 504 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>242pt</string>
<string>222pt</string>
</dict>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
Expand All @@ -366,14 +366,14 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 247}, {535, 216}}</string>
<string>{{0, 227}, {535, 236}}</string>
<key>RubberWindowFrame</key>
<string>607 335 788 504 0 0 1440 878 </string>
<string>629 333 788 504 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
<key>Proportion</key>
<string>216pt</string>
<string>236pt</string>
</dict>
</array>
<key>Proportion</key>
Expand All @@ -392,9 +392,9 @@
</array>
<key>TableOfContents</key>
<array>
<string>D1C2F6C61662EB200070B241</string>
<string>D1A0818B16A062DA008C3775</string>
<string>1CE0B1FE06471DED0097A5F4</string>
<string>D1C2F6C71662EB200070B241</string>
<string>D1A0818C16A062DA008C3775</string>
<string>1CE0B20306471E060097A5F4</string>
<string>1CE0B20506471E060097A5F4</string>
</array>
Expand Down Expand Up @@ -532,11 +532,12 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>D1A0818D16A062DA008C3775</string>
<string>D14536EA16471D5C00A7AF39</string>
<string>/Users/miyako/github-miyako/4d-plugin-address-book/Address Book/Address Book.xcodeproj</string>
</array>
<key>WindowString</key>
<string>607 335 788 504 0 0 1440 878 </string>
<string>629 333 788 504 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>
Expand Down Expand Up @@ -613,7 +614,7 @@
<key>TableOfContents</key>
<array>
<string>D14536EA16471D5C00A7AF39</string>
<string>D1C2F6C81662EB200070B241</string>
<string>D1A0819116A062DA008C3775</string>
<string>1CD0528F0623707200166675</string>
<string>XCMainBuildResultsModuleGUID</string>
</array>
Expand Down
59 changes: 34 additions & 25 deletions Address Book/Address Book.xcodeproj/miyako.pbxuser
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 375581462;
PBXWorkspaceStateSaveDate = 375581462;
PBXPerProjectTemplateStateSaveDate = 379609798;
PBXWorkspaceStateSaveDate = 379609798;
};
perUserProjectItems = {
D145370516471E1500A7AF39 /* PBXTextBookmark */ = D145370516471E1500A7AF39 /* PBXTextBookmark */;
Expand All @@ -62,8 +62,8 @@
D14537391647212C00A7AF39 /* PBXTextBookmark */ = D14537391647212C00A7AF39 /* PBXTextBookmark */;
D145373A1647212C00A7AF39 /* PBXTextBookmark */ = D145373A1647212C00A7AF39 /* PBXTextBookmark */;
D14537461647246500A7AF39 /* PBXTextBookmark */ = D14537461647246500A7AF39 /* PBXTextBookmark */;
D1C2F65D1662E9080070B241 /* PBXTextBookmark */ = D1C2F65D1662E9080070B241 /* PBXTextBookmark */;
D1C2F6C51662EB200070B241 /* PBXTextBookmark */ = D1C2F6C51662EB200070B241 /* PBXTextBookmark */;
D159386C16A0625F009C796A /* PBXTextBookmark */ = D159386C16A0625F009C796A /* PBXTextBookmark */;
D1A0819A16A06695008C3775 /* PBXTextBookmark */ = D1A0819A16A06695008C3775 /* PBXTextBookmark */;
};
sourceControlManager = D14536EC16471D5C00A7AF39 /* Source Control */;
userBuildSettings = {
Expand All @@ -87,16 +87,17 @@
};
18B684F406944F2000CC6A1E /* PublicTypes.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {474, 12363}}";
sepNavSelRange = "{375, 0}";
sepNavVisRange = "{188, 354}";
sepNavIntBoundsRect = "{{0, 0}, {656, 12701}}";
sepNavSelRange = "{3372, 19}";
sepNavVisRange = "{3079, 1353}";
sepNavWindowFrame = "{{38, 103}, {674, 749}}";
};
};
18B684FE06944F8800CC6A1E /* 4DPlugin.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {607, 41340}}";
sepNavSelRange = "{549, 0}";
sepNavVisRange = "{298, 388}";
sepNavIntBoundsRect = "{{0, 0}, {593, 41925}}";
sepNavSelRange = "{4409, 0}";
sepNavVisRange = "{4250, 296}";
sepNavWindowFrame = "{{453, 138}, {751, 740}}";
};
};
Expand All @@ -108,6 +109,14 @@
sepNavWindowFrame = "{{484, 126}, {751, 740}}";
};
};
D120937E13534DCC00A72CAA /* 4DPlugin.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {692, 962}}";
sepNavSelRange = "{3359, 0}";
sepNavVisRange = "{1134, 2294}";
sepNavWindowFrame = "{{637, 138}, {751, 740}}";
};
};
D14536EC16471D5C00A7AF39 /* Source Control */ = {
isa = PBXSourceControlManager;
fallbackIsa = XCSourceControlManager;
Expand Down Expand Up @@ -214,6 +223,16 @@
vrLen = 490;
vrLoc = 0;
};
D159386C16A0625F009C796A /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 18B684FE06944F8800CC6A1E /* 4DPlugin.cpp */;
name = "4DPlugin.cpp: 240";
rLen = 0;
rLoc = 4409;
rType = 0;
vrLen = 313;
vrLoc = 4233;
};
D16AC3A8147CB499000AA750 /* ARRAY_BOOLEAN.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {628, 1742}}";
Expand All @@ -236,24 +255,14 @@
sepNavVisRange = "{0, 1089}";
};
};
D1C2F65D1662E9080070B241 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 18B684FE06944F8800CC6A1E /* 4DPlugin.cpp */;
name = "4DPlugin.cpp: 20";
rLen = 0;
rLoc = 549;
rType = 0;
vrLen = 388;
vrLoc = 298;
};
D1C2F6C51662EB200070B241 /* PBXTextBookmark */ = {
D1A0819A16A06695008C3775 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 18B684FE06944F8800CC6A1E /* 4DPlugin.cpp */;
name = "4DPlugin.cpp: 20";
name = "4DPlugin.cpp: 240";
rLen = 0;
rLoc = 549;
rLoc = 4409;
rType = 0;
vrLen = 388;
vrLoc = 298;
vrLen = 296;
vrLoc = 4250;
};
}

0 comments on commit b02890e

Please sign in to comment.