Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit of code and submodules

  • Loading branch information...
commit f214c29fa2e4b50f9bcea218941cbbdaaf6f2168 1 parent 99642de
@Jman012 authored
Showing with 23,726 additions and 1 deletion.
  1. +1 −0  .gitignore
  2. +6 −0 .gitmodules
  3. BIN  Image PSDs/status-gray.psd
  4. BIN  Image PSDs/status-green.psd
  5. BIN  Image PSDs/status-orange.psd
  6. BIN  Image PSDs/status-red.psd
  7. BIN  Image PSDs/status-yellow.psd
  8. +1 −1  LICENSE
  9. +1 −0  MessagesTableViewController
  10. +1 −0  ProjectTox-Core
  11. +2,185 −0 Toxicity.xcodeproj/project.pbxproj
  12. +7 −0 Toxicity.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  13. BIN  Toxicity.xcodeproj/project.xcworkspace/xcuserdata/jman012guy.xcuserdatad/UserInterfaceState.xcuserstate
  14. +10 −0 Toxicity.xcodeproj/project.xcworkspace/xcuserdata/jman012guy.xcuserdatad/WorkspaceSettings.xcsettings
  15. +5 −0 Toxicity.xcodeproj/xcuserdata/jman012guy.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  16. +86 −0 Toxicity.xcodeproj/xcuserdata/jman012guy.xcuserdatad/xcschemes/Toxicity.xcscheme
  17. +22 −0 Toxicity.xcodeproj/xcuserdata/jman012guy.xcuserdatad/xcschemes/xcschememanagement.plist
  18. +34 −0 Toxicity/AppDelegate.h
  19. +588 −0 Toxicity/AppDelegate.m
  20. BIN  Toxicity/Default-568h@2x.png
  21. BIN  Toxicity/Default.png
  22. BIN  Toxicity/Default@2x.png
  23. +25 −0 Toxicity/Friends/ChatWindowViewController.h
  24. +212 −0 Toxicity/Friends/ChatWindowViewController.m
  25. +26 −0 Toxicity/Friends/FriendsListTableViewController.h
  26. +350 −0 Toxicity/Friends/FriendsListTableViewController.m
  27. +13 −0 Toxicity/Friends/TransparentToolbar.h
  28. +46 −0 Toxicity/Friends/TransparentToolbar.m
  29. BIN  Toxicity/Images/default-avatar.png
  30. BIN  Toxicity/Images/message-not-sent.png
  31. BIN  Toxicity/Images/message-not-sent@2x.png
  32. BIN  Toxicity/Images/status-gray.png
  33. BIN  Toxicity/Images/status-gray@2x.png
  34. BIN  Toxicity/Images/status-green.png
  35. BIN  Toxicity/Images/status-green@2x.png
  36. BIN  Toxicity/Images/status-orange.png
  37. BIN  Toxicity/Images/status-orange@2x.png
  38. BIN  Toxicity/Images/status-red.png
  39. BIN  Toxicity/Images/status-red@2x.png
  40. BIN  Toxicity/Images/status-yellow.png
  41. BIN  Toxicity/Images/status-yellow@2x.png
  42. +29 −0 Toxicity/Objects/DHTNodeObject.h
  43. +55 −0 Toxicity/Objects/DHTNodeObject.m
  44. +38 −0 Toxicity/Objects/FriendObject.h
  45. +27 −0 Toxicity/Objects/FriendObject.m
  46. +25 −0 Toxicity/Objects/MessageObject.h
  47. +13 −0 Toxicity/Objects/MessageObject.m
  48. +48 −0 Toxicity/Settings/NewDHTNodeViewController.h
  49. +216 −0 Toxicity/Settings/NewDHTNodeViewController.m
  50. +28 −0 Toxicity/Settings/SettingsViewController.h
  51. +592 −0 Toxicity/Settings/SettingsViewController.m
  52. +62 −0 Toxicity/Singleton/Singleton.h
  53. +63 −0 Toxicity/Singleton/Singleton.m
  54. +38 −0 Toxicity/Toxicity-Info.plist
  55. +14 −0 Toxicity/Toxicity-Prefix.pch
  56. +31 −0 Toxicity/ViewController.h
  57. +79 −0 Toxicity/ViewController.m
  58. +618 −0 Toxicity/en.lproj/FriendListCell.xib
  59. +2 −0  Toxicity/en.lproj/InfoPlist.strings
  60. +332 −0 Toxicity/en.lproj/MainStoryboard.storyboard
  61. +18 −0 Toxicity/main.m
  62. +34 −0 libsodium/crypto_auth/crypto_auth.c
  63. +16 −0 libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c
  64. +10 −0 libsodium/crypto_auth/hmacsha256/ref/api.h
  65. +83 −0 libsodium/crypto_auth/hmacsha256/ref/hmac_hmacsha256.c
  66. +9 −0 libsodium/crypto_auth/hmacsha256/ref/verify_hmacsha256.c
  67. +16 −0 libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c
  68. +10 −0 libsodium/crypto_auth/hmacsha512256/ref/api.h
  69. +86 −0 libsodium/crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c
  70. +9 −0 libsodium/crypto_auth/hmacsha512256/ref/verify_hmacsha512256.c
  71. +95 −0 libsodium/crypto_box/crypto_box.c
  72. +41 −0 libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c
  73. +22 −0 libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c
  74. +19 −0 libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h
  75. +19 −0 libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c
  76. +27 −0 libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c
  77. +12 −0 libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c
  78. +26 −0 libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c
  79. +11 −0 libsodium/crypto_core/hsalsa20/ref2/api.h
  80. +108 −0 libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c
  81. +26 −0 libsodium/crypto_core/salsa20/core_salsa20_api.c
  82. +11 −0 libsodium/crypto_core/salsa20/ref/api.h
  83. +134 −0 libsodium/crypto_core/salsa20/ref/core_salsa20.c
  84. +26 −0 libsodium/crypto_core/salsa2012/core_salsa2012_api.c
  85. +11 −0 libsodium/crypto_core/salsa2012/ref/api.h
  86. +134 −0 libsodium/crypto_core/salsa2012/ref/core_salsa2012.c
  87. +26 −0 libsodium/crypto_core/salsa208/core_salsa208_api.c
  88. +11 −0 libsodium/crypto_core/salsa208/ref/api.h
  89. +134 −0 libsodium/crypto_core/salsa208/ref/core_salsa208.c
  90. +31 −0 libsodium/crypto_generichash/blake2/generichash_blake2_api.c
  91. +4 −0 libsodium/crypto_generichash/blake2/ref/api.h
  92. +132 −0 libsodium/crypto_generichash/blake2/ref/blake2-impl.h
  93. +169 −0 libsodium/crypto_generichash/blake2/ref/blake2.h
  94. +359 −0 libsodium/crypto_generichash/blake2/ref/blake2b-ref.c
  95. +61 −0 libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c
  96. +84 −0 libsodium/crypto_generichash/crypto_generichash.c
  97. +9 −0 libsodium/crypto_hash/crypto_hash.c
  98. +11 −0 libsodium/crypto_hash/sha256/hash_sha256_api.c
  99. +8 −0 libsodium/crypto_hash/sha256/ref/api.h
  100. +69 −0 libsodium/crypto_hash/sha256/ref/hash_sha256.c
  101. +11 −0 libsodium/crypto_hash/sha512/hash_sha512_api.c
  102. +8 −0 libsodium/crypto_hash/sha512/ref/api.h
  103. +71 −0 libsodium/crypto_hash/sha512/ref/hash_sha512.c
  104. +16 −0 libsodium/crypto_hashblocks/sha256/hashblocks_sha256_api.c
  105. +9 −0 libsodium/crypto_hashblocks/sha256/ref/api.h
  106. +212 −0 libsodium/crypto_hashblocks/sha256/ref/blocks_sha256.c
  107. +16 −0 libsodium/crypto_hashblocks/sha512/hashblocks_sha512_api.c
  108. +9 −0 libsodium/crypto_hashblocks/sha512/ref/api.h
  109. +239 −0 libsodium/crypto_hashblocks/sha512/ref/blocks_sha512.c
  110. +34 −0 libsodium/crypto_onetimeauth/crypto_onetimeauth.c
  111. +8 −0 libsodium/crypto_onetimeauth/poly1305/53/api.h
  112. +1,657 −0 libsodium/crypto_onetimeauth/poly1305/53/auth_poly1305_53.c
  113. +10 −0 libsodium/crypto_onetimeauth/poly1305/53/verify_poly1305_53.c
  114. +42 −0 libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c
  115. +16 −0 libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c
  116. +147 −0 libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c
  117. +8 −0 libsodium/crypto_onetimeauth/poly1305/ref/api.h
  118. +119 −0 libsodium/crypto_onetimeauth/poly1305/ref/auth_poly1305_ref.c
  119. +10 −0 libsodium/crypto_onetimeauth/poly1305/ref/verify_poly1305_ref.c
  120. +34 −0 libsodium/crypto_scalarmult/crypto_scalarmult.c
  121. +9 −0 libsodium/crypto_scalarmult/curve25519/donna_c64/api.h
  122. +13 −0 libsodium/crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c
  123. +426 −0 libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c
  124. +8 −0 libsodium/crypto_scalarmult/curve25519/ref/api.h
  125. +20 −0 libsodium/crypto_scalarmult/curve25519/ref/base_curve25519_ref.c
  126. +268 −0 libsodium/crypto_scalarmult/curve25519/ref/smult_curve25519_ref.c
  127. +48 −0 libsodium/crypto_secretbox/crypto_secretbox.c
  128. +12 −0 libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h
  129. +35 −0 libsodium/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c
  130. +26 −0 libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c
  131. +27 −0 libsodium/crypto_shorthash/crypto_shorthash.c
  132. +8 −0 libsodium/crypto_shorthash/siphash24/ref/api.h
  133. +91 −0 libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c
  134. +11 −0 libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c
  135. +55 −0 libsodium/crypto_sign/crypto_sign.c
  136. +13 −0 libsodium/crypto_sign/ed25519/ref10/api.h
  137. +1,344 −0 libsodium/crypto_sign/ed25519/ref10/base.h
  138. +40 −0 libsodium/crypto_sign/ed25519/ref10/base2.h
  139. +1 −0  libsodium/crypto_sign/ed25519/ref10/d.h
  140. +1 −0  libsodium/crypto_sign/ed25519/ref10/d2.h
  141. +56 −0 libsodium/crypto_sign/ed25519/ref10/fe.h
  142. +19 −0 libsodium/crypto_sign/ed25519/ref10/fe_0.c
  143. +19 −0 libsodium/crypto_sign/ed25519/ref10/fe_1.c
  144. +57 −0 libsodium/crypto_sign/ed25519/ref10/fe_add.c
  145. +63 −0 libsodium/crypto_sign/ed25519/ref10/fe_cmov.c
  146. +29 −0 libsodium/crypto_sign/ed25519/ref10/fe_copy.c
  147. +73 −0 libsodium/crypto_sign/ed25519/ref10/fe_frombytes.c
  148. +14 −0 libsodium/crypto_sign/ed25519/ref10/fe_invert.c
  149. +16 −0 libsodium/crypto_sign/ed25519/ref10/fe_isnegative.c
  150. +19 −0 libsodium/crypto_sign/ed25519/ref10/fe_isnonzero.c
  151. +253 −0 libsodium/crypto_sign/ed25519/ref10/fe_mul.c
  152. +45 −0 libsodium/crypto_sign/ed25519/ref10/fe_neg.c
  153. +13 −0 libsodium/crypto_sign/ed25519/ref10/fe_pow22523.c
  154. +149 −0 libsodium/crypto_sign/ed25519/ref10/fe_sq.c
  155. +160 −0 libsodium/crypto_sign/ed25519/ref10/fe_sq2.c
  156. +57 −0 libsodium/crypto_sign/ed25519/ref10/fe_sub.c
  157. +119 −0 libsodium/crypto_sign/ed25519/ref10/fe_tobytes.c
  158. +95 −0 libsodium/crypto_sign/ed25519/ref10/ge.h
  159. +11 −0 libsodium/crypto_sign/ed25519/ref10/ge_add.c
  160. +97 −0 libsodium/crypto_sign/ed25519/ref10/ge_add.h
  161. +96 −0 libsodium/crypto_sign/ed25519/ref10/ge_double_scalarmult.c
  162. +50 −0 libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
  163. +11 −0 libsodium/crypto_sign/ed25519/ref10/ge_madd.c
  164. +88 −0 libsodium/crypto_sign/ed25519/ref10/ge_madd.h
  165. +11 −0 libsodium/crypto_sign/ed25519/ref10/ge_msub.c
  166. +88 −0 libsodium/crypto_sign/ed25519/ref10/ge_msub.h
  167. +12 −0 libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p2.c
  168. +13 −0 libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p3.c
  169. +8 −0 libsodium/crypto_sign/ed25519/ref10/ge_p2_0.c
  170. +11 −0 libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.c
  171. +73 −0 libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.h
  172. +9 −0 libsodium/crypto_sign/ed25519/ref10/ge_p3_0.c
  173. +12 −0 libsodium/crypto_sign/ed25519/ref10/ge_p3_dbl.c
  174. +17 −0 libsodium/crypto_sign/ed25519/ref10/ge_p3_to_cached.c
  175. +12 −0 libsodium/crypto_sign/ed25519/ref10/ge_p3_to_p2.c
  176. +14 −0 libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c
  177. +8 −0 libsodium/crypto_sign/ed25519/ref10/ge_precomp_0.c
  178. +105 −0 libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c
  179. +11 −0 libsodium/crypto_sign/ed25519/ref10/ge_sub.c
  180. +97 −0 libsodium/crypto_sign/ed25519/ref10/ge_sub.h
  181. +14 −0 libsodium/crypto_sign/ed25519/ref10/ge_tobytes.c
  182. +31 −0 libsodium/crypto_sign/ed25519/ref10/keypair.c
  183. +40 −0 libsodium/crypto_sign/ed25519/ref10/open.c
  184. +160 −0 libsodium/crypto_sign/ed25519/ref10/pow22523.h
  185. +160 −0 libsodium/crypto_sign/ed25519/ref10/pow225521.h
  186. +15 −0 libsodium/crypto_sign/ed25519/ref10/sc.h
  187. +368 −0 libsodium/crypto_sign/ed25519/ref10/sc_muladd.c
  188. +275 −0 libsodium/crypto_sign/ed25519/ref10/sc_reduce.c
  189. +38 −0 libsodium/crypto_sign/ed25519/ref10/sign.c
  190. +1 −0  libsodium/crypto_sign/ed25519/ref10/sqrtm1.h
  191. +21 −0 libsodium/crypto_sign/ed25519/sign_ed25519_api.c
  192. +13 −0 libsodium/crypto_sign/edwards25519sha512batch/ref/api.h
  193. +54 −0 libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519.h
  194. +345 −0 libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c
  195. +34 −0 libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519.h
  196. +227 −0 libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c
  197. +51 −0 libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519.h
  198. +146 −0 libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c
  199. +102 −0 libsodium/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c
  200. +21 −0 libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c
  201. +158 −0 libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c
  202. +14 −0 libsodium/crypto_stream/aes128ctr/portable/api.h
  203. +59 −0 libsodium/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c
  204. +788 −0 libsodium/crypto_stream/aes128ctr/portable/common.h
  205. +64 −0 libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
  206. +28 −0 libsodium/crypto_stream/aes128ctr/portable/consts.h
  207. +14 −0 libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c
  208. +47 −0 libsodium/crypto_stream/aes128ctr/portable/int128.h
  209. +128 −0 libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c
  210. +28 −0 libsodium/crypto_stream/aes128ctr/portable/stream_aes128ctr.c
  211. +10 −0 libsodium/crypto_stream/aes128ctr/portable/types.h
  212. +180 −0 libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c
  213. +21 −0 libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c
  214. +309 −0 libsodium/crypto_stream/aes256estream/hongjun/aes-table.h
  215. +200 −0 libsodium/crypto_stream/aes256estream/hongjun/aes256-ctr.c
  216. +187 −0 libsodium/crypto_stream/aes256estream/hongjun/aes256.h
  217. +14 −0 libsodium/crypto_stream/aes256estream/hongjun/api.h
  218. +27 −0 libsodium/crypto_stream/aes256estream/hongjun/ecrypt-sync.h
  219. +21 −0 libsodium/crypto_stream/aes256estream/stream_aes256estream_api.c
  220. +36 −0 libsodium/crypto_stream/crypto_stream.c
  221. +1 −0  libsodium/crypto_stream/salsa20/amd64_xmm6/api.h
  222. +947 −0 libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.s
  223. +8 −0 libsodium/crypto_stream/salsa20/ref/api.h
  224. +55 −0 libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c
  225. +58 −0 libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c
  226. +11 −0 libsodium/crypto_stream/salsa2012/ref/api.h
  227. +51 −0 libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c
  228. +54 −0 libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c
  229. +16 −0 libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c
  230. +10 −0 libsodium/crypto_stream/salsa208/ref/api.h
  231. +51 −0 libsodium/crypto_stream/salsa208/ref/stream_salsa208.c
  232. +54 −0 libsodium/crypto_stream/salsa208/ref/xor_salsa208.c
  233. +16 −0 libsodium/crypto_stream/salsa208/stream_salsa208_api.c
  234. +11 −0 libsodium/crypto_stream/xsalsa20/ref/api.h
  235. +24 −0 libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c
  236. +25 −0 libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c
  237. +16 −0 libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c
  238. +2 −0  libsodium/crypto_verify/16/ref/api.h
  239. +24 −0 libsodium/crypto_verify/16/ref/verify_16.c
  240. +6 −0 libsodium/crypto_verify/16/verify_16_api.c
  241. +2 −0  libsodium/crypto_verify/32/ref/api.h
  242. +40 −0 libsodium/crypto_verify/32/ref/verify_32.c
  243. +6 −0 libsodium/crypto_verify/32/verify_32_api.c
  244. +48 −0 libsodium/include/sodium.h
  245. +18 −0 libsodium/include/sodium/core.h
  246. +36 −0 libsodium/include/sodium/crypto_auth.h
  247. +36 −0 libsodium/include/sodium/crypto_auth_hmacsha256.h
  248. +36 −0 libsodium/include/sodium/crypto_auth_hmacsha512256.h
  249. +83 −0 libsodium/include/sodium/crypto_box.h
  250. +72 −0 libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h
  251. +40 −0 libsodium/include/sodium/crypto_core_hsalsa20.h
  252. +40 −0 libsodium/include/sodium/crypto_core_salsa20.h
  253. +40 −0 libsodium/include/sodium/crypto_core_salsa2012.h
  254. +40 −0 libsodium/include/sodium/crypto_core_salsa208.h
  255. +70 −0 libsodium/include/sodium/crypto_generichash.h
  256. +87 −0 libsodium/include/sodium/crypto_generichash_blake2b.h
  257. +23 −0 libsodium/include/sodium/crypto_hash.h
  258. +29 −0 libsodium/include/sodium/crypto_hash_sha256.h
  259. +29 −0 libsodium/include/sodium/crypto_hash_sha512.h
  260. +32 −0 libsodium/include/sodium/crypto_hashblocks_sha256.h
  261. +32 −0 libsodium/include/sodium/crypto_hashblocks_sha512.h
  262. +8 −0 libsodium/include/sodium/crypto_int32.h
  263. +8 −0 libsodium/include/sodium/crypto_int64.h
  264. +37 −0 libsodium/include/sodium/crypto_onetimeauth.h
  265. +65 −0 libsodium/include/sodium/crypto_onetimeauth_poly1305.h
  266. +34 −0 libsodium/include/sodium/crypto_onetimeauth_poly1305_53.h
  267. +34 −0 libsodium/include/sodium/crypto_onetimeauth_poly1305_ref.h
  268. +36 −0 libsodium/include/sodium/crypto_scalarmult.h
  269. +37 −0 libsodium/include/sodium/crypto_scalarmult_curve25519.h
  270. +37 −0 libsodium/include/sodium/crypto_scalarmult_curve25519.h.in
  271. +47 −0 libsodium/include/sodium/crypto_secretbox.h
  272. +44 −0 libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h
  273. +33 −0 libsodium/include/sodium/crypto_shorthash.h
  274. +29 −0 libsodium/include/sodium/crypto_shorthash_siphash24.h
  275. +57 −0 libsodium/include/sodium/crypto_sign.h
  276. +48 −0 libsodium/include/sodium/crypto_sign_ed25519.h
  277. +44 −0 libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h
  278. +46 −0 libsodium/include/sodium/crypto_stream.h
  279. +60 −0 libsodium/include/sodium/crypto_stream_aes128ctr.h
  280. +61 −0 libsodium/include/sodium/crypto_stream_aes256estream.h
  281. +45 −0 libsodium/include/sodium/crypto_stream_salsa20.h
  282. +45 −0 libsodium/include/sodium/crypto_stream_salsa20.h.in
  283. +44 −0 libsodium/include/sodium/crypto_stream_salsa2012.h
  284. +44 −0 libsodium/include/sodium/crypto_stream_salsa208.h
  285. +44 −0 libsodium/include/sodium/crypto_stream_xsalsa20.h
  286. +8 −0 libsodium/include/sodium/crypto_uint16.h
  287. +8 −0 libsodium/include/sodium/crypto_uint32.h
  288. +8 −0 libsodium/include/sodium/crypto_uint64.h
  289. +8 −0 libsodium/include/sodium/crypto_uint8.h
  290. +25 −0 libsodium/include/sodium/crypto_verify_16.h
  291. +25 −0 libsodium/include/sodium/crypto_verify_32.h
  292. +30 −0 libsodium/include/sodium/export.h
  293. +53 −0 libsodium/include/sodium/randombytes.h
  294. +45 −0 libsodium/include/sodium/randombytes_salsa20_random.h
  295. +45 −0 libsodium/include/sodium/randombytes_sysrandom.h
  296. +36 −0 libsodium/include/sodium/utils.h
  297. +29 −0 libsodium/include/sodium/version.h
  298. +29 −0 libsodium/include/sodium/version.h.in
  299. +64 −0 libsodium/randombytes/randombytes.c
  300. +306 −0 libsodium/randombytes/salsa20/randombytes_salsa20_random.c
Sorry, we could not display the entire diff because too many files (305) changed.
View
1  .gitignore
@@ -0,0 +1 @@
+.DS_Store
View
6 .gitmodules
@@ -0,0 +1,6 @@
+[submodule "ProjectTox-Core"]
+ path = ProjectTox-Core
+ url = https://github.com/irungentoo/ProjectTox-Core.git
+[submodule "MessagesTableViewController"]
+ path = MessagesTableViewController
+ url = https://github.com/jessesquires/MessagesTableViewController.git
View
BIN  Image PSDs/status-gray.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Image PSDs/status-green.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Image PSDs/status-orange.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Image PSDs/status-red.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Image PSDs/status-yellow.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  LICENSE
@@ -176,7 +176,7 @@ recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
- Copyright [yyyy] [name of copyright owner]
+ Copyright 2013 James Linnell
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
1  MessagesTableViewController
@@ -0,0 +1 @@
+Subproject commit 4f217757d0f5ec4204a0bd0f032f3a62b540feb6
1  ProjectTox-Core
@@ -0,0 +1 @@
+Subproject commit 9e3d5d6488b402805509befbf9619d9fc589b58b
View
2,185 Toxicity.xcodeproj/project.pbxproj
2,185 additions, 0 deletions not shown
View
7 Toxicity.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:Toxicity.xcodeproj">
+ </FileRef>
+</Workspace>
View
BIN  Toxicity.xcodeproj/project.xcworkspace/xcuserdata/jman012guy.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
10 Toxicity.xcodeproj/project.xcworkspace/xcuserdata/jman012guy.xcuserdatad/WorkspaceSettings.xcsettings
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
+ <true/>
+ <key>SnapshotAutomaticallyBeforeSignificantChanges</key>
+ <true/>
+</dict>
+</plist>
View
5 Toxicity.xcodeproj/xcuserdata/jman012guy.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Bucket
+ type = "1"
+ version = "1.0">
+</Bucket>
View
86 Toxicity.xcodeproj/xcuserdata/jman012guy.xcuserdatad/xcschemes/Toxicity.xcscheme
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0460"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "B94F2C5617AF25C0003EA6E8"
+ BuildableName = "Toxicity.app"
+ BlueprintName = "Toxicity"
+ ReferencedContainer = "container:Toxicity.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "B94F2C5617AF25C0003EA6E8"
+ BuildableName = "Toxicity.app"
+ BlueprintName = "Toxicity"
+ ReferencedContainer = "container:Toxicity.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "B94F2C5617AF25C0003EA6E8"
+ BuildableName = "Toxicity.app"
+ BlueprintName = "Toxicity"
+ ReferencedContainer = "container:Toxicity.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "B94F2C5617AF25C0003EA6E8"
+ BuildableName = "Toxicity.app"
+ BlueprintName = "Toxicity"
+ ReferencedContainer = "container:Toxicity.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
View
22 Toxicity.xcodeproj/xcuserdata/jman012guy.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>SchemeUserState</key>
+ <dict>
+ <key>Toxicity.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <key>SuppressBuildableAutocreation</key>
+ <dict>
+ <key>B94F2C5617AF25C0003EA6E8</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ </dict>
+</dict>
+</plist>
View
34 Toxicity/AppDelegate.h
@@ -0,0 +1,34 @@
+//
+// AppDelegate.h
+// Toxicity
+//
+// Created by James Linnell on 8/4/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "ViewController.h"
+#import "Messenger.h"
+#import "network.h"
+#import "Singleton.h"
+
+#include <unistd.h>
+#define c_sleep(x) usleep(1000*x)
+
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate, UIAlertViewDelegate>
+{
+
+ //used for tox
+ int on;
+}
+
+@property (strong, nonatomic) UIWindow *window;
+
+- (void)connectToDHTWithIP:(NSNotification *)notification;
+- (void)userNickChanged:(NSNotification *)notification;
+- (void)userStatusChanged:(NSNotification *)notification;
+unsigned char * hex_string_to_bin(char hex_string[]);
+- (void)toxCoreLoop:(NSTimer *)timer;
+
+@end
View
588 Toxicity/AppDelegate.m
@@ -0,0 +1,588 @@
+//
+// AppDelegate.m
+// Toxicity
+//
+// Created by James Linnell on 8/4/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import "AppDelegate.h"
+
+@implementation AppDelegate
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ // Override point for customization after application launch.
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(connectToDHTWithIP:) name:@"ConnectWithOptions" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userNickChanged:) name:@"UserNickChanged" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userStatusChanged:) name:@"UserStatusMessageChanged" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userStatusTypeChanged) name:@"UserStatusTypeChanged" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addFriend:) name:@"AddFriend" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sendMessage:) name:@"SendMessage" object:nil];
+
+ //user defaults is the easy way to save info between app launches. dont have to read a file manually, etc. basically a plist
+ NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
+
+ //loads dht node list
+ if ([prefs objectForKey:@"dht_node_list"] == nil) {
+
+ } else {
+ NSMutableArray *array = [[NSMutableArray alloc] init];
+ for (NSData *data in [prefs objectForKey:@"dht_node_list"]) {
+ DHTNodeObject *tempDHT = (DHTNodeObject *)[NSKeyedUnarchiver unarchiveObjectWithData:data];
+ [array addObject:tempDHT];
+ }
+ [[Singleton sharedSingleton] setDhtNodeList:array];
+ }
+
+ //start messenger here for LAN discorvery without pesky dht. required for tox core
+ [[Singleton sharedSingleton] setToxCoreMessenger:initMessenger()];
+
+ //load public/private key. key is held in NSData bytes in the user defaults
+ if ([prefs objectForKey:@"self_key"] == nil) {
+ NSLog(@"loading new key");
+ //load a new key
+ int size = Messenger_size([[Singleton sharedSingleton] toxCoreMessenger]);
+ uint8_t *data = malloc(size);
+ Messenger_save([[Singleton sharedSingleton] toxCoreMessenger], data);
+
+ //save to userdefaults
+ NSData *theKey = [NSData dataWithBytes:data length:size];
+ [prefs setObject:theKey forKey:@"self_key"];
+ [prefs synchronize];
+
+ free(data);
+
+ } else {
+ NSLog(@"using already made key");
+ //key already made, laod it from memory
+ NSData *theKey = [prefs objectForKey:@"self_key"];
+
+ int size = Messenger_size([[Singleton sharedSingleton] toxCoreMessenger]);
+ uint8_t *data = (uint8_t *)[theKey bytes];
+
+ Messenger_load([[Singleton sharedSingleton] toxCoreMessenger], data, size);
+ }
+
+ //callbacks
+ m_callback_friendrequest([[Singleton sharedSingleton] toxCoreMessenger], print_request, NULL);
+ m_callback_friendmessage([[Singleton sharedSingleton] toxCoreMessenger], print_message, NULL);
+ m_callback_action([[Singleton sharedSingleton] toxCoreMessenger], print_action, NULL);
+ m_callback_namechange([[Singleton sharedSingleton] toxCoreMessenger], print_nickchange, NULL);
+ m_callback_statusmessage([[Singleton sharedSingleton] toxCoreMessenger], print_statuschange, NULL);
+ m_callback_connectionstatus([[Singleton sharedSingleton] toxCoreMessenger], print_connectionstatuschange, NULL);
+ m_callback_userstatus([[Singleton sharedSingleton] toxCoreMessenger], print_userstatuschange, NULL);
+
+ //load nick and statusmsg. user defaults
+ if ([prefs objectForKey:@"self_nick"] != nil) {
+ [[Singleton sharedSingleton] setUserNick:[prefs objectForKey:@"self_nick"]];
+ setname([[Singleton sharedSingleton] toxCoreMessenger], (uint8_t *)[[[Singleton sharedSingleton] userNick] UTF8String], strlen([[[Singleton sharedSingleton] userNick] UTF8String]) + 1);
+ }
+ if ([prefs objectForKey:@"self_status_message"] != nil) {
+ [[Singleton sharedSingleton] setUserStatusMessage:[prefs objectForKey:@"self_status_message"]];
+ m_set_statusmessage([[Singleton sharedSingleton] toxCoreMessenger], (uint8_t *)[[[Singleton sharedSingleton] userStatusMessage] UTF8String], strlen([[[Singleton sharedSingleton] userStatusMessage] UTF8String]) + 1);
+ }
+
+
+ //this is the main loop for the tox core. ran with an NSTimer for a different thread. runs the stuff needed to let tox work (network and stuff)
+ [NSTimer scheduledTimerWithTimeInterval:(1/100) target:self selector:@selector(toxCoreLoop:) userInfo:nil repeats:YES];
+
+// /*** temp ***/
+// char id[FRIEND_ADDRESS_SIZE * 2 + 1] = {0};
+// size_t i;
+// uint8_t ourAddress[FRIEND_ADDRESS_SIZE];
+// getaddress([[Singleton sharedSingleton] toxCoreMessenger], ourAddress);
+// for (i=0; i<FRIEND_ADDRESS_SIZE; i++) {
+// char xx[3];
+// snprintf(xx, sizeof(xx), "%02X", ourAddress[i] & 0xff);
+// strcat(id, xx);
+// }
+// NSLog(@"%s", id);
+
+ char convertedKey[(FRIEND_ADDRESS_SIZE * 2) + 1];
+ int pos = 0;
+ uint8_t ourAddress1[FRIEND_ADDRESS_SIZE];
+ getaddress([[Singleton sharedSingleton] toxCoreMessenger], ourAddress1);
+// NSLog(@"from nsdata: %@", [NSData dataWithBytes:ourAddress1 length:FRIEND_ADDRESS_SIZE]);
+ for (int i = 0; i < FRIEND_ADDRESS_SIZE; ++i, pos += 2) {
+ sprintf(&convertedKey[pos] ,"%02X", ourAddress1[i] & 0xff);
+ }
+ NSLog(@"%s", convertedKey);
+
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application
+{
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application
+{
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application
+{
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application
+{
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application
+{
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+
+
+}
+
+#pragma mark - NSNotificationCenter methods
+
+- (void)connectToDHTWithIP:(NSNotification *)notification {
+ NSLog(@"Connect to %@ %@ %@", notification.userInfo[@"dht_ip"], notification.userInfo[@"dht_port"], notification.userInfo[@"dht_key"]);
+ const char *dht_ip = [notification.userInfo[@"dht_ip"] UTF8String];
+ const char *dht_port = [notification.userInfo[@"dht_port"] UTF8String];
+ const char *dht_key = [notification.userInfo[@"dht_key"] UTF8String];
+
+
+ //used from toxic source, this tells tox core to make a connection into the dht network
+ IP_Port bootstrap_ip_port;
+ bootstrap_ip_port.port = htons(atoi(dht_port));
+ int resolved_address = resolve_addr(dht_ip);
+ if (resolved_address != 0)
+ bootstrap_ip_port.ip.i = resolved_address;
+ else
+ NSLog(@"Error resolving address!");
+
+ unsigned char *binary_string = hex_string_to_bin((char *)dht_key);
+ DHT_bootstrap(bootstrap_ip_port, binary_string); //actual connection
+ free(binary_string);
+
+
+ //add the connection info to the singleton, then a timer if the connection doesnt work
+ [[[Singleton sharedSingleton] currentConnectDHT] setDhtName:[notification userInfo][@"dht_name"]];
+ [[[Singleton sharedSingleton] currentConnectDHT] setDhtIP:[notification userInfo][@"dht_ip"]];
+ [[[Singleton sharedSingleton] currentConnectDHT] setDhtPort:[notification userInfo][@"dht_port"]];
+ [[[Singleton sharedSingleton] currentConnectDHT] setDhtKey:[notification userInfo][@"dht_key"]];
+ [[[Singleton sharedSingleton] currentConnectDHT] setConnectionStatus:ToxDHTNodeConnectionStatus_Connecting];
+
+
+ //run this in 10 seconds. if no connection is made, tell the settings controller about failed connection.
+ //settings controller will remove the uiactivityview, and this method will clear the singleton's currentConnectDHT
+ [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(connectionTimeoutTimerDidEnd) userInfo:nil repeats:NO];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"DidStartDHTNodeConnection" object:nil];
+
+}
+
+- (void)userNickChanged:(NSNotification *)notification {
+ char *newNick = (char *)[[[Singleton sharedSingleton] userNick] UTF8String];
+
+ //submit new nick to core
+ setname([[Singleton sharedSingleton] toxCoreMessenger], (uint8_t *)newNick, strlen(newNick) + 1);
+
+ //save to user defaults
+ NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
+ [prefs setObject:[[Singleton sharedSingleton] userNick] forKey:@"self_nick"];
+ [prefs synchronize];
+}
+
+- (void)userStatusChanged:(NSNotification *)notification {
+ char *newStatus = (char *)[[[Singleton sharedSingleton] userStatusMessage] UTF8String];
+
+ //submit new status to core
+ m_set_statusmessage([[Singleton sharedSingleton] toxCoreMessenger], (uint8_t *)newStatus, strlen(newStatus) + 1);
+
+ //save to user defaults
+ NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
+ [prefs setObject:[[Singleton sharedSingleton] userStatusMessage] forKey:@"self_status_message"];
+ [prefs synchronize];
+}
+
+- (void)userStatusTypeChanged {
+ USERSTATUS statusType = USERSTATUS_INVALID;
+ switch ([[Singleton sharedSingleton] userStatusType]) {
+ case ToxFriendUserStatus_None:
+ statusType = USERSTATUS_NONE;
+ break;
+
+ case ToxFriendUserStatus_Away:
+ statusType = USERSTATUS_AWAY;
+ break;
+
+ case ToxFriendUserStatus_Busy:
+ statusType = USERSTATUS_BUSY;
+ break;
+
+ default:
+ statusType = USERSTATUS_INVALID;
+ break;
+ }
+ m_set_userstatus([[Singleton sharedSingleton] toxCoreMessenger], statusType);
+}
+
+- (void)addFriend:(NSNotification *)notification {
+ //this is called from the friendslist vc, the add button
+ //sends a request to the key
+ NSString *theirKey = [notification userInfo][@"new_friend_key"];
+
+ uint8_t *binID = hex_string_to_bin((char *)[theirKey UTF8String]);
+
+ int num = m_addfriend([[Singleton sharedSingleton] toxCoreMessenger], binID, (uint8_t *)"Toxicity for iOS", strlen("Toxicity for iOS") + 1);
+ switch (num) {
+ case FAERR_TOOLONG:
+ NSLog(@"toolong");
+ break;
+
+ case FAERR_NOMESSAGE:
+ NSLog(@"nomessage");
+ break;
+
+ case FAERR_OWNKEY:
+ NSLog(@"ownkey");
+ break;
+
+ case FAERR_ALREADYSENT:
+ NSLog(@"alreadysent");
+ break;
+
+ case FAERR_UNKNOWN:
+ NSLog(@"unknownerror");
+ break;
+
+ default: //added friend successfully
+ {
+ //add friend to singleton array, for use throughout the app
+ FriendObject *tempFriend = [[FriendObject alloc] init];
+ [tempFriend setPublicKeyWithNoSpam:[notification userInfo][@"new_friend_key"]];
+ [tempFriend setPublicKey:[[notification userInfo][@"new_friend_key"] substringToIndex:(CLIENT_ID_SIZE * 2)]];
+ NSLog(@"new friend key: %@", [tempFriend publicKey]);
+ [tempFriend setStatusMessage:@"Sending request..."];
+
+ [[[Singleton sharedSingleton] mainFriendList] insertObject:tempFriend atIndex:num];
+ [[[Singleton sharedSingleton] mainFriendMessages] insertObject:[NSArray array] atIndex:num];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"FriendAdded" object:nil];
+ break;
+ }
+ }
+}
+
+- (void)sendMessage:(NSNotification *)notification {
+ //send a message to a friend, called primarily from the caht window vc
+ NSString *theirKey = [notification userInfo][@"friend_public_key"];
+ NSString *theMessage = [notification userInfo][@"message"];
+ NSUInteger friendNum = [[notification userInfo][@"friend_number"] integerValue];
+
+ NSLog(@"Sending Message: %@", theMessage);
+
+ //use the client id from the core to make sure we're sending it to the right person
+ uint8_t key[CLIENT_ID_SIZE];
+ getclient_id([[Singleton sharedSingleton] toxCoreMessenger], friendNum, key);
+
+ char convertedKey[(CLIENT_ID_SIZE * 2) + 1];
+ int pos = 0;
+ for (int i = 0; i < CLIENT_ID_SIZE; ++i, pos += 2) {
+ sprintf(&convertedKey[pos] ,"%02X", key[i] & 0xff);
+ }
+
+ if ([[NSString stringWithUTF8String:convertedKey] isEqualToString:theirKey]) {
+ //send message
+ char *utf8Message = (char *)[theMessage UTF8String];
+ NSLog(@"Continuing: %s; %d", utf8Message, (int)strlen(utf8Message));
+ int num = m_sendmessage([[Singleton sharedSingleton] toxCoreMessenger], friendNum, (uint8_t *)utf8Message, strlen(utf8Message)+1);
+
+ if (num == 0) {
+ NSLog(@"Failed to put message in send queue!");
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"LastMessageFailedToSend" object:nil];
+ }
+ } else {
+ //todo: tell chat window vc that it failed
+ NSLog(@"Failed to send, mismatched friendnum and id");
+ }
+
+}
+
+#pragma mark - Tox Core call backs and stuff
+
+void print_request(uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata) {
+ NSLog(@"Friend Request! From:");
+
+ for (int i=0; i<32; i++) {
+ printf("%02X", public_key[i] & 0xff);
+ }
+ printf("\n");
+
+ //convert the bin key to a char key. reverse of hex_string_to_bin. used in a lot of places
+ //todo: make it a function
+ char convertedKey[(CLIENT_ID_SIZE * 2) + 1];
+ int pos = 0;
+ for (int i = 0; i < CLIENT_ID_SIZE; ++i, pos += 2) {
+ sprintf(&convertedKey[pos] ,"%02X", public_key[i] & 0xff);
+ }
+
+ //we got a friend request, so we have to store it!
+ //the pending dictionary has the object as nsdata bytes of the bin version of the publickey, and the dict key is the nsstring of said publickey
+ [[[Singleton sharedSingleton] pendingFriendRequests] setObject:[NSData dataWithBytes:public_key length:CLIENT_ID_SIZE]
+ forKey:[NSString stringWithUTF8String:convertedKey]];
+ NSLog(@"%@", [[Singleton sharedSingleton] pendingFriendRequests]);
+ UIAlertView *requestAlert = [[UIAlertView alloc] initWithTitle:@"Friend Request"
+ message:[NSString stringWithUTF8String:convertedKey]
+ delegate:(AppDelegate*)[[UIApplication sharedApplication] delegate]
+ cancelButtonTitle:@"Accept"
+ otherButtonTitles:@"Reject", nil];
+ [requestAlert show];
+
+
+}
+
+void print_message(Messenger *m, int friendnumber, uint8_t * string, uint16_t length, void *userdata) {
+ NSLog(@"Message from [%d]: %s", friendnumber, string);
+
+ NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
+ [dict setObject:[NSString stringWithUTF8String:(char *)string] forKey:@"message"];
+ uint8_t tempKey[CLIENT_ID_SIZE];
+ getclient_id([[Singleton sharedSingleton] toxCoreMessenger], friendnumber, tempKey);
+
+ char convertedKey[(CLIENT_ID_SIZE * 2) + 1];
+ int pos = 0;
+ for (int i = 0; i < CLIENT_ID_SIZE; ++i, pos += 2) {
+ sprintf(&convertedKey[pos] ,"%02X", tempKey[i] & 0xff);
+ }
+ [dict setObject:[NSString stringWithUTF8String:convertedKey] forKey:@"their_public_key"];
+ NSLog(@"MEssage key: %@", [NSString stringWithUTF8String:convertedKey]);
+
+ //add to singleton
+ //if the message coming through is not to the currently opened chat window, then uialertview it
+ if (friendnumber != [[Singleton sharedSingleton] currentlyOpenedFriendNumber]) {
+ NSMutableArray *tempMessages = [[[[Singleton sharedSingleton] mainFriendMessages] objectAtIndex:friendnumber] mutableCopy];
+ MessageObject *theMessage = [[MessageObject alloc] init];
+ [theMessage setMessage:[NSString stringWithUTF8String:(char *)string]];
+ [theMessage setOrigin:MessageLocation_Them];
+ [theMessage setDidFailToSend:NO];
+ [tempMessages addObject:theMessage];
+// [tempMessages addObject:@{@"them": [NSString stringWithUTF8String:(char *)string]}];
+ [[Singleton sharedSingleton] mainFriendMessages][friendnumber] = [tempMessages copy];
+
+ FriendObject *tempFriend = [[[Singleton sharedSingleton] mainFriendList] objectAtIndex:friendnumber];
+ UIAlertView *messageAlert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Message from: %@", tempFriend.nickname]
+ message:[NSString stringWithUTF8String:(char *)string]
+ delegate:nil
+ cancelButtonTitle:@"Okay"
+ otherButtonTitles:nil];
+ [messageAlert show];
+ }
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"NewMessage" object:nil userInfo:dict];
+}
+
+void print_action(Messenger *m, int friendnumber, uint8_t * action, uint16_t length, void *userdata) {
+ //todo: this
+ print_message(m, friendnumber, action, length, userdata);
+}
+
+void print_nickchange(Messenger *m, int friendnumber, uint8_t * string, uint16_t length, void *userdata) {
+ NSLog(@"Nick Change from [%d]: %s", friendnumber, string);
+
+ FriendObject *tempFriend = [[[Singleton sharedSingleton] mainFriendList] objectAtIndex:friendnumber];
+ [tempFriend setNickname:[NSString stringWithUTF8String:(char *)string]];
+
+ //for now
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"FriendAdded" object:nil];
+}
+
+void print_statuschange(Messenger *m, int friendnumber, uint8_t * string, uint16_t length, void *userdata) {
+ NSLog(@"Status change from [%d]: %s", friendnumber, string);
+
+ FriendObject *tempFriend = [[[Singleton sharedSingleton] mainFriendList] objectAtIndex:friendnumber];
+ [tempFriend setStatusMessage:[NSString stringWithUTF8String:(char *)string]];
+
+ //for now
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"FriendAdded" object:nil];
+}
+
+void print_userstatuschange(Messenger *m, int friendnumber, USERSTATUS kind, void *userdata) {
+ FriendObject *tempFriend = [[[Singleton sharedSingleton] mainFriendList] objectAtIndex:friendnumber];
+ switch (kind) {
+ case USERSTATUS_AWAY:
+ {
+ [tempFriend setStatusType:ToxFriendUserStatus_Away];
+ NSLog(@"User status change: away");
+ break;
+ }
+
+ case USERSTATUS_BUSY:
+ {
+ [tempFriend setStatusType:ToxFriendUserStatus_Busy];
+ NSLog(@"User status change: busy");
+ break;
+ }
+
+ case USERSTATUS_INVALID:
+ {
+ [tempFriend setStatusType:ToxFriendUserStatus_None];
+ NSLog(@"User status change: invalid");
+ break;
+ }
+
+ case USERSTATUS_NONE:
+ {
+ [tempFriend setStatusType:ToxFriendUserStatus_None];
+ NSLog(@"User status change: none");
+ break;
+ }
+
+ default:
+ break;
+ }
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"FriendUserStatusChanged" object:nil];
+}
+
+void print_connectionstatuschange(Messenger *m, int friendnumber, uint8_t status, void *userdata) {
+ NSLog(@"Friend Status Change: [%d]: %d", friendnumber, (int)status);
+ FriendObject *tempFriend = [[[Singleton sharedSingleton] mainFriendList] objectAtIndex:friendnumber];
+ switch (status) {
+ case NOFRIEND:
+ tempFriend.connectionType = ToxFriendConnectionStatus_None;
+ break;
+
+ case FRIEND_ADDED:
+ tempFriend.connectionType = ToxFriendConnectionStatus_Added;
+ break;
+
+ case FRIEND_REQUESTED:
+ tempFriend.connectionType = ToxFriendConnectionStatus_Requested;
+ break;
+
+ case FRIEND_CONFIRMED:
+ tempFriend.connectionType = ToxFriendConnectionStatus_Confirmed;
+ break;
+
+ case FRIEND_ONLINE:
+ tempFriend.connectionType = ToxFriendConnectionStatus_Online;
+ break;
+
+ default:
+ break;
+ }
+}
+
+unsigned char * hex_string_to_bin(char hex_string[])
+{
+ size_t len = strlen(hex_string);
+ unsigned char *val = malloc(len);
+ char *pos = hex_string;
+ int i;
+ for (i = 0; i < len; ++i, pos+=2)
+ sscanf(pos,"%2hhX",&val[i]);
+
+ return val;
+}
+
+- (void)toxCoreLoop:(NSTimer *)timer {
+
+ if (on == 0 && DHT_isconnected()) {
+ NSLog(@"DHT Connected!");
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"DHTConnected" object:nil];
+ DHTNodeObject *tempDHT = [[Singleton sharedSingleton] currentConnectDHT];
+ [tempDHT setConnectionStatus:ToxDHTNodeConnectionStatus_Connected];
+ on = 1;
+ }
+
+ if (on == 1 && !DHT_isconnected()) {
+ NSLog(@"DHT Disconnected!");
+ //gotta clear the currently connected dht since we're no longer connected
+ DHTNodeObject *tempDHT = [[Singleton sharedSingleton] currentConnectDHT];
+ [tempDHT setDhtName:@""];
+ [tempDHT setDhtIP:@""];
+ [tempDHT setDhtPort:@""];
+ [tempDHT setDhtKey:@""];
+ [tempDHT setConnectionStatus:ToxDHTNodeConnectionStatus_NotConnected];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"DHTDisconnected" object:nil];
+ on = 0;
+ }
+
+ doMessenger([[Singleton sharedSingleton] toxCoreMessenger]);
+}
+
+#pragma mark - NSTimer method
+
+- (void)connectionTimeoutTimerDidEnd {
+ if (DHT_isconnected()) {
+ //don't do anything, the toxCoreLoop will have changed the boolen in currentConnectDHT and posted the notification
+ } else {
+ //connection timeout
+ //remove the info from currentConnectDHT
+ DHTNodeObject *tempDHT = [[Singleton sharedSingleton] currentConnectDHT];
+ [tempDHT setDhtName:@""];
+ [tempDHT setDhtIP:@""];
+ [tempDHT setDhtPort:@""];
+ [tempDHT setDhtKey:@""];
+ [tempDHT setConnectionStatus:ToxDHTNodeConnectionStatus_NotConnected];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"DHTFailedToConnect" object:nil];
+ }
+}
+
+#pragma mark - Alert View Delegate
+
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
+ if (buttonIndex == 1) {
+ return;
+ }
+
+ NSData *data = [[[Singleton sharedSingleton] pendingFriendRequests] objectForKey:[alertView message]];
+
+ uint8_t *key = (uint8_t *)[data bytes];
+
+ int num = m_addfriend_norequest([[Singleton sharedSingleton] toxCoreMessenger], key);
+
+ switch (num) {
+ case FAERR_TOOLONG:
+ NSLog(@"toolong");
+ break;
+
+ case FAERR_NOMESSAGE:
+ NSLog(@"nomessage");
+ break;
+
+ case FAERR_OWNKEY:
+ NSLog(@"ownkey");
+ break;
+
+ case FAERR_ALREADYSENT:
+ NSLog(@"alreadysent");
+ break;
+
+ case FAERR_UNKNOWN:
+ NSLog(@"unknownerror");
+ break;
+
+ default: //added friend successfully
+ {
+ //friend added through accept request
+ FriendObject *tempFriend = [[FriendObject alloc] init];
+ [tempFriend setPublicKey:[[alertView message] substringToIndex:(CLIENT_ID_SIZE * 2)]];
+ NSLog(@"new friend key: %@", [tempFriend publicKey]);
+ [tempFriend setNickname:@""];
+ [tempFriend setStatusMessage:@"Accepted..."];
+
+ [[[Singleton sharedSingleton] mainFriendList] insertObject:tempFriend atIndex:num];
+ [[[Singleton sharedSingleton] mainFriendMessages] insertObject:[NSArray array] atIndex:num];
+ [[[Singleton sharedSingleton] mainFriendMessages] insertObject:[NSArray array] atIndex:num];
+
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"FriendAdded" object:nil];
+
+ break;
+ }
+ }
+}
+
+@end
View
BIN  Toxicity/Default-568h@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Default@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
25 Toxicity/Friends/ChatWindowViewController.h
@@ -0,0 +1,25 @@
+//
+// ChatWindowViewController.h
+// Toxicity
+//
+// Created by James Linnell on 8/8/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import "JSMessagesViewController.h"
+#import "Singleton.h"
+
+@interface ChatWindowViewController : JSMessagesViewController <JSMessagesViewDataSource, JSMessagesViewDelegate>
+{
+ NSMutableArray *_mainFriendList;
+ NSMutableArray *_mainFriendMessages;
+ FriendObject *_friendInfo;
+
+ NSMutableArray *messages;
+
+ NSUInteger friendIndex;
+}
+
+- (id)initWithFriendIndex:(NSUInteger)friendIndex;
+
+@end
View
212 Toxicity/Friends/ChatWindowViewController.m
@@ -0,0 +1,212 @@
+//
+// ChatWindowViewController.m
+// Toxicity
+//
+// Created by James Linnell on 8/8/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import "ChatWindowViewController.h"
+
+@interface ChatWindowViewController ()
+
+@end
+
+@implementation ChatWindowViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (id)initWithFriendIndex:(NSUInteger)theIndex {
+
+ self = [super init];
+ if (self) {
+ friendIndex = theIndex;
+
+ _mainFriendList = [[Singleton sharedSingleton] mainFriendList];
+ _mainFriendMessages = [[Singleton sharedSingleton] mainFriendMessages];
+
+ messages = [[_mainFriendMessages objectAtIndex:theIndex] mutableCopy];
+
+ _friendInfo = [_mainFriendList objectAtIndex:theIndex];
+
+ [[Singleton sharedSingleton] setCurrentlyOpenedFriendNumber:friendIndex];
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ self.delegate = self;
+ self.dataSource = self;
+
+ self.tableView.backgroundColor = [UIColor colorWithRed:0.4f green:0.4f blue:0.4f alpha:1.0f];
+ self.tableView.separatorColor = [UIColor clearColor];
+
+ if ([_friendInfo.nickname isEqualToString:@""])
+ self.title = _friendInfo.publicKey;
+ else
+ self.title = _friendInfo.nickname;
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateUserInfo) name:@"FriendAdded" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(newMessage:) name:@"NewMessage" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(lastMessageFailed) name:@"LastMessageFailedToSend" object:nil];
+
+ // Do any additional setup after loading the view.
+}
+
+- (void)viewDidDisappear:(BOOL)animated {
+ [[Singleton sharedSingleton] mainFriendMessages][friendIndex] = [messages mutableCopy];
+ [[Singleton sharedSingleton] setCurrentlyOpenedFriendNumber:-1];
+}
+
+#pragma mark - Notifications Center stuff
+
+- (void)updateUserInfo {
+ if ([_friendInfo.nickname isEqualToString:@""])
+ self.title = _friendInfo.publicKey;
+ else
+ self.title = _friendInfo.nickname;
+
+ //todo: status (where to display?) and status type
+}
+
+- (void)newMessage:(NSNotification *)notification {
+ NSString *theMessage = [notification userInfo][@"message"];
+ NSString *theirKey = [notification userInfo][@"their_public_key"];
+
+ if ([theirKey isEqualToString:_friendInfo.publicKey]) {
+ MessageObject *tempMessage = [[MessageObject alloc] init];
+ [tempMessage setMessage:theMessage];
+ [tempMessage setOrigin:MessageLocation_Them];
+ [tempMessage setDidFailToSend:NO];
+ [messages addObject:tempMessage];
+ }
+// [messages addObject:[NSDictionary dictionaryWithObject:theMessage forKey:@"them"]];
+
+ [self.tableView reloadData];
+ [self scrollToBottomAnimated:YES];
+
+ [JSMessageSoundEffect playMessageReceivedSound];
+}
+
+- (void)lastMessageFailed {
+ MessageObject *tempMessage = [messages lastObject];
+ [tempMessage setDidFailToSend:YES];
+ [self.tableView reloadData];
+}
+
+#pragma mark - Table view data source
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return [messages count];
+}
+
+#pragma mark - Messages view delegate
+- (void)sendPressed:(UIButton *)sender withText:(NSString *)text
+{
+// [self.messages addObject:text];
+// [messages addObject:@{@"me": text}];
+ MessageObject *tempMessage = [[MessageObject alloc] init];
+ tempMessage.message = [text copy];
+ tempMessage.origin = MessageLocation_Me;
+ tempMessage.didFailToSend = NO;
+ [messages addObject:tempMessage];
+
+// [self.timestamps addObject:[NSDate date]];
+
+ [JSMessageSoundEffect playMessageSentSound];
+
+
+ NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
+ [dict setObject:[_friendInfo publicKey] forKey:@"friend_public_key"];
+ [dict setObject:text forKey:@"message"];
+ [dict setObject:[NSString stringWithFormat:@"%d", friendIndex] forKey:@"friend_number"];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SendMessage" object:nil userInfo:dict];
+
+ [self finishSend];
+}
+
+- (JSBubbleMessageType)messageTypeForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ MessageObject *tempMessage = [messages objectAtIndex:indexPath.row];
+ if ([tempMessage origin] == MessageLocation_Me)
+// if ([[[messages objectAtIndex:indexPath.row] allKeys] isEqualToArray:[NSArray arrayWithObject:@"me"]])
+ return JSBubbleMessageTypeOutgoing;
+ else
+ return JSBubbleMessageTypeIncoming;
+}
+
+- (JSBubbleMessageStyle)messageStyleForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ return JSBubbleMessageStyleSquare;
+}
+
+- (JSMessagesViewTimestampPolicy)timestampPolicy
+{
+ return JSMessagesViewTimestampPolicyCustom;
+}
+
+- (JSMessagesViewAvatarPolicy)avatarPolicy
+{
+ return JSMessagesViewAvatarPolicyNone;
+}
+
+- (JSAvatarStyle)avatarStyle
+{
+ return JSAvatarStyleCircle;
+}
+
+- (BOOL)hasTimestampForRowAtIndexPath:(NSIndexPath *)indexPath {
+ return NO;
+}
+
+- (BOOL)shouldHaveAvatarForRowAtIndexPath:(NSIndexPath *)indexPath {
+ MessageObject *tempMessage = [messages objectAtIndex:indexPath.row];
+ return [tempMessage didFailToSend];
+}
+
+#pragma mark - Messages view data source
+- (NSString *)textForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+// return [self.messages objectAtIndex:indexPath.row];
+ MessageObject *tempMessage = [messages objectAtIndex:indexPath.row];
+ return [tempMessage message];
+// NSDictionary *dict = [messages objectAtIndex:indexPath.row];
+// if ([self messageTypeForRowAtIndexPath:indexPath] == JSBubbleMessageTypeOutgoing)
+// return [dict objectForKey:@"me"];
+// else
+// return [dict objectForKey:@"them"];
+}
+
+- (NSDate *)timestampForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ return [NSDate date];
+}
+
+- (UIImage *)avatarImageForIncomingMessage
+{
+ return [UIImage imageNamed:@"demo-avatar-woz"];
+}
+
+- (UIImage *)avatarImageForOutgoingMessage
+{
+ return [UIImage imageNamed:@"message-not-sent"];
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+@end
View
26 Toxicity/Friends/FriendsListTableViewController.h
@@ -0,0 +1,26 @@
+//
+// FriendsListTableViewController.h
+// Toxicity
+//
+// Created by James Linnell on 8/5/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <QuartzCore/QuartzCore.h>
+#import "Messenger.h"
+#import "network.h"
+#import "Singleton.h"
+#import "ChatWindowViewController.h"
+#import "TransparentToolbar.h"
+
+@interface FriendsListTableViewController : UITableViewController <UIAlertViewDelegate>
+{
+ IBOutlet UIBarButtonItem *settingsButton;
+
+ NSMutableArray *_mainFriendList;
+}
+
+- (IBAction)addFriendButtonPushed:(id)sender;
+
+@end
View
350 Toxicity/Friends/FriendsListTableViewController.m
@@ -0,0 +1,350 @@
+//
+// FriendsListTableViewController.m
+// Toxicity
+//
+// Created by James Linnell on 8/5/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import "FriendsListTableViewController.h"
+
+@interface FriendsListTableViewController ()
+
+@end
+
+@implementation FriendsListTableViewController
+
+- (id)initWithStyle:(UITableViewStyle)style
+{
+ self = [super initWithStyle:style];
+ if (self) {
+ // Custom initialization
+
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ // Uncomment the following line to preserve selection between presentations.
+ // self.clearsSelectionOnViewWillAppear = NO;
+
+ // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
+ // self.navigationItem.rightBarButtonItem = self.editButtonItem;
+
+ _mainFriendList = [[Singleton sharedSingleton] mainFriendList];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(friendListUpdate) name:@"FriendAdded" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(friendListUpdate) name:@"FriendUserStatusChanged" object:nil];
+
+ settingsButton.title = @"\u2699";
+ UIFont *f1 = [UIFont fontWithName:@"Helvetica" size:24.0f];
+ NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:f1, UITextAttributeFont, nil];
+ [settingsButton setTitleTextAttributes:dict forState:UIControlStateNormal];
+
+ //color stuff
+ self.tableView.separatorColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:1.0f];
+ self.tableView.backgroundColor = [UIColor colorWithRed:0.25f green:0.25f blue:0.25f alpha:1.0f];
+
+ self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.3f green:0.37f blue:0.43f alpha:1];
+
+
+ //dht connection status, put above table view
+ //todo: make it work
+ UIBarButtonItem *dhtStatus = [[UIBarButtonItem alloc] init];
+ dhtStatus.title = @"DHT Connected to LAN";
+ dhtStatus.style = UIBarButtonItemStyleBordered;
+ dhtStatus.width = 310;
+ dhtStatus.tintColor = [UIColor colorWithRed:0.0f green:0.8f blue:0.0f alpha:1.0f];
+
+ TransparentToolbar *toolbar = [[TransparentToolbar alloc] initWithFrame:CGRectMake(0, -55, self.tableView.bounds.size.width, 44)];
+ [toolbar setItems:[NSArray arrayWithObject:dhtStatus]];
+
+
+ [self.tableView addSubview:toolbar];
+
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+- (IBAction)addFriendButtonPushed:(id)sender {
+ UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Add Friend"
+ message:@"Please input their public key."
+ delegate:self
+ cancelButtonTitle:@"Okay"
+ otherButtonTitles:@"Paste & Go", nil];
+ [alertView setAlertViewStyle:UIAlertViewStylePlainTextInput];
+ [alertView show];
+}
+
+- (void)friendListUpdate {
+ [self.tableView reloadData];
+}
+
+#pragma mark - Alert View Delegate
+
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
+ NSLog(@"button: %d", buttonIndex);
+ if (buttonIndex == 0 || buttonIndex == 1) {
+ NSString *theString = [[[alertView textFieldAtIndex:0] text] copy];
+ if (buttonIndex == 1) {
+ theString = [[[UIPasteboard generalPasteboard] string] copy];
+ NSLog(@"Pasted: %@", theString);
+ }
+ //add the friend
+
+ //validate
+ NSError *error = NULL;
+ NSRegularExpression *regexKey = [NSRegularExpression regularExpressionWithPattern:@"^[0-9A-Fa-f]+$" options:NSRegularExpressionCaseInsensitive error:&error];
+ NSUInteger matchKey = [regexKey numberOfMatchesInString:theString options:0 range:NSMakeRange(0, [theString length])];
+ if ([theString length] != (FRIEND_ADDRESS_SIZE * 2) || matchKey == 0) {
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"The Public Key isn't valid!" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
+ [alert show];
+ return;
+ }
+
+ char convertedKey[(FRIEND_ADDRESS_SIZE * 2) + 1];
+ int pos = 0;
+ uint8_t ourAddress[FRIEND_ADDRESS_SIZE];
+ getaddress([[Singleton sharedSingleton] toxCoreMessenger], ourAddress);
+ for (int i = 0; i < FRIEND_ADDRESS_SIZE; ++i, pos += 2) {
+ sprintf(&convertedKey[pos] ,"%02X", ourAddress[i] & 0xff);
+ }
+ if ([[NSString stringWithUTF8String:convertedKey] isEqualToString:theString]) {
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"You can't add your own key, silly!" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
+ [alert show];
+ return;
+ }
+
+ //todo: check to make sure it's not that of a friend already added
+ for (FriendObject *tempFriend in [[Singleton sharedSingleton] mainFriendList]) {
+ if ([[tempFriend.publicKey lowercaseString] isEqualToString:[theString lowercaseString]]) {
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"You've already added that friend!" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
+ [alert show];
+ return;
+ }
+ }
+
+ //actually add friend
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"AddFriend" object:nil userInfo:@{@"new_friend_key": theString}];
+ }
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+ // Return the number of sections.
+ return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ // Return the number of rows in the section.
+// return [_mainFriendList count];
+
+
+ //this is to provide empty cells so the table view doesnt have default white ugly cells
+ //44 = default size, but one there's one or more custom cells, all efault ones go to 64 which is custom height
+ return ceil( (tableView.bounds.size.height - ([_mainFriendList count] * 64) ) / 64) + [_mainFriendList count];
+ //i likes maths
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ static NSString *CellIdentifier = @"FriendListCell";
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+
+ // Configure the cell...
+
+ //do all the fancy stuff here
+ CAGradientLayer *grad = [CAGradientLayer layer];
+ grad.frame = CGRectMake(cell.bounds.origin.x, cell.bounds.origin.y + 1, cell.bounds.size.width, cell.bounds.size.height - 1);
+ UIColor *top = [UIColor colorWithHue:1.0f saturation:0.0f brightness:0.4f alpha:1.0f];
+ UIColor *bottom = [UIColor colorWithHue:1.0f saturation:0.0f brightness:0.3f alpha:1.0f];
+ grad.colors = [NSArray arrayWithObjects:(id)[top CGColor], (id)[bottom CGColor], nil];
+ grad.name = @"Gradient";
+
+ NSArray* sublayers = [NSArray arrayWithArray:cell.contentView.layer.sublayers];
+ for (CALayer *layer in sublayers) {
+ if ([layer.name isEqualToString:@"Gradient"]) {
+ [layer removeFromSuperlayer];
+ }
+ }
+ [cell.contentView.layer insertSublayer:grad atIndex:0];
+
+ [cell.textLabel setTextColor:[UIColor whiteColor]];
+ [cell.textLabel setBackgroundColor:[UIColor clearColor]];
+ [cell.detailTextLabel setTextColor:[UIColor colorWithRed:0.55f green:0.62f blue:0.68f alpha:1.0f]];
+ [cell.detailTextLabel setBackgroundColor:[UIColor clearColor]];
+
+ cell.contentView.backgroundColor = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f];
+
+
+ cell.textLabel.shadowColor = [UIColor colorWithRed:0.2f green:0.2f blue:0.2f alpha:1.0f];
+ cell.textLabel.shadowOffset = CGSizeMake(1.0f, 1.0f);
+ cell.detailTextLabel.shadowColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:1.0f];
+ cell.detailTextLabel.shadowOffset = CGSizeMake(0.5f, 0.5f);
+
+ cell.textLabel.font = [UIFont systemFontOfSize:18.0f];
+
+
+ //and here only give the cells info if it's actually in our array
+ cell.textLabel.text = @"";
+ cell.detailTextLabel.text = @"";
+
+
+ /***************/
+
+
+ //only do this stuff if it's an actual friend cell, not a blank one
+ if ([_mainFriendList count] <= indexPath.row) {
+ return cell;
+ }
+
+ FriendObject *tempFriend = [_mainFriendList objectAtIndex:indexPath.row];
+
+ if ([tempFriend.nickname isEqualToString:@""]){
+ NSString *temp = tempFriend.publicKey;
+ NSString *front = [temp substringToIndex:4];
+ NSString *end = [temp substringFromIndex:[temp length] - 4];
+ NSString *formattedString = [[NSString alloc] initWithFormat:@"%@...%@", front, end];
+ cell.textLabel.text = formattedString;
+ // cell.textLabel.text = [_mainFriendList objectAtIndex:indexPath.row][@"friend_public_key"];
+ } else {
+ cell.textLabel.text = tempFriend.nickname;
+ }
+
+ cell.detailTextLabel.text = tempFriend.statusMessage;
+
+ UIImageView *statusView;
+ if (tempFriend.connectionType == ToxFriendConnectionStatus_None ||
+ tempFriend.connectionType == ToxFriendConnectionStatus_Added ||
+ tempFriend.connectionType == ToxFriendConnectionStatus_Requested ||
+ tempFriend.connectionType == ToxFriendConnectionStatus_Confirmed) {
+ statusView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"status-gray"]];
+ } else {
+ switch (tempFriend.statusType) {
+ case ToxFriendUserStatus_Away:
+ {
+ statusView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"status-yellow"]];
+ break;
+ }
+
+ case ToxFriendUserStatus_Busy:
+ {
+ statusView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"status-red"]];
+ break;
+ }
+
+ case ToxFriendUserStatus_None:
+ {
+ statusView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"status-green"]];
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+ statusView.frame = CGRectMake(cell.contentView.bounds.size.width - 16, 0, statusView.frame.size.width, statusView.frame.size.height);
+
+ [cell.contentView addSubview:statusView];
+
+
+ return cell;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+ return 64;
+}
+
+/*
+// Override to support conditional editing of the table view.
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ // Return NO if you do not want the specified item to be editable.
+ return YES;
+}
+*/
+
+/*
+// Override to support editing the table view.
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ if (editingStyle == UITableViewCellEditingStyleDelete) {
+ // Delete the row from the data source
+ [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
+ }
+ else if (editingStyle == UITableViewCellEditingStyleInsert) {
+ // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
+ }
+}
+*/
+
+/*
+// Override to support rearranging the table view.
+- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
+{
+}
+*/
+
+/*
+// Override to support conditional rearranging of the table view.
+- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ // Return NO if you do not want the item to be re-orderable.
+ return YES;
+}
+*/
+
+#pragma mark - Table view delegate
+
+- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath {
+ UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
+
+ NSArray* sublayers = [NSArray arrayWithArray:cell.contentView.layer.sublayers];
+ for (CALayer *layer in sublayers) {
+ if ([layer.name isEqualToString:@"Gradient"]) {
+ CAGradientLayer *gradLayer = (CAGradientLayer *)layer;
+ UIColor *top = [UIColor colorWithHue:1.0f saturation:0.0f brightness:0.3f alpha:1.0f];
+ UIColor *bottom = [UIColor colorWithHue:1.0f saturation:0.0f brightness:0.4f alpha:1.0f];
+ gradLayer.colors = [NSArray arrayWithObjects:(id)[top CGColor], (id)[bottom CGColor], nil];
+ }
+ }
+}
+
+- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath {
+ UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
+
+ NSArray* sublayers = [NSArray arrayWithArray:cell.contentView.layer.sublayers];
+ for (CALayer *layer in sublayers) {
+ if ([layer.name isEqualToString:@"Gradient"]) {
+ CAGradientLayer *gradLayer = (CAGradientLayer *)layer;
+ UIColor *top = [UIColor colorWithHue:1.0f saturation:0.0f brightness:0.4f alpha:1.0f];
+ UIColor *bottom = [UIColor colorWithHue:1.0f saturation:0.0f brightness:0.3f alpha:1.0f];
+ gradLayer.colors = [NSArray arrayWithObjects:(id)[top CGColor], (id)[bottom CGColor], nil];
+ }
+ }
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ if ([_mainFriendList count] <= indexPath.row) {
+ return;
+ }
+
+ ChatWindowViewController *chatVC = [[ChatWindowViewController alloc] initWithFriendIndex:indexPath.row];
+ [self.navigationController pushViewController:chatVC animated:YES];
+ [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
+
+
+}
+
+@end
View
13 Toxicity/Friends/TransparentToolbar.h
@@ -0,0 +1,13 @@
+//
+// TransparentToolbar.h
+// Toxicity
+//
+// Created by James Linnell on 8/11/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface TransparentToolbar : UIToolbar
+
+@end
View
46 Toxicity/Friends/TransparentToolbar.m
@@ -0,0 +1,46 @@
+//
+// TransparentToolbar.m
+// Toxicity
+//
+// Created by James Linnell on 8/11/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import "TransparentToolbar.h"
+
+@implementation TransparentToolbar
+
+// Override init.
+- (id) init
+{
+ self = [super init];
+ [self applyTranslucentBackground];
+ return self;
+}
+
+// Override initWithFrame.
+- (id) initWithFrame:(CGRect) frame
+{
+ self = [super initWithFrame:frame];
+ if (self) {
+ [self applyTranslucentBackground];
+ }
+ return self;
+}
+
+// Override draw rect to avoid
+// background coloring
+- (void)drawRect:(CGRect)rect {
+ // do nothing in here
+}
+
+// Set properties to make background
+// translucent.
+- (void) applyTranslucentBackground
+{
+ self.backgroundColor = [UIColor clearColor];
+ self.opaque = NO;
+ self.translucent = YES;
+}
+
+@end
View
BIN  Toxicity/Images/default-avatar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/message-not-sent.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/message-not-sent@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/status-gray.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/status-gray@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/status-green.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/status-green@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/status-orange.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/status-orange@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/status-red.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/status-red@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/status-yellow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Toxicity/Images/status-yellow@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
29 Toxicity/Objects/DHTNodeObject.h
@@ -0,0 +1,29 @@
+//
+// DHTNodeObject.h
+// Toxicity
+//
+// Created by James Linnell on 8/12/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+typedef enum {
+ ToxDHTNodeConnectionStatus_NotConnected,
+ ToxDHTNodeConnectionStatus_Connecting,
+ ToxDHTNodeConnectionStatus_Connected
+} ToxDHTNodeConnectionStatus;
+
+@interface DHTNodeObject : NSObject
+{
+
+}
+
+@property (nonatomic, strong) NSString *dhtName;
+@property (nonatomic, strong) NSString *dhtIP;
+@property (nonatomic, strong) NSString *dhtPort;
+@property (nonatomic, strong) NSString *dhtKey;
+@property (nonatomic, assign) ToxDHTNodeConnectionStatus connectionStatus;
+
+
+@end
View
55 Toxicity/Objects/DHTNodeObject.m
@@ -0,0 +1,55 @@
+//
+// DHTNodeObject.m
+// Toxicity
+//
+// Created by James Linnell on 8/12/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import "DHTNodeObject.h"
+
+@implementation DHTNodeObject
+
+- (id)init {
+ self = [super init];
+ if (self) {
+ self.dhtName = [[NSString alloc] init];
+ self.dhtIP = [[NSString alloc] init];
+ self.dhtPort = [[NSString alloc] init];
+ self.dhtKey = [[NSString alloc] init];
+ self.connectionStatus = ToxDHTNodeConnectionStatus_NotConnected;
+ }
+ return self;
+}
+
+- (id)initWithCoder:(NSCoder *)decoder {
+ if((self = [super init])) {
+ //decode properties, other class vars
+ self.dhtName = [decoder decodeObjectForKey:@"dht_name"];
+ self.dhtIP = [decoder decodeObjectForKey:@"dht_ip"];
+ self.dhtPort = [decoder decodeObjectForKey:@"dht_port"];
+ self.dhtKey = [decoder decodeObjectForKey:@"dht_key"];
+ }
+ return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)encoder {
+ //Encode properties, other class variables, etc
+ [encoder encodeObject:self.dhtName forKey:@"dht_name"];
+ [encoder encodeObject:self.dhtIP forKey:@"dht_ip"];
+ [encoder encodeObject:self.dhtPort forKey:@"dht_port"];
+ [encoder encodeObject:self.dhtKey forKey:@"dht_key"];
+}
+
+- (id)copy {
+ DHTNodeObject *temp = [[DHTNodeObject alloc] init];
+ temp.dhtName = [self.dhtName copy];
+ temp.dhtIP = [self.dhtIP copy];
+ temp.dhtPort = [self.dhtPort copy];
+ temp.dhtKey = [self.dhtKey copy];
+ temp.connectionStatus = self.connectionStatus;
+
+ return temp;
+}
+
+@end
View
38 Toxicity/Objects/FriendObject.h
@@ -0,0 +1,38 @@
+//
+// FriendObject.h
+// Toxicity
+//
+// Created by James Linnell on 8/12/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+typedef enum {
+ ToxFriendUserStatus_Busy,
+ ToxFriendUserStatus_Away,
+ ToxFriendUserStatus_None
+} ToxFriendUserStatus;
+
+typedef enum {
+ ToxFriendConnectionStatus_None,
+ ToxFriendConnectionStatus_Added,
+ ToxFriendConnectionStatus_Requested,
+ ToxFriendConnectionStatus_Confirmed,
+ ToxFriendConnectionStatus_Online
+} ToxFriendConnectionStatus;
+
+@interface FriendObject : NSObject
+{
+
+}
+
+@property (nonatomic, strong) NSString *publicKey;
+@property (nonatomic, strong) NSString *publicKeyWithNoSpam;
+@property (nonatomic, strong) NSString *nickname;
+@property (nonatomic, strong) NSString *statusMessage;
+@property (nonatomic, assign) ToxFriendUserStatus statusType;
+@property (nonatomic, assign) ToxFriendConnectionStatus connectionType;
+@property (nonatomic, strong) UIImage *avatarImage;
+
+@end
View
27 Toxicity/Objects/FriendObject.m
@@ -0,0 +1,27 @@
+//
+// FriendObject.m
+// Toxicity
+//
+// Created by James Linnell on 8/12/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import "FriendObject.h"
+
+@implementation FriendObject
+
+- (id)init {
+ self = [super init];
+ if (self) {
+ self.publicKey = [[NSString alloc] init];
+ self.publicKeyWithNoSpam = [[NSString alloc] init];
+ self.nickname = [[NSString alloc] init];
+ self.statusMessage = [[NSString alloc] init];
+ self.statusType = ToxFriendUserStatus_None;
+ self.connectionType = ToxFriendConnectionStatus_None;
+ self.avatarImage = [UIImage imageNamed:@"default-avatar"]; //add placeholder
+ }
+ return self;
+}
+
+@end
View
25 Toxicity/Objects/MessageObject.h
@@ -0,0 +1,25 @@
+//
+// MessageObject.h
+// Toxicity
+//
+// Created by James Linnell on 8/15/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+typedef enum {
+ MessageLocation_Me,
+ MessageLocation_Them
+} MessageOrigin;
+
+@interface MessageObject : NSObject
+{
+
+}
+
+@property (nonatomic, strong) NSString *message;
+@property (nonatomic, assign) MessageOrigin origin;
+@property (nonatomic, assign) BOOL didFailToSend;
+
+@end
View
13 Toxicity/Objects/MessageObject.m
@@ -0,0 +1,13 @@
+//
+// MessageObject.m
+// Toxicity
+//
+// Created by James Linnell on 8/15/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//
+
+#import "MessageObject.h"
+
+@implementation MessageObject
+
+@end
View
48 Toxicity/Settings/NewDHTNodeViewController.h
@@ -0,0 +1,48 @@
+//
+// ConnectDHTModalViewController.h
+// Toxicity
+//
+// Created by James Linnell on 8/4/13.
+// Copyright (c) 2013 JamesTech. All rights reserved.
+//