Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Integrating Faunus advertisement with DisplayCast

  • Loading branch information...
commit 2fdfa5abcc2aefe6601315c8c1f1f05dcf219fa0 1 parent 1ee992d
@DisplayCast authored
Showing with 460 additions and 171 deletions.
  1. +123 −84 DisplayCast.xcworkspace/xcuserdata/chandra.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  2. +16 −24 Faunus/Faunus.xcodeproj/project.pbxproj
  3. +1 −0  Faunus/Faunus.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Faunus-iOS.xcscheme
  4. +1 −0  Faunus/Faunus.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Faunus.xcscheme
  5. +5 −4 Faunus/Faunus.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/FaunusTest.xcscheme
  6. +1 −0  Faunus/Faunus.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Faunusd.xcscheme
  7. +5 −0 OSX/Archiver/ArchiverAppDelegate.h
  8. +80 −5 OSX/Archiver/ArchiverAppDelegate.m
  9. +1 −0  OSX/Faunus/Faunus.h
  10. +13 −0 OSX/Faunus/Faunus.m
  11. +1 −0  OSX/Faunusd/NameServer.h
  12. +1 −1  OSX/Faunusd/NameServer.m
  13. +0 −1  OSX/Faunusd/WhiteBoard.m
  14. +2 −1  OSX/Faunusd/main.m
  15. +2 −1  OSX/OSX.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/All.xcscheme
  16. +2 −1  OSX/OSX.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Archiver.xcscheme
  17. +2 −1  OSX/OSX.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Player.xcscheme
  18. +2 −1  OSX/OSX.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Preferences.xcscheme
  19. +2 −1  OSX/OSX.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Streamer.xcscheme
  20. +6 −1 OSX/Player/PlayerAppDelegate.h
  21. +76 −6 OSX/Player/PlayerAppDelegate.m
  22. +4 −0 OSX/Streamer/Streamer.h
  23. +62 −24 OSX/Streamer/Streamer.m
  24. +1 −1  OSX/Streamer/StreamerAppDelegate.h
  25. +49 −13 OSX/Streamer/StreamerAppDelegate.m
  26. +2 −1  iOS/iOS.xcodeproj/xcshareddata/xcschemes/Player.xcscheme
View
207 DisplayCast.xcworkspace/xcuserdata/chandra.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -801,11 +801,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Streamer/StreamerAppDelegate.m"
- timestampString = "359872277.29938"
+ timestampString = "363832946.908975"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "453"
- endingLineNumber = "453"
+ startingLineNumber = "487"
+ endingLineNumber = "487"
landmarkName = "-applicationDidFinishLaunching:"
landmarkType = "5">
</FileBreakpoint>
@@ -814,11 +814,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "359405775.734705"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "404"
- endingLineNumber = "404"
+ startingLineNumber = "410"
+ endingLineNumber = "410"
landmarkName = "-createServerSocketWithAcceptCallBack:"
landmarkType = "5">
</FileBreakpoint>
@@ -853,11 +853,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "359404570.657798"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "106"
- endingLineNumber = "106"
+ startingLineNumber = "112"
+ endingLineNumber = "112"
landmarkName = "receiveCmdData()"
landmarkType = "7">
</FileBreakpoint>
@@ -866,11 +866,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "359404575.861251"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "105"
- endingLineNumber = "105"
+ startingLineNumber = "111"
+ endingLineNumber = "111"
landmarkName = "receiveCmdData()"
landmarkType = "7">
</FileBreakpoint>
@@ -879,11 +879,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1043"
- endingLineNumber = "1043"
+ startingLineNumber = "1109"
+ endingLineNumber = "1109"
landmarkName = "-receiveFromService:"
landmarkType = "5">
</FileBreakpoint>
@@ -892,11 +892,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1040"
- endingLineNumber = "1040"
+ startingLineNumber = "1106"
+ endingLineNumber = "1106"
landmarkName = "@implementation PlayerAppDelegate"
landmarkType = "3">
</FileBreakpoint>
@@ -905,11 +905,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "359405834.72118"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "321"
- endingLineNumber = "321"
+ startingLineNumber = "327"
+ endingLineNumber = "327"
landmarkName = "receiveCmdData()"
landmarkType = "7">
</FileBreakpoint>
@@ -918,11 +918,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "359411342.63109"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "705"
- endingLineNumber = "705"
+ startingLineNumber = "769"
+ endingLineNumber = "769"
landmarkName = "-streamAction:"
landmarkType = "5">
</FileBreakpoint>
@@ -931,11 +931,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "359411704.775386"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "710"
- endingLineNumber = "710"
+ startingLineNumber = "774"
+ endingLineNumber = "774"
landmarkName = "-streamAction:"
landmarkType = "5">
</FileBreakpoint>
@@ -944,11 +944,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1179"
- endingLineNumber = "1179"
+ startingLineNumber = "1245"
+ endingLineNumber = "1245"
landmarkName = "-receiveFromService:"
landmarkType = "5">
</FileBreakpoint>
@@ -957,11 +957,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1180"
- endingLineNumber = "1180"
+ startingLineNumber = "1246"
+ endingLineNumber = "1246"
landmarkName = "-receiveFromService:"
landmarkType = "5">
</FileBreakpoint>
@@ -970,11 +970,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1249"
- endingLineNumber = "1249"
+ startingLineNumber = "1317"
+ endingLineNumber = "1317"
landmarkName = "-receiveFromService:"
landmarkType = "5">
</FileBreakpoint>
@@ -983,11 +983,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1325"
- endingLineNumber = "1325"
+ startingLineNumber = "1393"
+ endingLineNumber = "1393"
landmarkName = "-receiveFromService:"
landmarkType = "5">
</FileBreakpoint>
@@ -996,11 +996,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1099"
- endingLineNumber = "1099"
+ startingLineNumber = "1165"
+ endingLineNumber = "1165"
landmarkName = "-receiveFromService:"
landmarkType = "5">
</FileBreakpoint>
@@ -1009,11 +1009,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1100"
- endingLineNumber = "1100"
+ startingLineNumber = "1166"
+ endingLineNumber = "1166"
landmarkName = "-receiveFromService:"
landmarkType = "5">
</FileBreakpoint>
@@ -1022,11 +1022,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "962"
- endingLineNumber = "962"
+ startingLineNumber = "1026"
+ endingLineNumber = "1026"
landmarkName = "drawWin()"
landmarkType = "7">
</FileBreakpoint>
@@ -1035,11 +1035,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Streamer/Streamer.m"
- timestampString = "359871941.349358"
+ timestampString = "363820327.52141"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "499"
- endingLineNumber = "499"
+ startingLineNumber = "537"
+ endingLineNumber = "537"
landmarkName = "streamListeningSocketCallback()"
landmarkType = "7">
</FileBreakpoint>
@@ -1048,11 +1048,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1086"
- endingLineNumber = "1086"
+ startingLineNumber = "1152"
+ endingLineNumber = "1152"
landmarkName = "-receiveFromService:"
landmarkType = "5">
</FileBreakpoint>
@@ -1061,11 +1061,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "1085"
- endingLineNumber = "1085"
+ startingLineNumber = "1151"
+ endingLineNumber = "1151"
landmarkName = "-receiveFromService:"
landmarkType = "5">
</FileBreakpoint>
@@ -1074,11 +1074,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360056318.713451"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "983"
- endingLineNumber = "983"
+ startingLineNumber = "1047"
+ endingLineNumber = "1047"
landmarkName = "displayWin()"
landmarkType = "7">
</FileBreakpoint>
@@ -1087,11 +1087,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Streamer/Streamer.m"
- timestampString = "359855855.154955"
+ timestampString = "363740468.149413"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "188"
- endingLineNumber = "188"
+ startingLineNumber = "189"
+ endingLineNumber = "189"
landmarkName = "MyScreenRefreshCallback()"
landmarkType = "7">
</FileBreakpoint>
@@ -1100,11 +1100,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Streamer/Streamer.m"
- timestampString = "359870631.311887"
+ timestampString = "363740468.149413"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "184"
- endingLineNumber = "184"
+ startingLineNumber = "185"
+ endingLineNumber = "185"
landmarkName = "MyScreenRefreshCallback()"
landmarkType = "7">
</FileBreakpoint>
@@ -1113,11 +1113,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Player/PlayerAppDelegate.m"
- timestampString = "360020649.346415"
+ timestampString = "363833322.203363"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "448"
- endingLineNumber = "448"
+ startingLineNumber = "454"
+ endingLineNumber = "454"
landmarkName = "-applicationDidFinishLaunching:"
landmarkType = "5">
</FileBreakpoint>
@@ -1631,11 +1631,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Faunus/Faunus.m"
- timestampString = "362958922.090963"
+ timestampString = "363820327.52141"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "250"
- endingLineNumber = "250"
+ startingLineNumber = "263"
+ endingLineNumber = "263"
landmarkName = "-addAttr:andValue:forName:"
landmarkType = "5">
</FileBreakpoint>
@@ -1644,11 +1644,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Faunus/Faunus.m"
- timestampString = "362958922.090963"
+ timestampString = "363820327.52141"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "271"
- endingLineNumber = "271"
+ startingLineNumber = "284"
+ endingLineNumber = "284"
landmarkName = "-addAttr:andValue:forName:"
landmarkType = "5">
</FileBreakpoint>
@@ -1670,11 +1670,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Faunus/Faunus.m"
- timestampString = "362958922.090963"
+ timestampString = "363820327.52141"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "423"
- endingLineNumber = "423"
+ startingLineNumber = "436"
+ endingLineNumber = "436"
landmarkName = "-listAttrs:"
landmarkType = "5">
</FileBreakpoint>
@@ -1748,11 +1748,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Faunus/Faunus.m"
- timestampString = "362967911.92989"
+ timestampString = "363820327.52141"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "448"
- endingLineNumber = "448"
+ startingLineNumber = "461"
+ endingLineNumber = "461"
landmarkName = "-mergeToWallet:"
landmarkType = "5">
</FileBreakpoint>
@@ -1813,11 +1813,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSX/Faunus/Faunus.m"
- timestampString = "363047551.57063"
+ timestampString = "363820327.52141"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "514"
- endingLineNumber = "514"
+ startingLineNumber = "527"
+ endingLineNumber = "527"
landmarkName = "-cloneCapability:"
landmarkType = "5">
</FileBreakpoint>
@@ -1847,5 +1847,44 @@
landmarkName = "-HTTPConnection:didReceiveRequest:"
landmarkType = "5">
</FileBreakpoint>
+ <FileBreakpoint
+ shouldBeEnabled = "No"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ filePath = "OSX/Streamer/Streamer.m"
+ timestampString = "363818305.185646"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "347"
+ endingLineNumber = "347"
+ landmarkName = "-init"
+ landmarkType = "5">
+ </FileBreakpoint>
+ <FileBreakpoint
+ shouldBeEnabled = "No"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ filePath = "OSX/Streamer/Streamer.m"
+ timestampString = "363818393.079129"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "386"
+ endingLineNumber = "386"
+ landmarkName = "-init"
+ landmarkType = "5">
+ </FileBreakpoint>
+ <FileBreakpoint
+ shouldBeEnabled = "No"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ filePath = "OSX/Streamer/StreamerAppDelegate.m"
+ timestampString = "363833394.573758"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "86"
+ endingLineNumber = "86"
+ landmarkName = "-menuNeedsUpdate:"
+ landmarkType = "5">
+ </FileBreakpoint>
</FileBreakpoints>
</Bucket>
View
40 Faunus/Faunus.xcodeproj/project.pbxproj
@@ -9,14 +9,11 @@
/* Begin PBXBuildFile section */
761768D915A3B0F900AE8553 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 761768D815A3B0F900AE8553 /* Cocoa.framework */; };
761768F915A3B13100AE8553 /* Faunus.h in Resources */ = {isa = PBXBuildFile; fileRef = 761768ED15A3B13100AE8553 /* Faunus.h */; };
- 761768FA15A3B13100AE8553 /* Faunus.m in Resources */ = {isa = PBXBuildFile; fileRef = 761768EE15A3B13100AE8553 /* Faunus.m */; };
761768FB15A3B13100AE8553 /* Capabilities.h in Resources */ = {isa = PBXBuildFile; fileRef = 761768EF15A3B13100AE8553 /* Capabilities.h */; };
- 761768FC15A3B13100AE8553 /* Capabilities.m in Resources */ = {isa = PBXBuildFile; fileRef = 761768F015A3B13100AE8553 /* Capabilities.m */; };
761768FD15A3B13100AE8553 /* Wallet.h in Resources */ = {isa = PBXBuildFile; fileRef = 761768F115A3B13100AE8553 /* Wallet.h */; };
- 761768FE15A3B13100AE8553 /* Wallet.m in Resources */ = {isa = PBXBuildFile; fileRef = 761768F215A3B13100AE8553 /* Wallet.m */; };
- 761768FF15A3B13100AE8553 /* Faunus-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 761768F315A3B13100AE8553 /* Faunus-Info.plist */; };
7617690015A3B13100AE8553 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 761768F515A3B13100AE8553 /* InfoPlist.strings */; };
7617690115A3B13100AE8553 /* Faunus-Prefix.pch in Resources */ = {isa = PBXBuildFile; fileRef = 761768F615A3B13100AE8553 /* Faunus-Prefix.pch */; };
+ 7663C11C15A435A60026704F /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7663C11B15A435A60026704F /* libsqlite3.dylib */; };
767EAD9615A3B88D00B956C0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7617690815A3B16A00AE8553 /* Foundation.framework */; };
767EADA515A3B90F00B956C0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 767EADA415A3B90F00B956C0 /* main.m */; };
767EADAE15A3BA6E00B956C0 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 767EADAD15A3BA6E00B956C0 /* CoreData.framework */; };
@@ -25,7 +22,6 @@
767EADDA15A3BCA500B956C0 /* libhiredis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 767EADD915A3BCA500B956C0 /* libhiredis.a */; };
767EAE0715A3C0C500B956C0 /* Faunus.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 761768D515A3B0F900AE8553 /* Faunus.framework */; };
767EAE0A15A3C1E700B956C0 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 767EAE0915A3C1E700B956C0 /* libsqlite3.dylib */; };
- 767EAE0D15A3C39D00B956C0 /* Faunus.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 767EADF815A3BEC300B956C0 /* Faunus.xcdatamodeld */; };
767EAE0E15A3C39D00B956C0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 767EADFB15A3BEC300B956C0 /* main.m */; };
767EAE0F15A3C39D00B956C0 /* NameServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 767EADFD15A3BEC300B956C0 /* NameServer.m */; };
767EAE1015A3C39D00B956C0 /* WhiteBoard.m in Sources */ = {isa = PBXBuildFile; fileRef = 767EADFF15A3BEC300B956C0 /* WhiteBoard.m */; };
@@ -38,20 +34,16 @@
767EAE1715A3C39D00B956C0 /* redisName.m in Sources */ = {isa = PBXBuildFile; fileRef = 767EADEC15A3BE4500B956C0 /* redisName.m */; };
767EAE1815A3C39D00B956C0 /* HTTPServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 767EADF315A3BE8700B956C0 /* HTTPServer.m */; };
767EAE1915A3C39D00B956C0 /* TCPServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 767EADF515A3BE8700B956C0 /* TCPServer.m */; };
+ 7686421415AE3844007904A3 /* Faunus.h in Headers */ = {isa = PBXBuildFile; fileRef = 761768ED15A3B13100AE8553 /* Faunus.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 7686421515AE3844007904A3 /* Capabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 761768EF15A3B13100AE8553 /* Capabilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 7686421615AE3844007904A3 /* Wallet.h in Headers */ = {isa = PBXBuildFile; fileRef = 761768F115A3B13100AE8553 /* Wallet.h */; settings = {ATTRIBUTES = (Public, ); }; };
76BDE78E15A3B32100BDB261 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7617690815A3B16A00AE8553 /* Foundation.framework */; };
- 76BDE79915A3B34B00BDB261 /* Faunus.h in Sources */ = {isa = PBXBuildFile; fileRef = 761768ED15A3B13100AE8553 /* Faunus.h */; };
76BDE79A15A3B34B00BDB261 /* Faunus.m in Sources */ = {isa = PBXBuildFile; fileRef = 761768EE15A3B13100AE8553 /* Faunus.m */; };
- 76BDE79B15A3B34B00BDB261 /* Capabilities.h in Sources */ = {isa = PBXBuildFile; fileRef = 761768EF15A3B13100AE8553 /* Capabilities.h */; };
76BDE79C15A3B34B00BDB261 /* Capabilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 761768F015A3B13100AE8553 /* Capabilities.m */; };
- 76BDE79D15A3B34B00BDB261 /* Wallet.h in Sources */ = {isa = PBXBuildFile; fileRef = 761768F115A3B13100AE8553 /* Wallet.h */; };
76BDE79E15A3B34B00BDB261 /* Wallet.m in Sources */ = {isa = PBXBuildFile; fileRef = 761768F215A3B13100AE8553 /* Wallet.m */; };
- 76BDE7E615A3B5B100BDB261 /* Faunus.h in Sources */ = {isa = PBXBuildFile; fileRef = 761768ED15A3B13100AE8553 /* Faunus.h */; };
76BDE7E715A3B5B100BDB261 /* Faunus.m in Sources */ = {isa = PBXBuildFile; fileRef = 761768EE15A3B13100AE8553 /* Faunus.m */; };
- 76BDE7E815A3B5B100BDB261 /* Capabilities.h in Sources */ = {isa = PBXBuildFile; fileRef = 761768EF15A3B13100AE8553 /* Capabilities.h */; };
76BDE7E915A3B5B100BDB261 /* Capabilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 761768F015A3B13100AE8553 /* Capabilities.m */; };
- 76BDE7EA15A3B5B100BDB261 /* Wallet.h in Sources */ = {isa = PBXBuildFile; fileRef = 761768F115A3B13100AE8553 /* Wallet.h */; };
76BDE7EB15A3B5B100BDB261 /* Wallet.m in Sources */ = {isa = PBXBuildFile; fileRef = 761768F215A3B13100AE8553 /* Wallet.m */; };
- 76BDE7EC15A3B5B100BDB261 /* Faunus-Prefix.pch in Sources */ = {isa = PBXBuildFile; fileRef = 761768F615A3B13100AE8553 /* Faunus-Prefix.pch */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -100,6 +92,7 @@
761768F415A3B13100AE8553 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
761768F615A3B13100AE8553 /* Faunus-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Faunus-Prefix.pch"; sourceTree = "<group>"; };
7617690815A3B16A00AE8553 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 7663C11B15A435A60026704F /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/libsqlite3.dylib; sourceTree = DEVELOPER_DIR; };
767EAD9415A3B88D00B956C0 /* FaunusTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = FaunusTest; sourceTree = BUILT_PRODUCTS_DIR; };
767EADA215A3B90F00B956C0 /* FaunusTest-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FaunusTest-Prefix.pch"; sourceTree = "<group>"; };
767EADA315A3B90F00B956C0 /* FaunusTest.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; path = FaunusTest.1; sourceTree = "<group>"; };
@@ -174,6 +167,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 7663C11C15A435A60026704F /* libsqlite3.dylib in Frameworks */,
76BDE78E15A3B32100BDB261 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -204,6 +198,7 @@
761768D715A3B0F900AE8553 /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 7663C11B15A435A60026704F /* libsqlite3.dylib */,
767EAE0915A3C1E700B956C0 /* libsqlite3.dylib */,
767EADD915A3BCA500B956C0 /* libhiredis.a */,
767EADD715A3BC0A00B956C0 /* CFNetwork.framework */,
@@ -345,6 +340,9 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
+ 7686421415AE3844007904A3 /* Faunus.h in Headers */,
+ 7686421515AE3844007904A3 /* Capabilities.h in Headers */,
+ 7686421615AE3844007904A3 /* Wallet.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -455,12 +453,8 @@
buildActionMask = 2147483647;
files = (
761768F915A3B13100AE8553 /* Faunus.h in Resources */,
- 761768FA15A3B13100AE8553 /* Faunus.m in Resources */,
761768FB15A3B13100AE8553 /* Capabilities.h in Resources */,
- 761768FC15A3B13100AE8553 /* Capabilities.m in Resources */,
761768FD15A3B13100AE8553 /* Wallet.h in Resources */,
- 761768FE15A3B13100AE8553 /* Wallet.m in Resources */,
- 761768FF15A3B13100AE8553 /* Faunus-Info.plist in Resources */,
7617690015A3B13100AE8553 /* InfoPlist.strings in Resources */,
7617690115A3B13100AE8553 /* Faunus-Prefix.pch in Resources */,
);
@@ -473,13 +467,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 76BDE7E615A3B5B100BDB261 /* Faunus.h in Sources */,
76BDE7E715A3B5B100BDB261 /* Faunus.m in Sources */,
- 76BDE7E815A3B5B100BDB261 /* Capabilities.h in Sources */,
76BDE7E915A3B5B100BDB261 /* Capabilities.m in Sources */,
- 76BDE7EA15A3B5B100BDB261 /* Wallet.h in Sources */,
76BDE7EB15A3B5B100BDB261 /* Wallet.m in Sources */,
- 76BDE7EC15A3B5B100BDB261 /* Faunus-Prefix.pch in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -495,7 +485,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 767EAE0D15A3C39D00B956C0 /* Faunus.xcdatamodeld in Sources */,
767EAE0E15A3C39D00B956C0 /* main.m in Sources */,
767EAE0F15A3C39D00B956C0 /* NameServer.m in Sources */,
767EAE1015A3C39D00B956C0 /* WhiteBoard.m in Sources */,
@@ -515,11 +504,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 76BDE79915A3B34B00BDB261 /* Faunus.h in Sources */,
76BDE79A15A3B34B00BDB261 /* Faunus.m in Sources */,
- 76BDE79B15A3B34B00BDB261 /* Capabilities.h in Sources */,
76BDE79C15A3B34B00BDB261 /* Capabilities.m in Sources */,
- 76BDE79D15A3B34B00BDB261 /* Wallet.h in Sources */,
76BDE79E15A3B34B00BDB261 /* Wallet.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -653,6 +639,7 @@
"\"$(SRCROOT)/../../hiredis\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
+ VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
@@ -670,6 +657,7 @@
"\"$(SRCROOT)/../../hiredis\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
+ VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
@@ -685,6 +673,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
+ USER_HEADER_SEARCH_PATHS = ../OSX/Faunusd;
};
name = Debug;
};
@@ -700,6 +689,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
+ USER_HEADER_SEARCH_PATHS = ../OSX/Faunusd;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -732,6 +722,7 @@
767EADA015A3B88D00B956C0 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
767EADBA15A3BA6E00B956C0 /* Build configuration list for PBXNativeTarget "Faunusd" */ = {
isa = XCConfigurationList;
@@ -740,6 +731,7 @@
767EADBC15A3BA6E00B956C0 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
76BDE79615A3B32100BDB261 /* Build configuration list for PBXNativeTarget "Faunus-iOS" */ = {
isa = XCConfigurationList;
View
1  Faunus/Faunus.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Faunus-iOS.xcscheme
@@ -38,6 +38,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
View
1  Faunus/Faunus.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Faunus.xcscheme
@@ -38,6 +38,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
View
9 Faunus/Faunus.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/FaunusTest.xcscheme
@@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "7617690515A3B16A00AE8553"
+ BlueprintIdentifier = "767EAD9315A3B88D00B956C0"
BuildableName = "FaunusTest"
BlueprintName = "FaunusTest"
ReferencedContainer = "container:Faunus.xcodeproj">
@@ -32,7 +32,7 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "7617690515A3B16A00AE8553"
+ BlueprintIdentifier = "767EAD9315A3B88D00B956C0"
BuildableName = "FaunusTest"
BlueprintName = "FaunusTest"
ReferencedContainer = "container:Faunus.xcodeproj">
@@ -47,11 +47,12 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "7617690515A3B16A00AE8553"
+ BlueprintIdentifier = "767EAD9315A3B88D00B956C0"
BuildableName = "FaunusTest"
BlueprintName = "FaunusTest"
ReferencedContainer = "container:Faunus.xcodeproj">
@@ -69,7 +70,7 @@
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "7617690515A3B16A00AE8553"
+ BlueprintIdentifier = "767EAD9315A3B88D00B956C0"
BuildableName = "FaunusTest"
BlueprintName = "FaunusTest"
ReferencedContainer = "container:Faunus.xcodeproj">
View
1  Faunus/Faunus.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Faunusd.xcscheme
@@ -47,6 +47,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
View
5 OSX/Archiver/ArchiverAppDelegate.h
@@ -4,6 +4,9 @@
#import <Cocoa/Cocoa.h>
+#import <Faunus/Faunus.h>
+#import <Faunus/Wallet.h>
+
@interface ArchiverAppDelegate : NSObject <NSStreamDelegate, NSNetServiceBrowserDelegate, NSNetServiceDelegate, NSWindowDelegate, NSApplicationDelegate> {
NSArrayController * _servicesArray;
@@ -27,6 +30,8 @@
}
@property (nonatomic, retain) NSTimer *timer;
+@property (nonatomic, retain) Faunus *faunus;
+@property (nonatomic, retain) NSString *archiverID;
@property (nonatomic, retain, readwrite) IBOutlet NSArrayController * servicesArray;
View
85 OSX/Archiver/ArchiverAppDelegate.m
@@ -45,6 +45,9 @@ @implementation ArchiverAppDelegate
@synthesize timer = _timer;
+@synthesize faunus;
+@synthesize archiverID;
+
NSNetService *netService;
NSMutableData *receivedData;
@@ -255,7 +258,8 @@ - (void)setServiceName:(NSString *)newValue {
[myKeys setValue:self->_serviceName forKey:@"name"];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
-
+
+ [faunus addAttrs:myKeys forName:archiverID];
}
}
}
@@ -401,7 +405,7 @@ void drawWin(UInt32 *winData, int width, int height, int x, int y, int w, int h,
#pragma mark Runs as a thread, processing data from a particular streamer
- (void)updateKey:(AVAssetWriter *)videoWriter andNSNetService: (NSNetService *)ns {
// NSLog(@"Window state changed");
- NSString *archiverID = [[NSUserDefaults standardUserDefaults] stringForKey:myUniqueID];
+ archiverID = [[NSUserDefaults standardUserDefaults] stringForKey:myUniqueID];
NSString *session = [[NSString alloc] initWithFormat:@"%@ %@", [ns name], archiverID];
NSString *myID = [[NSString alloc] initWithFormat:@"%lu", [videoWriter hash]];
@@ -409,6 +413,8 @@ - (void)updateKey:(AVAssetWriter *)videoWriter andNSNetService: (NSNetService *)
[myKeys setValue:session forKey:myID];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
+
+ [faunus addAttrs:myKeys forName:archiverID];
}
#ifdef OCR
@@ -748,6 +754,8 @@ - (void)receiveFromService:(NSNetService *)ns {
[videoWriter startSessionAtSourceTime:kCMTimeZero];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
+
+ [faunus addAttrs:myKeys forName:archiverID];
[self updateKey:videoWriter andNSNetService:ns];
dispatchQueue = dispatch_queue_create("com.fxpal.displaycast.archiver.encoder", NULL);
@@ -903,7 +911,9 @@ - (void)receiveFromService:(NSNetService *)ns {
NSString *myID = [NSString stringWithFormat:@"%lu", [videoWriter hash]];
[myKeys removeObjectForKey:myID];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
-
+
+ [faunus addAttrs:myKeys forName:archiverID];
+
if ([videoWriter finishWriting] == NO)
NSLog(@"Video completion failed");
}];
@@ -917,6 +927,8 @@ - (void)receiveFromService:(NSNetService *)ns {
NSString *myID = [[NSString alloc] initWithFormat:@"%lu", [activeNSSessions[sessionIndex] hash]];
[myKeys removeObjectForKey:myID];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
+
+ [faunus addAttrs:myKeys forName:archiverID];
activeNSSessions[sessionIndex] = nil;
[ns stop];
@@ -941,6 +953,8 @@ - (void)receiveFromService:(NSNetService *)ns {
NSString *myID = [NSString stringWithFormat:@"%lu", [videoWriter hash]];
[myKeys removeObjectForKey:myID];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
+
+ [faunus addAttrs:myKeys forName:archiverID];
// if ([videoWriter finishWriting] == NO)
// NSLog(@"Video completion failed");
@@ -1018,9 +1032,64 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification {
// Register to listen for preferencepane notifications
NSDistributedNotificationCenter *center = [NSDistributedNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(prefcallbackWithNotification:) name:@"Preferences Changed" object:@"com.fxpal.displaycast.Archiver"];
-
+
+ faunus = [[Faunus alloc] init];
+
// Register our service with Bonjour.
unsigned int chosenPort = ntohs(serverAddress6.sin6_port);
+
+ archiverID = [[NSUserDefaults standardUserDefaults] stringForKey:myUniqueID];
+ if (archiverID == nil) { // First time
+ archiverID = [faunus createName:ARCHIVER publicP:YES]; // Try Faunus
+
+ // Faunus was successful
+ if (archiverID != nil) {
+ [[NSUserDefaults standardUserDefaults] setObject:archiverID forKey:myUniqueID];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ } else { // Create a temporary ID - will be replaced the next time we contact Faunus service
+ CFUUIDRef uuidObj = CFUUIDCreate(nil);
+ CFStringRef uidStr = CFUUIDCreateString(nil, uuidObj);
+ [[NSUserDefaults standardUserDefaults] setObject:(id)CFBridgingRelease(uidStr) forKey:myUniqueID];
+ CFRelease(uidStr);
+ CFRelease(uuidObj);
+
+ archiverID = [[NSUserDefaults standardUserDefaults] objectForKey:myUniqueID];
+ }
+
+ NSString *nm = NSFullUserName();
+ NSString *str;
+ if (nm == nil)
+ str = @" Archiver";
+ else
+ str = [NSString stringWithFormat:@"%@'s Archiver", nm];
+ [[NSUserDefaults standardUserDefaults] setObject:str forKey:[NSString stringWithFormat:@"%@-Name", myUniqueID]];
+ } else {
+ // Now see if faunus knows about this name. If not, it was created locally and so try to create a faunus name
+ BOOL known = NO;
+ NSMutableArray *names = [faunus browseLocal:ARCHIVER];
+
+ for (NSString *name in names) {
+ if ([name isEqualToString:archiverID]) {
+ known = YES;
+
+ break;
+ }
+ }
+
+ if (known == NO) {
+ archiverID = [faunus createName:ARCHIVER publicP:YES];
+
+ // Faunus was successful
+ if (archiverID != nil) {
+ [[NSUserDefaults standardUserDefaults] setObject:archiverID forKey:myUniqueID];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ }
+ // The -Name component is reused
+ }
+ }
+ assert(archiverID != nil);
+
+#ifdef OLD
NSString *archiverID = [[NSUserDefaults standardUserDefaults] stringForKey:myUniqueID];
if (archiverID == nil) { // Generate a new player ID
NSLog(@"Generating new unique ID for myself");
@@ -1038,6 +1107,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification {
str = [NSString stringWithFormat:@"%@'s Archiver", str];
[[NSUserDefaults standardUserDefaults] setObject:str forKey:[NSString stringWithFormat:@"%@-Name", myUniqueID]];
}
+#endif /* OLD */
netService = [[NSNetService alloc] initWithDomain:BONJOUR_DOMAIN type:ARCHIVER name:archiverID port:chosenPort];
if (netService != nil) {
@@ -1057,7 +1127,9 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification {
myKeys = [[NSMutableDictionary alloc] initWithObjectsAndKeys:self.serviceName, @"name", systemVersion, @"osVersion", @"NOTIMPL", @"locationID", [[NSHost currentHost] localizedName], @"machineName", ver, @"version", nil];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
[netService setDelegate:self];
- [netService publishWithOptions:NSNetServiceNoAutoRename /* 0 */];
+ [netService publishWithOptions:NSNetServiceNoAutoRename];
+
+ [faunus addAttrs:myKeys forName:archiverID];
}
close(fdForListening);
}
@@ -1387,6 +1459,9 @@ - (void)windowWillClose:(NSNotification *)notification {
NSString *myID = [[[NSString alloc] initWithFormat:@"%lu", [window hash]] autorelease];
[myKeys removeObjectForKey:myID];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
+
+ [faunus addAttrs:myKeys forName:archiverID];
+
break;
}
}
View
1  OSX/Faunus/Faunus.h
@@ -17,6 +17,7 @@
- (NSMutableArray *)listChildren:(NSString *)nm;
- (BOOL) delChild:(NSString *)child forName:(NSString *)nm;
+- (BOOL) addAttrs:(NSMutableDictionary *)keys forName:(NSString *)nm; // Utility function that interates over the dictionary and adds all key:values using addAttr:
- (BOOL) addAttr:(NSString *)key andValue:(NSString *)value forName:(NSString *)nm;
- (NSString *) getAttr:(NSString *)key forName:(NSString *)nm;
- (BOOL) delAttr:(NSString *)key forName:(NSString *)nm;
View
13 OSX/Faunus/Faunus.m
@@ -238,6 +238,19 @@ - (BOOL) delChild:(NSString *)child forName:(NSString *)nm {
return NO;
}
+- (BOOL) addAttrs:(NSMutableDictionary *)keys forName:(NSString *)nm {
+ __block BOOL retValue = YES;
+
+ // Return failure if adding any key fails
+ [keys enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
+ if ([self addAttr:key andValue:obj forName:nm] == NO)
+ retValue = NO;
+ }];
+
+ return retValue;
+}
+
+
- (BOOL) addAttr:(NSString *)key andValue:(NSString *)value forName:(NSString *)nm {
NSMutableArray *capabilities = [self listCapabilities:nm];
View
1  OSX/Faunusd/NameServer.h
@@ -11,6 +11,7 @@
#include <hiredis/hiredis.h>
#include "faunusGlobals.h"
+#include "faunusGlobals.h"
// By default, expire keys in 7 days - unless a child or attribute is added before this duration is up
#define REDIS_EXPIRE (3600*24*7)
View
2  OSX/Faunusd/NameServer.m
@@ -600,7 +600,7 @@ - (NSDictionary *)makeCapabilityWithCapability:(NSString *)name withKey:(NSStrin
[rc setCapabilityToken:[rc createRandomNumber]];
// Autoreleasing parent causes a segfault in release()!!
- redisCapability *parent = [[redisCapability alloc] initWithString:capability];
+ redisCapability *parent = [[[redisCapability alloc] initWithString:capability] autorelease];
NSNumber *p = [[NSNumber alloc] initWithUnsignedLongLong:[[parent capabilityToken] unsignedLongLongValue]];
[rc setParentToken:p];
[p release];
View
1  OSX/Faunusd/WhiteBoard.m
@@ -9,7 +9,6 @@ @implementation WhiteBoard
HTTPServer *server;
NameServer *nm;
-
- (id) initWithNameServer: (NameServer *) nserver {
self = [super init];
View
3  OSX/Faunusd/main.m
@@ -49,8 +49,9 @@ int main(int argc, char * const argv[]) {
[whiteboardServer start];
[[NSRunLoop currentRunLoop] run];
-
+
[nameServer release];
+ [whiteboardServer release];
}
return 0;
}
View
3  OSX/OSX.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/All.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0440"
+ LastUpgradeVersion = "0450"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -47,6 +47,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
View
3  OSX/OSX.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Archiver.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0440"
+ LastUpgradeVersion = "0450"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -47,6 +47,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
View
3  OSX/OSX.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Player.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0440"
+ LastUpgradeVersion = "0450"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -47,6 +47,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "YES"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
View
3  OSX/OSX.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Preferences.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0440"
+ LastUpgradeVersion = "0450"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -38,6 +38,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
View
3  OSX/OSX.xcodeproj/xcuserdata/chandra.xcuserdatad/xcschemes/Streamer.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0440"
+ LastUpgradeVersion = "0450"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -47,6 +47,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
View
7 OSX/Player/PlayerAppDelegate.h
@@ -4,6 +4,9 @@
#import <Cocoa/Cocoa.h>
+#import <Faunus/Faunus.h>
+#import <Faunus/Wallet.h>
+
#import "PlayerListing.h"
#import "MenuEntry.h"
#import "Globals.h"
@@ -25,7 +28,7 @@
NSOperationQueue * _queue;
- NSString * myUniqueID;
+ NSString *myUniqueID;
NSStatusItem *trayItem;
@@ -65,4 +68,6 @@
@property (nonatomic, retain, readonly ) NSArray * sortDescriptors;
@property (nonatomic, copy, readonly ) NSString * serviceName;
+@property (nonatomic, retain) Faunus *faunus;
+
@end
View
82 OSX/Player/PlayerAppDelegate.m
@@ -33,6 +33,8 @@ @interface PlayerAppDelegate () <NSNetServiceBrowserDelegate, NSNetServiceDelega
@property (nonatomic, copy, readwrite) NSString * serviceName;
@property (nonatomic, copy, readonly ) NSString * defaultServiceName;
+@property (nonatomic, retain) NSString * playerID;
+
// forward declarations
- (void)receiveFromService:(NSNetService *)service;
@@ -51,6 +53,8 @@ @implementation PlayerAppDelegate
@synthesize servicesArray = _servicesArray;
@synthesize browser = _browser;
+@synthesize playerID;
+
// Generating the Windows from the XIB file.
@synthesize rw0;
@synthesize rw1;
@@ -63,6 +67,8 @@ @implementation PlayerAppDelegate
@synthesize rw8;
@synthesize rw9;
+@synthesize faunus;
+
SInt32 OSversion = 0; // Special processing for 10.7+
NSNetService *netService; // Register ourselves
@@ -452,7 +458,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification {
// Register to listen for preferencepane notifications
NSDistributedNotificationCenter *center = [NSDistributedNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(prefcallbackWithNotification:) name:@"Preferences Changed" object:@"com.fxpal.displaycast.Player"];
-
+
#ifdef PLAYER_USE_XIB
// Ugly initialization and making sure that all synthesized windows are minimized!!
windows[0] = rw0;
@@ -485,7 +491,9 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification {
[win orderOut:self];
}
#endif /* PLAYER_USE_XIB */
-
+
+ faunus = [[Faunus alloc] init];
+
// Start the Bonjour browser.
self.browser = [[NSNetServiceBrowser alloc] init];
[self.browser setDelegate:self];
@@ -494,7 +502,58 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification {
// Register our service with Bonjour.
in_port_t chosenPort = [self createServerSocketWithAcceptCallBack:ListeningSocketCallback];
- NSString *playerID = [[NSUserDefaults standardUserDefaults] stringForKey:myUniqueID];
+ playerID = [[NSUserDefaults standardUserDefaults] stringForKey:myUniqueID];
+ if (playerID == nil) { // First time
+ playerID = [faunus createName:PLAYER publicP:YES]; // Try Faunus
+
+ // Faunus was successful
+ if (playerID != nil) {
+ [[NSUserDefaults standardUserDefaults] setObject:playerID forKey:myUniqueID];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ } else { // Create a temporary ID - will be replaced the next time we contact Faunus service
+ CFUUIDRef uuidObj = CFUUIDCreate(nil);
+ CFStringRef uidStr = CFUUIDCreateString(nil, uuidObj);
+ [[NSUserDefaults standardUserDefaults] setObject:(id)uidStr forKey:myUniqueID];
+ CFRelease(uidStr);
+ CFRelease(uuidObj);
+
+ playerID = [[NSUserDefaults standardUserDefaults] objectForKey:myUniqueID];
+ }
+
+ NSString *nm = NSFullUserName();
+ NSString *str;
+ if (nm == nil)
+ str = @" Player";
+ else
+ str = [NSString stringWithFormat:@"%@'s Player", nm];
+ [[NSUserDefaults standardUserDefaults] setObject:str forKey:[NSString stringWithFormat:@"%@-Name", myUniqueID]];
+ } else {
+ // Now see if faunus knows about this name. If not, it was created locally and so try to create a faunus name
+ BOOL known = NO;
+ NSMutableArray *names = [faunus browseLocal:PLAYER];
+
+ for (NSString *name in names) {
+ if ([name isEqualToString:playerID]) {
+ known = YES;
+
+ break;
+ }
+ }
+
+ if (known == NO) {
+ playerID = [faunus createName:PLAYER publicP:YES];
+
+ // Faunus was successful
+ if (playerID != nil) {
+ [[NSUserDefaults standardUserDefaults] setObject:playerID forKey:myUniqueID];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ }
+ // The -Name component is reused
+ }
+ }
+ assert(playerID != nil);
+
+#ifdef OLD
if (playerID == nil) { // Generate a new player ID
NSLog(@"Generating new unique ID for myself");
@@ -511,7 +570,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification {
str = [NSString stringWithFormat:@"%@'s Player", nm];
[[NSUserDefaults standardUserDefaults] setObject:str forKey:[NSString stringWithFormat:@"%@-Name", myUniqueID]];
}
-
+#endif /* OLD */
+
// Register ourselves in Bonjour
netService = [[NSNetService alloc] initWithDomain:BONJOUR_DOMAIN type:PLAYER name:playerID port:chosenPort];
if (netService != nil) {
@@ -536,7 +596,9 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification {
myKeys = [[NSMutableDictionary alloc] initWithObjectsAndKeys:self.serviceName, @"name", [ NSString stringWithFormat:@"0x0x%.0fx%.0f", screenBounds.size.width, screenBounds.size.height], @"screen0", systemVersion, @"osVersion", @"NOTIMPL", @"locationID", [[NSHost currentHost] localizedName], @"machineName", ver, @"version", NSUserName(), @"userid", bluetoothID, @"bluetooth", nil];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
[netService setDelegate:self];
- [netService publishWithOptions:NSNetServiceNoAutoRename /* 0 */];
+ [netService publishWithOptions:NSNetServiceNoAutoRename];
+
+ [faunus addAttrs:myKeys forName:playerID];
#ifdef USE_BLUETOOTH
// This code used to work synchronously and then it was deprecated in 10.6 and now it just hangs when I compile in Lion+. Apple developer forum has no answer on why this fails!!
@@ -563,6 +625,8 @@ - (void) getBluetoothDeviceAddress {
[myKeys setValue:bta forKey:@"bluetooth"];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
+
+ [faunus addAttrs:myKeys forName:playerID];
}
#endif /* USE_BLUETOOTH */
@@ -1028,7 +1092,7 @@ - (void)updateKey:(NSWindow *)window andNSNetService: (NSNetService *)ns{
// NSRect geom = [window frame];
// NSLog(@"Window state changed");
- NSString *playerID = [[NSUserDefaults standardUserDefaults] stringForKey:myUniqueID];
+ playerID = [[NSUserDefaults standardUserDefaults] stringForKey:myUniqueID];
NSString *session = [[[NSString alloc] initWithFormat:@"%@ %@ %.0f %.0f %.0f %.0f %d %d", [ns name], playerID, geom.origin.x, geom.origin.y, geom.size.width, geom.size.height, ([window isMiniaturized] ? 1:0), ([window isZoomed] ? 1:0)] autorelease];
NSString *myObjID = [[[NSString alloc] initWithFormat:@"%lu", [window hash]] autorelease];
@@ -1036,6 +1100,8 @@ - (void)updateKey:(NSWindow *)window andNSNetService: (NSNetService *)ns{
[myKeys setValue:session forKey:myObjID];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
+
+ [faunus addAttrs:myKeys forName:playerID];
}
#pragma mark -
@@ -1238,6 +1304,8 @@ - (void)receiveFromService:(NSNetService *)ns {
[window setIsZoomed:YES];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
+
+ [faunus addAttrs:myKeys forName:playerID];
[self updateKey:window andNSNetService:ns];
@@ -1421,6 +1489,8 @@ - (void)windowWillClose:(NSNotification *)notification {
NSString *myID = [[[NSString alloc] initWithFormat:@"%lu", [window hash]] autorelease];
[myKeys removeObjectForKey:myID];
[netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
+
+ [faunus addAttrs:myKeys forName:playerID];
}
break;
}
View
4 OSX/Streamer/Streamer.h
@@ -5,6 +5,9 @@
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
+#import <Faunus/Faunus.h>
+#import <Faunus/Wallet.h>
+
#import "Globals.h"
#import "HTTPServer.h"
#import "GetUniqueID.h"
@@ -25,6 +28,7 @@
}
@property (nonatomic, retain, readwrite) NSString *streamerID;
+@property (nonatomic, retain) Faunus *faunus;
#ifdef USE_BLUETOOTH
- (void) nearbyDevices:(NSString *)names;
View
86 OSX/Streamer/Streamer.m
@@ -28,6 +28,7 @@ @interface Streamer () <NSNetServiceDelegate>
@implementation Streamer
@synthesize streamerID = _streamerID;
+@synthesize faunus;
NSMutableDictionary *myKeys = nil; // To be broadcast via Bonjour
@@ -311,7 +312,8 @@ - (id)init {
self = [super init];
if (self) {
- in_port_t myPort, maskPort;
+ faunus = [[Faunus alloc] init]; // Create a faunus service instance
+
width = CGDisplayPixelsWide(CGMainDisplayID());
height = CGDisplayPixelsHigh(CGMainDisplayID());
@@ -319,8 +321,8 @@ - (id)init {
maskRect = CGRectMake(0.0, 0.0, width, height);
maskValid = false;
- maskPort = [self createServerSocketWithAcceptCallBack:maskListeningSocketCallback];
- myPort = [self createServerSocketWithAcceptCallBack:streamListeningSocketCallback];
+ in_port_t maskPort = [self createServerSocketWithAcceptCallBack:maskListeningSocketCallback];
+ in_port_t myPort = [self createServerSocketWithAcceptCallBack:streamListeningSocketCallback];
// HTTP server to respond to SNAPSHOT requests
HTTPServer *server = [[HTTPServer alloc] init];
@@ -341,35 +343,63 @@ - (id)init {
myUniqueID = [[NSString stringWithFormat:@"streamer-%@", [uniqid GetHWAddress]] retain];
[uniqid release];
}
-
- self.streamerID = [[NSUserDefaults standardUserDefaults] objectForKey:myUniqueID];
- if (self.streamerID == nil) {
- CFUUIDRef uuidObj = CFUUIDCreate(nil);
- CFStringRef uidStr = CFUUIDCreateString(nil, uuidObj);
- [[NSUserDefaults standardUserDefaults] setObject:(id)uidStr forKey:myUniqueID];
- CFRelease(uidStr);
- CFRelease(uuidObj);
-
- self.streamerID = [[NSUserDefaults standardUserDefaults] objectForKey:myUniqueID];
- assert(self.streamerID != nil);
- NSLog(@"Generating unique ID for Player");
-
+ self.streamerID = [[NSUserDefaults standardUserDefaults] objectForKey:myUniqueID];
+
+ if (self.streamerID == nil) { // First time
+ self.streamerID = [faunus createName:STREAMER publicP:YES]; // Try Faunus
+
+ // Faunus was successful
+ if (self.streamerID != nil) {
+ [[NSUserDefaults standardUserDefaults] setObject:self.streamerID forKey:myUniqueID];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ } else { // Create a temporary ID - will be replaced the next time we contact Faunus service
+ CFUUIDRef uuidObj = CFUUIDCreate(nil);
+ CFStringRef uidStr = CFUUIDCreateString(nil, uuidObj);
+ [[NSUserDefaults standardUserDefaults] setObject:(id)uidStr forKey:myUniqueID];
+ CFRelease(uidStr);
+ CFRelease(uuidObj);
+
+ self.streamerID = [[NSUserDefaults standardUserDefaults] objectForKey:myUniqueID];
+ }
+
NSString *nm = NSFullUserName();
NSString *str;
if (nm == nil)
str = @" Streamer";
- else
+ else
str = [NSString stringWithFormat:@"%@'s Streamer", nm];
[[NSUserDefaults standardUserDefaults] setObject:str forKey:[NSString stringWithFormat:@"%@-Name", myUniqueID]];
- }
-
+ } else {
+ // Now see if faunus knows about this name. If not, it was created locally and so try to create a faunus name
+ BOOL known = NO;
+ NSMutableArray *names = [faunus browseLocal:STREAMER];
+
+ for (NSString *name in names) {
+ if ([name isEqualToString:self.streamerID]) {
+ known = YES;
+
+ break;
+ }
+ }
+
+ if (known == NO) {
+ self.streamerID = [faunus createName:STREAMER publicP:YES];
+
+ // Faunus was successful
+ if (self.streamerID != nil) {
+ [[NSUserDefaults standardUserDefaults] setObject:self.streamerID forKey:myUniqueID];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ }
+ // The -Name component is reused
+ }
+ }
+ assert(self.streamerID != nil);
+
// NSString *myAddr = [[[NSString alloc] initWithCString:ma encoding:NSASCIIStringEncoding] autorelease];
// NSLog(@"Address: %@:%d. MaxPacketSize: %d Name: %@\n", myAddr, myPort, maxPacketSize, self.serviceName);
self.netService = [[[NSNetService alloc] initWithDomain:BONJOUR_DOMAIN type:STREAMER name:self.streamerID port:myPort] autorelease];
if (self.netService != nil) {
- NSString *ver = [[[NSString alloc] initWithFormat:@"%f", VERSION] autorelease];
-
// Deprecated in 10.8
// SInt32 major, minor, bugfix;
// Gestalt(gestaltSystemVersionMajor, &major);
@@ -377,9 +407,8 @@ - (id)init {
// Gestalt(gestaltSystemVersionBugFix, &bugfix);
// NSString *systemVersion = [NSString stringWithFormat:@"OSX %d.%d.%d", major, minor, bugfix];
NSString *systemVersion = [NSString stringWithFormat:@"OSX %@", [[NSProcessInfo processInfo] operatingSystemVersionString]];
-
NSString *screenDimension = [NSString stringWithFormat:@"0x0 %.0zux%.0zu", width, height];
-
+ NSString *ver = [[[NSString alloc] initWithFormat:@"%f", VERSION] autorelease];
NSString *bluetoothID = @"NotSupported";
myKeys = [[NSMutableDictionary dictionaryWithObjectsAndKeys:self.serviceName, @"name", ver, @"version", [[NSHost currentHost] localizedName], @"machineName", systemVersion, @"osVersion", @"NOTIMPL", @"locationID", [NSString stringWithFormat:@"%u", maskPort], @"maskPort", screenDimension, @"screen", NSUserName(), @"userid", bluetoothID, @"bluetooth", @"UNKNOWN", @"nearby", nil] retain];
@@ -391,10 +420,13 @@ - (id)init {
GetPrimaryIp(ma, 64);
[myKeys setValue:[NSString stringWithCString:ma encoding:NSASCIIStringEncoding] forKey:@"externalIP"];
#endif /* STREAMER_ADVERTISE_EXTERNAL_IP */
-
+
[self.netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
[self.netService setDelegate:self];
[self.netService publishWithOptions:NSNetServiceNoAutoRename];
+
+ if ([faunus addAttrs:myKeys forName:self.streamerID] == NO)
+ NSLog(@"FATAL: Faunus registration of attributes failed");
#ifdef USE_BLUETOOTH
// This code used to work synchronously and then it was deprecated in 10.6 and now it just hangs when I compile in Lion+. Apple developer forum has no answer on why this fails!!
@@ -421,6 +453,8 @@ - (void) getBluetoothDeviceAddress {
[myKeys setValue:bta forKey:@"bluetooth"];
[self.netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
+
+ [faunus addAttrs:myKeys forName:self.streamerID];
}
#endif /* USE_BLUETOOTH */
@@ -435,6 +469,8 @@ - (void) nearbyDevices:(NSString *)names {
[self.netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
[self.netService publishWithOptions:NSNetServiceNoAutoRename];
+
+ [faunus addAttrs:myKeys forName:self.streamerID];
}
}
#endif /* USE_BLUETOOTH */
@@ -449,6 +485,8 @@ - (void) broadcastMask:(CGRect) mask {
[self.netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:myKeys]];
[self.netService publishWithOptions:NSNetServiceNoAutoRename];
+
+ [faunus addAttrs:myKeys forName:self.streamerID];
}
// Implements the MASK HTTP server
View
2  OSX/Streamer/StreamerAppDelegate.h
@@ -15,7 +15,7 @@
#import "XMPPRoom.h"
#endif /* USE_XMPP */
-@interface StreamerAppDelegate : NSObject <NSApplicationDelegate, NSNetServiceDelegate, NSNetServiceBrowserDelegate> {
+@interface StreamerAppDelegate : NSObject <NSApplicationDelegate, NSNetServiceDelegate, NSNetServiceBrowserDelegate, NSMenuDelegate> {
IBOutlet NSMenu *statusMenu;
NSTextField *name;
View
62 OSX/Streamer/StreamerAppDelegate.m
@@ -23,7 +23,7 @@
#endif /* USE_XMPP */
@implementation StreamerAppDelegate
-NSMenu *projectMenu, *archiveMenu;
+ // NSMenu *projectMenu, *archiveMenu;
Streamer *stm = nil;
@synthesize projectMenu;
@@ -45,7 +45,6 @@ @implementation StreamerAppDelegate
- sendMessage:(id)sender;
#endif /* USE_XMPP */
-
- (IBAction)aboutAction:(id)sender {
[NSApp activateIgnoringOtherApps:YES];
@@ -68,13 +67,49 @@ - (IBAction)commitPreferences:(id)sender {
}
#pragma mark -
+#pragma mark *Menu delegates to request faunus updates while attempting to open the menu
+- (void) projectFaunusAction:(id)sender {
+ NSMenuItem *player = sender;
+ NSString *fullName = [[stm faunus] getAttr:@"name" forName:[player representedObject]];
+
+ NSRunAlertPanel(@"Not yet implemented", @"Should project to player: %@ (%@)", nil, nil, nil, fullName, [player representedObject]);
+}
+
+- (void)menuNeedsUpdate:(NSMenu *)menu {
+ NSMutableArray *others;
+
+ if ([menu isEqual:projectMenu])
+ others = [[stm faunus] browseLocal:PLAYER];
+ else
+ others = [[stm faunus] browseLocal:ARCHIVER];
+
+ NSLog(@"Found: %ld entries", [others count]);
+
+ for (NSString *other in others) {
+ NSString *fullName = [[stm faunus] getAttr:@"name" forName:other];
+
+ if (fullName == nil)
+ continue;
+
+ if ([menu itemWithTitle:fullName] == nil) {
+ NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSColor redColor], NSForegroundColorAttributeName, [NSFont systemFontOfSize: [NSFont systemFontSize]], NSFontAttributeName, nil];
+ NSAttributedString *as = [[[NSAttributedString alloc] initWithString:fullName attributes:attributes] autorelease];
+
+ NSMenuItem *item = [[[NSMenuItem alloc] initWithTitle:fullName action:@selector(projectFaunusAction:) keyEquivalent:@""] autorelease];
+ [item setAttributedTitle:as];
+ [item setToolTip:nil];
+ [item setRepresentedObject:other];
+
+ [menu addItem:item];
+ }
+ }
+}
+
+#pragma mark -
#pragma mark *Manipulate menuentries for each player/archiver
// Adds a new menu item for this service.
- (void) addEntry:(NSNetService *)ns andArray:(NSMutableArray *)array andMenu:(NSMenu*) menu {
- unsigned long count = [array count];
- for (unsigned int i=0; i < count; i++) {
- MenuEntry *object = [array objectAtIndex:i];
-
+ for (MenuEntry *object in array) {
if ([[ns name] isEqualToString:[object name]]) {
[object updateNS:ns];
@@ -83,7 +118,7 @@ - (void) addEntry:(NSNetService *)ns andArray:(NSMutableArray *)array andMenu:(N
}
NSDictionary *myKeys = [NSNetService dictionaryFromTXTRecordData:[ns TXTRecordData]];
- NSString *fullName = [[[NSString alloc] initWithData:[myKeys objectForKey:@"name"] encoding:NSUTF8StringEncoding] autorelease];
+ NSString *fullName = [[[NSString alloc] initWithData:[myKeys objectForKey:@"name"] encoding:NSUTF8StringEncoding] autorelease];
NSMenuItem *item = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:fullName action:@selector(projectAction:) keyEquivalent:@""] autorelease];
// Use MenuEntry to keep track of the NSNetService. On user click, we need the NSNetService to know where the Player is
@@ -162,7 +197,6 @@ - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didRemoveSer
}
- (void) awakeFromNib {
- NSLog(@"Awake from NIB");
/*
statusMenu = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
@@ -496,12 +530,11 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
#if MANUAL
// Using the xib file is always better
- NSZone *zone = [NSMenu menuZone];
- NSMenu *menu = [[[NSMenu allocWithZone:zone] init] autorelease];
+ projectMenu = [[[NSMenu alloc] init] autorelease];
+ archiveMenu = [[[NSMenu alloc] init] autorelease];
+
NSMenuItem *item;
-
- projectMenu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease];
-
+
item = [menu addItemWithTitle:@"ProjectMe" action:@selector(projectAction:) keyEquivalent:@""];
[item setTarget:self];
item = [menu addItemWithTitle:@"ArchiveMe" action:@selector(archiveAction:) keyEquivalent:@""];
@@ -522,6 +555,9 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[item setTarget:self];
#endif /* MANUAL */
+ [projectMenu setDelegate:self];
+ [archiveMenu setDelegate:self];
+
// Start the Bonjour browser.
_playerBrowser = [[NSNetServiceBrowser alloc] init];
[_playerBrowser setDelegate:self];
View
3  iOS/iOS.xcodeproj/xcshareddata/xcschemes/Player.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0440"
+ LastUpgradeVersion = "0450"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -47,6 +47,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
Please sign in to comment.
Something went wrong with that request. Please try again.