├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── app ├── CMakeLists.txt ├── graphics │ ├── CMakeLists.txt │ ├── tox_logo.png │ └── ubuntu-tox-client.png ├── main.qml ├── ubuntu-tox-client.desktop.in └── ui │ ├── AboutPage.qml │ └── CMakeLists.txt ├── backend ├── CMakeLists.txt └── modules │ └── UbuntuToxClient │ ├── backend.cpp │ ├── backend.h │ ├── bootstrapnodes.h │ ├── cdata.cpp │ ├── cdata.h │ ├── contactsmodel.cpp │ ├── contactsmodel.h │ ├── cstring.cpp │ ├── cstring.h │ ├── friend.cpp │ ├── friend.h │ ├── include │ └── tox │ │ └── tox.h │ ├── libs │ ├── amd64 │ │ ├── libsodium.so │ │ ├── libsodium.so.13 │ │ ├── libsodium.so.13.0.2 │ │ ├── libtoxcore.so │ │ ├── libtoxcore.so.0 │ │ └── libtoxcore.so.0.0.0 │ ├── armhf │ │ ├── libsodium.so │ │ ├── libsodium.so.13 │ │ ├── libsodium.so.13.0.2 │ │ ├── libtoxcore.so │ │ ├── libtoxcore.so.0 │ │ └── libtoxcore.so.0.0.0 │ └── i386 │ │ ├── libsodium.so │ │ ├── libsodium.so.13 │ │ ├── libsodium.so.13.0.2 │ │ ├── libtoxcore.so │ │ ├── libtoxcore.so.0 │ │ └── libtoxcore.so.0.0.0 │ ├── qmldir │ ├── toxbackend.cpp │ └── toxbackend.h ├── cmake └── Click.cmake ├── manifest.json.in ├── po ├── CMakeLists.txt └── com.ubuntu.developer.nikwen.ubuntu-tox-client.pot └── ubuntu-tox-client.apparmor /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user 2 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(ubuntu-tox-client C CXX) 2 | cmake_minimum_required(VERSION 2.8.9) 3 | 4 | # Do not remove this line, its required for the correct functionality of the Ubuntu-SDK 5 | set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file") 6 | set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") 7 | 8 | find_package(Qt5Core) 9 | find_package(Qt5Qml) 10 | find_package(Qt5Quick) 11 | # find_package(ubuntu-sdk-libs) 12 | 13 | # Automatically create moc files 14 | set(CMAKE_AUTOMOC ON) 15 | 16 | # Components PATH 17 | execute_process( 18 | COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH 19 | OUTPUT_VARIABLE ARCH_TRIPLET 20 | OUTPUT_STRIP_TRAILING_WHITESPACE 21 | ) 22 | 23 | set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}") 24 | 25 | set(APP_NAME ubuntu-tox-client) 26 | set(APP_ID "com.ubuntu.developer.nikwen.ubuntu-tox-client") 27 | set(UBUNTU-TOX-CLIENT_DIR "share/qml/ubuntu-tox-client") 28 | set(MAIN_QML "main.qml") 29 | set(ICON "graphics/ubuntu-tox-client.png") 30 | 31 | # Set install paths 32 | set(CMAKE_INSTALL_PREFIX /) 33 | set(DATA_DIR /) 34 | set(DESKTOP_DIR ${DATA_DIR}) 35 | set(DESKTOP_FILE_NAME "ubuntu-tox-client.desktop") 36 | 37 | set(EXEC "qmlscene $@ ${UBUNTU-TOX-CLIENT_DIR}/${MAIN_QML}") 38 | 39 | # This command figures out the target architecture for use in the manifest file 40 | execute_process( 41 | COMMAND dpkg-architecture -qDEB_HOST_ARCH 42 | OUTPUT_VARIABLE CLICK_ARCH 43 | OUTPUT_STRIP_TRAILING_WHITESPACE 44 | ) 45 | 46 | configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json) 47 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json 48 | DESTINATION ${CMAKE_INSTALL_PREFIX}) 49 | 50 | install(DIRECTORY "app/graphics" DESTINATION ${DATA_DIR}) 51 | install(FILES "ubuntu-tox-client.apparmor" DESTINATION ${DATA_DIR}) 52 | 53 | add_subdirectory(app) 54 | add_subdirectory(backend) 55 | add_subdirectory(po) 56 | 57 | add_custom_target("run" /usr/bin/qmlscene -I ${CMAKE_BINARY_DIR}/backend ${CMAKE_SOURCE_DIR}/app/ubuntu-tox-client.qml 58 | DEPENDS ubuntu-tox-clientbackend ubuntu-tox-clientbackend-qmldir 59 | WORKING_DIRECTORY ./app) 60 | 61 | # No op custom target for all not compiled files, so they show up in the QtCreator project tree 62 | add_custom_target("ubuntu-tox-client_ClickFiles" ALL SOURCES "ubuntu-tox-client.apparmor" "manifest.json.in") 63 | 64 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ubuntu-tox-client 2 | ================= 3 | 4 | Attempt to create a [Tox](https://tox.im) client licensed under the GPL v3 using the Ubuntu SDK. 5 | 6 | Building 7 | ======== 8 | 9 | Build it as usual using the Ubuntu SDK, but add the respective CMake option for the architecture you are building for: 10 | 11 | ``` 12 | -DFOR_AMD64=ON 13 | -DFOR_I386=ON 14 | -DFOR_ARMHF=ON 15 | ``` 16 | 17 | New versions of the shipped toxcore and libsodium binaries can be compiled using the following set of scripts: https://github.com/nikwen/ubuntu-toxcore-cross-compilation-scripts 18 | 19 | Credits 20 | ======= 21 | 22 | ubuntu-tox-client uses the following libraries: 23 | 24 | * [toxcore](https://github.com/irungentoo/toxcore) (GPL v3) 25 | * [libsodium](https://github.com/jedisct1/libsodium) (ISC license) 26 | 27 | ubuntu-tox-client uses code from the following projects: 28 | 29 | * [qTox](https://github.com/tux3/qTox) (GPL v3) 30 | * [uTox](https://github.com/notsecure/uTox) (GPL v3) 31 | -------------------------------------------------------------------------------- /app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB QML_JS_FILES *.qml *.js) 2 | 3 | # Make the files visible on qtcreator 4 | add_custom_target(ubuntu-tox-client_QMlFiles ALL SOURCES ${QML_JS_FILES}) 5 | 6 | # Substitute variables in the desktop file 7 | configure_file(${DESKTOP_FILE_NAME}.in ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}.in) 8 | 9 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DESKTOP_DIR}) 10 | install(FILES ${QML_JS_FILES} DESTINATION ${UBUNTU-TOX-CLIENT_DIR}) 11 | 12 | add_subdirectory(ui) 13 | add_subdirectory(graphics) 14 | -------------------------------------------------------------------------------- /app/graphics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB UI_QML_JS_FILES *.png) 2 | 3 | # Make the files visible in the qtcreator tree 4 | add_custom_target(ubuntu-tox-client_ui_pngFiles ALL SOURCES ${UI_QML_JS_FILES}) 5 | 6 | install(FILES ${UI_QML_JS_FILES} DESTINATION ${UBUNTU-TOX-CLIENT_DIR}/graphics) 7 | 8 | -------------------------------------------------------------------------------- /app/graphics/tox_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikwen/ubuntu-tox-client/eceb2a005f4c6b86e3f858241f671c902bc4d4f1/app/graphics/tox_logo.png -------------------------------------------------------------------------------- /app/graphics/ubuntu-tox-client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikwen/ubuntu-tox-client/eceb2a005f4c6b86e3f858241f671c902bc4d4f1/app/graphics/ubuntu-tox-client.png -------------------------------------------------------------------------------- /app/main.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | import QtQuick 2.3 21 | import Ubuntu.Components 1.1 22 | import Ubuntu.Components.Popups 1.0 23 | import Ubuntu.Components.ListItems 1.0 as ListItem 24 | import Ubuntu.Components.Themes.Ambiance 0.1 25 | import UbuntuToxClient 1.0 26 | 27 | import "ui" 28 | 29 | MainView { 30 | applicationName: "com.ubuntu.developer.nikwen.ubuntu-tox-client" 31 | 32 | useDeprecatedToolbar: false 33 | 34 | width: units.gu(100) 35 | height: units.gu(75) 36 | 37 | PageStack { 38 | id: pageStack 39 | 40 | Component.onCompleted: push(startPage) 41 | } 42 | 43 | Page { 44 | id: startPage 45 | visible: false 46 | 47 | title: i18n.tr("Tox-Client") 48 | 49 | head.actions: [ 50 | Action { 51 | id: contacts1Action 52 | iconName: "contact" 53 | text: i18n.tr("Contacts") 54 | 55 | onTriggered: pageStack.push(contactsPage) 56 | }, 57 | Action { 58 | id: aboutAction 59 | iconName: "info" 60 | text: i18n.tr("About") 61 | 62 | onTriggered: pageStack.push(aboutPage) 63 | }, 64 | Action { 65 | id: settingsAction 66 | iconName: "settings" 67 | text: i18n.tr("Settings") 68 | 69 | onTriggered: pageStack.push(settingsPage) 70 | } 71 | ] 72 | 73 | Column { 74 | anchors { 75 | fill: parent 76 | margins: units.gu(2) 77 | } 78 | spacing: units.gu(2) 79 | 80 | Label { 81 | id: toxIdLabel 82 | width: parent.width 83 | wrapMode: Text.Wrap 84 | 85 | text: i18n.tr("Your Tox-ID is (click to copy):") + (copyCheckMarkTimer.running ? " ✓
" : "
") + backend.toxId 86 | 87 | MouseArea { 88 | anchors.fill: parent 89 | 90 | onClicked: { 91 | var mimeData = Clipboard.newData() 92 | mimeData.text = backend.toxId 93 | Clipboard.push(mimeData) 94 | 95 | copyCheckMarkTimer.restart() 96 | 97 | console.log("Copied Tox-ID to clipboard") 98 | } 99 | } 100 | 101 | Timer { 102 | id: copyCheckMarkTimer 103 | interval: 2000 104 | repeat: false 105 | } 106 | } 107 | 108 | Label { 109 | id: connectedLabel 110 | width: parent.width 111 | wrapMode: Text.Wrap 112 | 113 | text: backend.connected ? i18n.tr("You are connected to the DHT") : i18n.tr("You are not connected to the DHT") 114 | } 115 | 116 | Label { //TODO: Better solution for friendship requests! 117 | id: friendRequestLabel 118 | width: parent.width 119 | wrapMode: Text.Wrap 120 | 121 | property string userId: "" 122 | property string message: "" 123 | 124 | text: (userId !== "") ? qsTr(i18n.tr("Incoming friend request from user %1
Message: %2")).arg(userId).arg(message) : "" 125 | visible: text !== "" 126 | } 127 | 128 | Button { 129 | id: acceptButton 130 | width: parent.width 131 | visible: friendRequestLabel.visible 132 | color: UbuntuColors.green 133 | 134 | text: i18n.tr("Accept friend request") 135 | 136 | onClicked: backend.acceptFriendRequest(friendRequestLabel.userId) 137 | } 138 | 139 | Label { 140 | id: addFriendResultLabel 141 | width: parent.width 142 | wrapMode: Text.Wrap 143 | 144 | property bool success: false 145 | property string userId: "" 146 | 147 | text: (success === true) ? i18n.tr("Added friend successfully! :)") : i18n.tr("Failed to add friend! :(") 148 | visible: userId !== "" 149 | } 150 | } 151 | } 152 | 153 | Page { 154 | id: contactsPage 155 | title: i18n.tr("Contacts") 156 | visible: false 157 | 158 | head.actions: [ 159 | Action { 160 | id: addFriendAction 161 | iconName: "add" 162 | text: "Add friend" 163 | 164 | onTriggered: pageStack.push(addFriendPage) 165 | } 166 | ] 167 | 168 | ListView { 169 | id: contactsListView 170 | height: parent.height 171 | width: parent.width 172 | clip: true 173 | 174 | model: ContactsModel { 175 | toxBackend: backend 176 | } 177 | 178 | delegate: ListItem.Subtitled { 179 | text: model.name 180 | subText: model.statusMessage 181 | progression: true 182 | onClicked: { 183 | pageStack.push(contactsDetailsPage) 184 | contactsDetailsPage.headline=model.name 185 | } 186 | } 187 | } 188 | } 189 | 190 | Page { 191 | id: addFriendPage 192 | visible: false 193 | 194 | title: i18n.tr("Add a friend") 195 | 196 | head.actions: [ 197 | Action { 198 | id: confirmAddFriendAction 199 | iconName: "ok" 200 | text: i18n.tr("Add friend") 201 | 202 | onTriggered: { 203 | var message = (friendMessageTextField.text.length > 0) ? friendMessageTextField.text : friendMessageTextField.placeholderText 204 | backend.sendFriendRequest(friendAddressTextField.text, message) 205 | } 206 | } 207 | ] 208 | 209 | head.backAction: Action { 210 | id: cancelAddFriendAction 211 | iconName: "close" 212 | text: i18n.tr("Cancel") 213 | 214 | onTriggered: { 215 | //Clear text fields 216 | friendAddressTextField.text = "" 217 | friendMessageTextField.text = "" 218 | 219 | pageStack.pop() 220 | } 221 | } 222 | 223 | Column { 224 | anchors.fill: parent 225 | spacing: units.gu(1) 226 | 227 | ListItem.Header { 228 | text: i18n.tr("Tox ID:") 229 | } 230 | 231 | TextField { 232 | id: friendAddressTextField 233 | maximumLength: backend.getFriendAddressSize() 234 | placeholderText: i18n.tr("Your friend's Tox ID") 235 | 236 | anchors { 237 | right: parent.right 238 | left: parent.left 239 | rightMargin: units.gu(2) 240 | leftMargin: units.gu(2) 241 | } 242 | 243 | style: TextFieldStyle { 244 | background: Item {} 245 | } 246 | 247 | KeyNavigation.priority: KeyNavigation.BeforeItem 248 | KeyNavigation.tab: friendMessageTextField 249 | } 250 | 251 | ListItem.Header { 252 | text: i18n.tr("Message:") 253 | } 254 | 255 | TextField { 256 | id: friendMessageTextField 257 | maximumLength: backend.getMaximumFriendRequestLength() 258 | placeholderText: i18n.tr("Let's tox!") 259 | 260 | anchors { 261 | right: parent.right 262 | left: parent.left 263 | rightMargin: units.gu(2) 264 | leftMargin: units.gu(2) 265 | } 266 | 267 | style: TextFieldStyle { 268 | background: Item {} 269 | } 270 | 271 | KeyNavigation.priority: KeyNavigation.BeforeItem 272 | KeyNavigation.backtab: friendAddressTextField 273 | } 274 | 275 | Connections { 276 | target: backend 277 | 278 | onFriendAdded: { 279 | if (pageStack.currentPage === addFriendPage) { 280 | //Clear text fields 281 | friendAddressTextField.text = "" 282 | friendMessageTextField.text = "" 283 | 284 | pageStack.pop() 285 | } 286 | } 287 | 288 | onFailedToAddFriend: { 289 | if (pageStack.currentPage === addFriendPage) { 290 | console.log("Error while adding friend:", errorCode) 291 | var dialog = PopupUtils.open(addFriendErrorDialog) 292 | dialog.errorCode = errorCode 293 | } 294 | } 295 | } 296 | } 297 | 298 | Component { 299 | id: addFriendErrorDialog 300 | 301 | Dialog { 302 | id: dialog 303 | title: getTitleForErrorCode(errorCode) 304 | text: getTextForErrorCode(errorCode) 305 | 306 | property int errorCode: 0 307 | 308 | onErrorCodeChanged: console.log(errorCode) 309 | 310 | function getTitleForErrorCode(errorCode) { 311 | if (errorCode === backend.getFAErrSetNewNospam()) { 312 | return i18n.tr("Updated nospam value") 313 | } else { 314 | return i18n.tr("Failed to add friend") 315 | } 316 | } 317 | 318 | function getTextForErrorCode(errorCode) { 319 | switch (errorCode) { 320 | case backend.getFAErrTooLong(): 321 | return i18n.tr("The entered message is too long!") 322 | case backend.getFAErrNoMessage(): 323 | return i18n.tr("No message has been entered!") 324 | case backend.getFAErrOwnKey(): 325 | return i18n.tr("You cannot add yourself as a friend! ;)") 326 | case backend.getFAErrAlreadySent(): 327 | return i18n.tr("You have already sent that user a friendship request!") 328 | case backend.getFAErrUnknown(): 329 | return i18n.tr("Unknown error...") 330 | case backend.getFAErrBadChecksum(): 331 | return i18n.tr("There is a checksum error in the entered Tox ID!") 332 | case backend.getFAErrSetNewNospam(): 333 | return i18n.tr("The nospam value has been updated!") 334 | case backend.getFAErrNoMem(): 335 | return i18n.tr("Increasing the friend list size has failed!") 336 | default: 337 | return "" 338 | } 339 | } 340 | 341 | Button { 342 | text: i18n.tr("OK") 343 | color: UbuntuColors.green 344 | onClicked: { 345 | PopupUtils.close(dialog) 346 | if (errorCode === backend.getFAErrSetNewNospam()) { 347 | pageStack.pop() 348 | } 349 | } 350 | } 351 | } 352 | } 353 | } 354 | 355 | Page { 356 | id: contactsDetailsPage 357 | title: i18n.tr("Chat with ")+headline 358 | visible: false 359 | anchors.fill: parent 360 | property string headline: "" 361 | 362 | ListModel { 363 | id: exampleListModel 364 | 365 | ListElement { 366 | sender: "person A" 367 | name: "Hey" 368 | timestamp: "17:30:34" 369 | } 370 | ListElement { 371 | sender: "Person B" 372 | name: "How are you?" 373 | timestamp: "17:35:30" 374 | } 375 | ListElement { 376 | sender: "Person A" 377 | name: "I'm fine." 378 | timestamp: "17:39:04" 379 | } 380 | 381 | } 382 | 383 | ListView { 384 | id: exampleListView 385 | anchors.fill: parent 386 | height: parent.height 387 | width: parent.width 388 | model: exampleListModel 389 | 390 | delegate: UbuntuShape { 391 | color: "lightgrey" 392 | height: timestampLabel.height+textLabel.height+senderLabel.height 393 | width: parent.width 394 | 395 | Row { 396 | id: headerRow 397 | spacing: units.gu(3) 398 | 399 | Label { 400 | id: timestampLabel 401 | text: timestamp 402 | wrapMode: Text.WordWrap 403 | } 404 | Label { 405 | id: senderLabel 406 | text: sender 407 | wrapMode: Text.WordWrap 408 | } 409 | } 410 | 411 | Label { 412 | id: textLabel 413 | text: name 414 | wrapMode: Text.WordWrap 415 | anchors { 416 | top: headerRow.bottom 417 | } 418 | } 419 | } 420 | 421 | } 422 | 423 | } 424 | 425 | 426 | 427 | 428 | Page { 429 | id: settingsPage 430 | visible: false 431 | 432 | title: i18n.tr("Settings") 433 | 434 | Component.onCompleted: updateLabels() 435 | 436 | head.actions: [ 437 | Action { 438 | id: saveAction 439 | iconName: "ok" 440 | text: i18n.tr("Save") 441 | 442 | onTriggered: { 443 | backend.setUserName(userNameTextField.text) 444 | backend.setStatusMessage(statusMessageTextField.text) 445 | pageStack.pop() 446 | } 447 | } 448 | ] 449 | 450 | head.backAction: Action { 451 | id: cancelAction 452 | iconName: "close" 453 | text: i18n.tr("Cancel") 454 | 455 | onTriggered: { 456 | settingsPage.updateLabels() 457 | pageStack.pop() 458 | } 459 | } 460 | 461 | function updateLabels() { 462 | userNameTextField.text = backend.userName 463 | statusMessageTextField.text = backend.statusMessage 464 | } 465 | 466 | Connections { 467 | target: backend 468 | onUserNameChanged: userNameTextField.text = backend.userName 469 | onStatusMessageChanged: statusMessageTextField.text = backend.statusMessage 470 | } 471 | 472 | Column { 473 | anchors.fill: parent 474 | spacing: units.gu(1) 475 | 476 | ListItem.Header { 477 | text: i18n.tr("User name:") 478 | } 479 | 480 | TextField { 481 | id: userNameTextField 482 | maximumLength: backend.getMaximumUserNameLength() 483 | 484 | anchors { 485 | right: parent.right 486 | left: parent.left 487 | rightMargin: units.gu(2) 488 | leftMargin: units.gu(2) 489 | } 490 | 491 | style: TextFieldStyle { 492 | background: Item {} 493 | } 494 | 495 | KeyNavigation.priority: KeyNavigation.BeforeItem 496 | KeyNavigation.tab: statusMessageTextField 497 | } 498 | 499 | ListItem.Header { 500 | text: i18n.tr("Status message:") 501 | } 502 | 503 | TextField { 504 | id: statusMessageTextField 505 | maximumLength: backend.getMaximumStatusMessageLength() 506 | 507 | anchors { 508 | right: parent.right 509 | left: parent.left 510 | rightMargin: units.gu(2) 511 | leftMargin: units.gu(2) 512 | } 513 | 514 | style: TextFieldStyle { 515 | background: Item {} 516 | } 517 | 518 | KeyNavigation.priority: KeyNavigation.BeforeItem 519 | KeyNavigation.backtab: userNameTextField 520 | } 521 | } 522 | } 523 | 524 | AboutPage { 525 | id: aboutPage 526 | visible: false 527 | } 528 | 529 | ToxBackend { 530 | id: backend 531 | 532 | onConnectedChanged: console.log(connected ? "Connected" : "Disconnected") 533 | 534 | Component.onDestruction: { 535 | console.log("ToxBackend: Component.onDestruction received") 536 | backend.cleanUpOnClose() 537 | } 538 | 539 | onFriendRequestReceived: { 540 | console.log("Incoming friend request :)") 541 | friendRequestLabel.userId = userId 542 | friendRequestLabel.message = message 543 | addFriendResultLabel.userId = "" 544 | addFriendResultLabel.success = false 545 | } 546 | 547 | onFriendAdded: { 548 | friendRequestLabel.userId = "" 549 | friendRequestLabel.message = "" 550 | addFriendResultLabel.userId = userId 551 | addFriendResultLabel.success = true 552 | } 553 | 554 | onFailedToAddFriend: { 555 | friendRequestLabel.userId = "" 556 | friendRequestLabel.message = "" 557 | addFriendResultLabel.userId = userId 558 | addFriendResultLabel.success = false 559 | } 560 | } 561 | } 562 | 563 | -------------------------------------------------------------------------------- /app/ubuntu-tox-client.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | _Name=ubuntu-tox-client 3 | Comment=Tox client 4 | Exec=@EXEC@ 5 | Icon=@ICON@ 6 | Terminal=false 7 | Type=Application 8 | X-Ubuntu-Touch=true 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/ui/AboutPage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | import QtQuick 2.3 21 | import Ubuntu.Components 1.1 22 | import Ubuntu.Components.ListItems 1.0 as ListItem 23 | 24 | Page { 25 | id: aboutPage 26 | title: i18n.tr("About ubuntu-tox-client") 27 | visible:false 28 | 29 | Flickable { 30 | id: flickable 31 | anchors.fill: parent 32 | clip: true 33 | 34 | contentHeight: aboutColumn.height + aboutColumn.marginTop 35 | 36 | Column { 37 | id: aboutColumn 38 | width: parent.width 39 | property real marginTop: units.gu(3) 40 | y: marginTop 41 | 42 | UbuntuShape { 43 | property real maxWidth: units.gu(45) 44 | anchors.horizontalCenter: parent.horizontalCenter 45 | width: Math.min(parent.width, maxWidth)/2 46 | height: Math.min(parent.width, maxWidth)/2 47 | image: Image { 48 | source: "../graphics/ubuntu-tox-client.png" 49 | smooth: true 50 | fillMode: Image.PreserveAspectFit 51 | } 52 | } 53 | 54 | Item { 55 | id: spacer 56 | width: parent.width 57 | height: units.gu(2) 58 | } 59 | 60 | ListItem.Header { 61 | text: i18n.tr("Info:") 62 | } 63 | 64 | ListItem.Standard { 65 | text: i18n.tr("Version:") 66 | control: Label { 67 | text: "0.0.2" 68 | } 69 | } 70 | 71 | ListItem.Header { 72 | text: i18n.tr("Development:") 73 | } 74 | 75 | ListItem.Standard { 76 | text: i18n.tr("License:") 77 | control: Label { 78 | text: "GPL v3" 79 | } 80 | progression: true 81 | onClicked: Qt.openUrlExternally("http://www.gnu.org/licenses/gpl-3.0.txt") 82 | } 83 | 84 | ListItem.Standard { 85 | text: i18n.tr("Source code & bug tracker:") 86 | control: Label { 87 | text: "Github" 88 | } 89 | progression: true 90 | onClicked: Qt.openUrlExternally("https://github.com/nikwen/ubuntu-tox-client") 91 | } 92 | 93 | ListItem.Header { 94 | text: i18n.tr("Authors:") 95 | } 96 | 97 | ListItem.Standard { 98 | text: "Niklas Wenzel" 99 | control: Label { 100 | text: i18n.tr("Maintainer") 101 | } 102 | } 103 | 104 | ListItem.Header { 105 | text: i18n.tr("Contact:") 106 | } 107 | 108 | ListItem.Standard { 109 | text: "nikwen.developer@gmail.com" 110 | progression: true 111 | onClicked: Qt.openUrlExternally("mailto:nikwen.developer@gmail.com") 112 | } 113 | 114 | ListItem.Header { 115 | text: i18n.tr("Uses the following libraries:") 116 | } 117 | 118 | ListItem.Standard { 119 | text: "toxcore" 120 | control: Label { 121 | text: "GPL v3" 122 | } 123 | progression: true 124 | onClicked: Qt.openUrlExternally("https://github.com/irungentoo/toxcore") 125 | } 126 | 127 | ListItem.Standard { 128 | text: "libsodium" 129 | control: Label { 130 | text: i18n.tr("ISC license") 131 | } 132 | progression: true 133 | onClicked: Qt.openUrlExternally("https://github.com/jedisct1/libsodium") 134 | } 135 | 136 | ListItem.Header { 137 | text: i18n.tr("Uses code from the following projects:") 138 | } 139 | 140 | ListItem.Standard { 141 | text: "qTox" 142 | control: Label { 143 | text: "GPL v3" 144 | } 145 | progression: true 146 | onClicked: Qt.openUrlExternally("https://github.com/tux3/qTox") 147 | } 148 | 149 | ListItem.Standard { 150 | text: "uTox" 151 | control: Label { 152 | text: "GPL v3" 153 | } 154 | progression: true 155 | onClicked: Qt.openUrlExternally("https://github.com/notsecure/uTox") 156 | } 157 | 158 | ListItem.Empty { 159 | id: toxWebsiteItem 160 | width: parent.width 161 | height: units.gu(9) 162 | divider.visible: false 163 | 164 | onClicked: Qt.openUrlExternally("https://tox.im") 165 | 166 | Image { 167 | height: units.gu(6) 168 | anchors.centerIn: parent 169 | source: "../graphics/tox_logo.png" //TODO: svg file? 170 | smooth: true 171 | fillMode: Image.PreserveAspectFit 172 | } 173 | } 174 | } 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /app/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB UI_QML_JS_FILES *.qml *.js) 2 | 3 | # Make the files visible in the qtcreator tree 4 | add_custom_target(ubuntu-tox-client_ui_QMlFiles ALL SOURCES ${UI_QML_JS_FILES}) 5 | 6 | install(FILES ${UI_QML_JS_FILES} DESTINATION ${UBUNTU-TOX-CLIENT_DIR}/ui) 7 | 8 | -------------------------------------------------------------------------------- /backend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${CMAKE_CURRENT_SOURCE_DIR} 3 | ) 4 | 5 | include_directories( 6 | ${CMAKE_CURRENT_SOURCE_DIR}/modules/UbuntuToxClient/include/ 7 | ) 8 | 9 | 10 | set( 11 | UbuntuToxClientbackend_SRCS 12 | modules/UbuntuToxClient/backend.cpp 13 | modules/UbuntuToxClient/toxbackend.cpp 14 | modules/UbuntuToxClient/cdata.cpp 15 | modules/UbuntuToxClient/cstring.cpp 16 | modules/UbuntuToxClient/contactsmodel.cpp 17 | modules/UbuntuToxClient/friend.cpp 18 | modules/UbuntuToxClient/bootstrapnodes.h 19 | ) 20 | 21 | add_library(UbuntuToxClientbackend MODULE 22 | ${UbuntuToxClientbackend_SRCS} 23 | ) 24 | 25 | set_target_properties(UbuntuToxClientbackend PROPERTIES 26 | LIBRARY_OUTPUT_DIRECTORY UbuntuToxClient) 27 | 28 | qt5_use_modules(UbuntuToxClientbackend Gui Qml Quick) 29 | 30 | # Set architecture 31 | 32 | option(FOR_ARMHF "Build for the armhf architecture" off) 33 | option(FOR_I386 "Build for the i386 architecture" off) 34 | option(FOR_AMD64 "Build for the amd64 architecture" off) 35 | 36 | if(FOR_I386) 37 | message(STATUS "Compile for i386") 38 | set(ARCH_DIR_NAME i386) 39 | elseif(FOR_AMD64) 40 | message(STATUS "Compile for amd64") 41 | set(ARCH_DIR_NAME amd64) 42 | else(FOR_I386) 43 | message(STATUS "Compile for armhf") 44 | set(ARCH_DIR_NAME armhf) 45 | set(FOR_ARMHF on) 46 | endif(FOR_I386) 47 | 48 | # Link toxcore library 49 | target_link_libraries(UbuntuToxClientbackend ${CMAKE_CURRENT_SOURCE_DIR}/modules/UbuntuToxClient/libs/${ARCH_DIR_NAME}/libtoxcore.so) 50 | 51 | # Copy qmldir file to build dir for running in QtCreator 52 | add_custom_target(UbuntuToxClientbackend-qmldir ALL 53 | COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/modules/UbuntuToxClient/qmldir ${CMAKE_CURRENT_BINARY_DIR}/UbuntuToxClient 54 | DEPENDS ${QMLFILES} 55 | ) 56 | 57 | # Install plugin file 58 | install(TARGETS UbuntuToxClientbackend DESTINATION ${QT_IMPORTS_DIR}/UbuntuToxClient/) 59 | install(FILES modules/UbuntuToxClient/qmldir DESTINATION ${QT_IMPORTS_DIR}/UbuntuToxClient/) 60 | 61 | # Install libsodium library 62 | install(FILES modules/UbuntuToxClient/libs/${ARCH_DIR_NAME}/libsodium.so DESTINATION ${QT_IMPORTS_DIR}/) 63 | install(FILES modules/UbuntuToxClient/libs/${ARCH_DIR_NAME}/libsodium.so.13 DESTINATION ${QT_IMPORTS_DIR}/) 64 | install(FILES modules/UbuntuToxClient/libs/${ARCH_DIR_NAME}/libsodium.so.13.0.2 DESTINATION ${QT_IMPORTS_DIR}/) 65 | 66 | # Install toxcore library 67 | install(FILES modules/UbuntuToxClient/libs/${ARCH_DIR_NAME}/libtoxcore.so DESTINATION ${QT_IMPORTS_DIR}/) 68 | install(FILES modules/UbuntuToxClient/libs/${ARCH_DIR_NAME}/libtoxcore.so.0 DESTINATION ${QT_IMPORTS_DIR}/) 69 | install(FILES modules/UbuntuToxClient/libs/${ARCH_DIR_NAME}/libtoxcore.so.0.0.0 DESTINATION ${QT_IMPORTS_DIR}/) 70 | 71 | ## Use C++11 72 | include(CheckCXXCompilerFlag) 73 | CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) 74 | CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) 75 | if(COMPILER_SUPPORTS_CXX11) 76 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 77 | elseif(COMPILER_SUPPORTS_CXX0X) 78 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") 79 | else() 80 | message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") 81 | endif() 82 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/backend.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include "backend.h" 23 | #include "toxbackend.h" 24 | #include "contactsmodel.h" 25 | 26 | 27 | void BackendPlugin::registerTypes(const char *uri) 28 | { 29 | Q_ASSERT(uri == QLatin1String("UbuntuToxClient")); 30 | 31 | qmlRegisterType(uri, 1, 0, "ToxBackend"); 32 | qmlRegisterType(uri, 1, 0, "ContactsModel"); 33 | } 34 | 35 | void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri) 36 | { 37 | QQmlExtensionPlugin::initializeEngine(engine, uri); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/backend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef BACKEND_PLUGIN_H 21 | #define BACKEND_PLUGIN_H 22 | 23 | #include 24 | #include 25 | 26 | class BackendPlugin : public QQmlExtensionPlugin 27 | { 28 | Q_OBJECT 29 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 30 | 31 | public: 32 | void registerTypes(const char *uri); 33 | void initializeEngine(QQmlEngine *engine, const char *uri); 34 | }; 35 | #endif // BACKEND_PLUGIN_H 36 | 37 | 38 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/bootstrapnodes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | struct BootstrapNode { 21 | char *address; 22 | uint16_t port; 23 | uint8_t key[32]; 24 | } bootstrapNodes[] = { 25 | { 26 | (char *) "192.254.75.102", 27 | 33445, 28 | { 29 | 0x95, 0x1C, 0x88, 0xB7, 0xE7, 0x5C, 0x86, 0x74, 0x18, 0xAC, 0xDB, 0x5D, 0x27, 0x38, 0x21, 0x37, 30 | 0x2B, 0xB5, 0xBD, 0x65, 0x27, 0x40, 0xBC, 0xDF, 0x62, 0x3A, 0x4F, 0xA2, 0x93, 0xE7, 0x5D, 0x2F 31 | } 32 | }, 33 | { 34 | (char *) "144.76.60.215", 35 | 33445, 36 | { 37 | 0x04, 0x11, 0x9E, 0x83, 0x5D, 0xF3, 0xE7, 0x8B, 0xAC, 0xF0, 0xF8, 0x42, 0x35, 0xB3, 0x00, 0x54, 38 | 0x6A, 0xF8, 0xB9, 0x36, 0xF0, 0x35, 0x18, 0x5E, 0x2A, 0x8E, 0x9E, 0x0A, 0x67, 0xC8, 0x92, 0x4F 39 | } 40 | }, 41 | { 42 | (char *) "23.226.230.47", 43 | 33445, 44 | { 45 | 0xA0, 0x91, 0x62, 0xD6, 0x86, 0x18, 0xE7, 0x42, 0xFF, 0xBC, 0xA1, 0xC2, 0xC7, 0x03, 0x85, 0xE6, 46 | 0x67, 0x96, 0x04, 0xB2, 0xD8, 0x0E, 0xA6, 0xE8, 0x4A, 0xD0, 0x99, 0x6A, 0x1A, 0xC8, 0xA0, 0x74 47 | } 48 | }, 49 | { 50 | (char *) "178.62.125.224", 51 | 33445, 52 | { 53 | 0x10, 0xB2, 0x0C, 0x49, 0xAC, 0xBD, 0x96, 0x8D, 0x7C, 0x80, 0xF2, 0xE8, 0x43, 0x8F, 0x92, 0xEA, 54 | 0x51, 0xF1, 0x89, 0xF4, 0xE7, 0x0C, 0xFB, 0xBB, 0x2C, 0x2C, 0x8C, 0x79, 0x9E, 0x97, 0xF0, 0x3E 55 | } 56 | }, 57 | { 58 | (char *) "178.21.112.187", 59 | 33445, 60 | { 61 | 0x4B, 0x2C, 0x19, 0xE9, 0x24, 0x97, 0x2C, 0xB9, 0xB5, 0x77, 0x32, 0xFB, 0x17, 0x2F, 0x8A, 0x86, 62 | 0x04, 0xDE, 0x13, 0xEE, 0xDA, 0x2A, 0x62, 0x34, 0xE3, 0x48, 0x98, 0x33, 0x44, 0xB2, 0x30, 0x57 63 | } 64 | }, 65 | { 66 | (char *) "195.154.119.113", 67 | 33445, 68 | { 69 | 0xE3, 0x98, 0xA6, 0x96, 0x46, 0xB8, 0xCE, 0xAC, 0xA9, 0xF0, 0xB8, 0x4F, 0x55, 0x37, 0x26, 0xC1, 70 | 0xC4, 0x92, 0x70, 0x55, 0x8C, 0x57, 0xDF, 0x5F, 0x3C, 0x36, 0x8F, 0x05, 0xA7, 0xD7, 0x13, 0x54 71 | } 72 | }, 73 | { 74 | (char *) "192.210.149.121", 75 | 33445, 76 | { 77 | 0xF4, 0x04, 0xAB, 0xAA, 0x1C, 0x99, 0xA9, 0xD3, 0x7D, 0x61, 0xAB, 0x54, 0x89, 0x8F, 0x56, 0x79, 78 | 0x3E, 0x1D, 0xEF, 0x8B, 0xD4, 0x6B, 0x10, 0x38, 0xB9, 0xD8, 0x22, 0xE8, 0x46, 0x0F, 0xAB, 0x67 79 | } 80 | }, 81 | { 82 | (char *) "104.219.184.206", 83 | 443, 84 | { 85 | 0x8C, 0xD0, 0x87, 0xE3, 0x1C, 0x67, 0x56, 0x81, 0x03, 0xE8, 0xC2, 0xA2, 0x86, 0x53, 0x33, 0x7E, 86 | 0x90, 0xE6, 0xB8, 0xED, 0xA0, 0xD7, 0x65, 0xD5, 0x7C, 0x6B, 0x51, 0x72, 0xB4, 0xF1, 0xF0, 0x4C 87 | } 88 | }, 89 | { 90 | (char *) "76.191.23.96", 91 | 33445, 92 | { 93 | 0x93, 0x57, 0x4A, 0x3F, 0xAB, 0x7D, 0x61, 0x2F, 0xEA, 0x29, 0xFD, 0x8D, 0x67, 0xD3, 0xDD, 0x10, 94 | 0xDF, 0xD0, 0x7A, 0x07, 0x5A, 0x5D, 0x62, 0xE8, 0xAF, 0x3D, 0xD9, 0xF5, 0xD0, 0x93, 0x2E, 0x11 95 | } 96 | }, 97 | { 98 | (char *) "46.38.239.179", 99 | 33445, 100 | { 101 | 0xF5, 0xA1, 0xA3, 0x8E, 0xFB, 0x6B, 0xD3, 0xC2, 0xC8, 0xAF, 0x8B, 0x10, 0xD8, 0x5F, 0x0F, 0x89, 102 | 0xE9, 0x31, 0x70, 0x4D, 0x34, 0x9F, 0x1D, 0x07, 0x20, 0xC3, 0xC4, 0x05, 0x9A, 0xF2, 0x44, 0x0A 103 | } 104 | }, 105 | { 106 | (char *) "178.62.250.138", 107 | 33445, 108 | { 109 | 0x78, 0x82, 0x36, 0xD3, 0x49, 0x78, 0xD1, 0xD5, 0xBD, 0x82, 0x2F, 0x0A, 0x5B, 0xEB, 0xD2, 0xC5, 110 | 0x3C, 0x64, 0xCC, 0x31, 0xCD, 0x31, 0x49, 0x35, 0x0E, 0xE2, 0x7D, 0x4D, 0x9A, 0x2F, 0x9B, 0x6B 111 | } 112 | }, 113 | { 114 | (char *) "78.225.128.39", 115 | 33445, 116 | { 117 | 0x7A, 0x23, 0x06, 0xBF, 0xBA, 0x66, 0x5E, 0x54, 0x80, 0xAE, 0x59, 0xB3, 0x1E, 0x11, 0x6B, 0xE9, 118 | 0xC0, 0x4D, 0xCE, 0xFE, 0x04, 0xD9, 0xFE, 0x25, 0x08, 0x23, 0x16, 0xFA, 0x34, 0xB4, 0xDA, 0x0C 119 | } 120 | }, 121 | { 122 | (char *) "130.133.110.14", 123 | 33445, 124 | { 125 | 0x46, 0x1F, 0xA3, 0x77, 0x6E, 0xF0, 0xFA, 0x65, 0x5F, 0x1A, 0x05, 0x47, 0x7D, 0xF1, 0xB3, 0xB6, 126 | 0x14, 0xF7, 0xD6, 0xB1, 0x24, 0xF7, 0xDB, 0x1D, 0xD4, 0xFE, 0x3C, 0x08, 0xB0, 0x3B, 0x64, 0x0F 127 | } 128 | }, 129 | { 130 | (char *) "104.167.101.29", 131 | 33445, 132 | { 133 | 0x59, 0x18, 0xAC, 0x3C, 0x06, 0x95, 0x59, 0x62, 0xA7, 0x5A, 0xD7, 0xDF, 0x4F, 0x80, 0xA5, 0xD7, 134 | 0xC3, 0x4F, 0x7D, 0xB9, 0xE1, 0x49, 0x8D, 0x2E, 0x04, 0x95, 0xDE, 0x35, 0xB3, 0xFE, 0x8A, 0x57 135 | } 136 | }, 137 | { 138 | (char *) "195.154.109.148", 139 | 33445, 140 | { 141 | 0x39, 0x1C, 0x96, 0xCB, 0x67, 0xAE, 0x89, 0x3D, 0x47, 0x82, 0xB8, 0xE4, 0x49, 0x5E, 0xB9, 0xD8, 142 | 0x9C, 0xF1, 0x03, 0x1F, 0x48, 0x46, 0x0C, 0x06, 0x07, 0x5A, 0xA8, 0xCE, 0x76, 0xD5, 0x0A, 0x21 143 | } 144 | }, 145 | { 146 | (char *) "205.185.116.116", 147 | 33445, 148 | { 149 | 0xA1, 0x79, 0xB0, 0x97, 0x49, 0xAC, 0x82, 0x6F, 0xF0, 0x1F, 0x37, 0xA9, 0x61, 0x3F, 0x6B, 0x57, 150 | 0x11, 0x8A, 0xE0, 0x14, 0xD4, 0x19, 0x6A, 0x0E, 0x11, 0x05, 0xA9, 0x8F, 0x93, 0xA5, 0x47, 0x02 151 | } 152 | }, 153 | { 154 | (char *) "198.98.51.198", 155 | 33445, 156 | { 157 | 0x1D, 0x5A, 0x5F, 0x2F, 0x5D, 0x62, 0x33, 0x05, 0x8B, 0xF0, 0x25, 0x9B, 0x09, 0x62, 0x2F, 0xB4, 158 | 0x0B, 0x48, 0x2E, 0x4F, 0xA0, 0x93, 0x1E, 0xB8, 0xFD, 0x3A, 0xB8, 0xE7, 0xBF, 0x7D, 0xAF, 0x6F 159 | } 160 | }, 161 | { 162 | (char *) "80.232.246.79", 163 | 33445, 164 | { 165 | 0x2A, 0x54, 0xDE, 0x1B, 0x6F, 0xE5, 0x67, 0xF1, 0x63, 0xEE, 0xBF, 0x0B, 0x42, 0xA6, 0x86, 0xD7, 166 | 0xC9, 0x90, 0x00, 0x5B, 0x43, 0x32, 0xDF, 0x10, 0xCF, 0x18, 0x40, 0x60, 0xF7, 0xF6, 0x43, 0x59 167 | } 168 | }, 169 | }; 170 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/cdata.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /* 21 | Copyright (C) 2013 by Maxim Biro 22 | 23 | This file is part of Tox Qt GUI. 24 | 25 | This program is free software: you can redistribute it and/or modify 26 | it under the terms of the GNU General Public License as published by 27 | the Free Software Foundation, either version 3 of the License, or 28 | (at your option) any later version. 29 | This program is distributed in the hope that it will be useful, 30 | but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 32 | 33 | See the COPYING file for more details. 34 | */ 35 | 36 | #include "cdata.h" 37 | #include 38 | #include 39 | 40 | // CData 41 | 42 | CData::CData(const QString &data, uint16_t byteSize) 43 | { 44 | cData = new uint8_t[byteSize+1]; 45 | cDataSize = fromString(data, cData); 46 | } 47 | 48 | CData::~CData() 49 | { 50 | delete[] cData; 51 | } 52 | 53 | uint8_t* CData::data() 54 | { 55 | return cData; 56 | } 57 | 58 | uint16_t CData::size() 59 | { 60 | return cDataSize; 61 | } 62 | 63 | QString CData::toString(const uint8_t *cData, const uint16_t cDataSize) 64 | { 65 | return QString(QByteArray(reinterpret_cast(cData), cDataSize).toHex()).toUpper(); 66 | } 67 | 68 | uint16_t CData::fromString(const QString& data, uint8_t* cData) 69 | { 70 | QByteArray arr = QByteArray::fromHex(data.toLower().toLatin1()); 71 | memcpy(cData, reinterpret_cast(arr.data()), arr.size()); 72 | return arr.size(); 73 | } 74 | 75 | 76 | // CUserId 77 | 78 | const uint16_t CUserId::SIZE{TOX_CLIENT_ID_SIZE}; 79 | 80 | CUserId::CUserId(const QString &userId) : 81 | CData(userId, SIZE < userId.size() ? userId.size() : SIZE) 82 | { 83 | // intentionally left empty 84 | } 85 | 86 | QString CUserId::toString(const uint8_t* cUserId) 87 | { 88 | return CData::toString(cUserId, SIZE); 89 | } 90 | 91 | 92 | // CFriendAddress 93 | 94 | const uint16_t CFriendAddress::SIZE{TOX_FRIEND_ADDRESS_SIZE}; 95 | 96 | CFriendAddress::CFriendAddress(const QString &friendAddress) : 97 | CData(friendAddress, SIZE) 98 | { 99 | // intentionally left empty 100 | } 101 | 102 | QString CFriendAddress::toString(const uint8_t *cFriendAddress) 103 | { 104 | return CData::toString(cFriendAddress, SIZE); 105 | } 106 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/cdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /* 21 | Copyright (C) 2013 by Maxim Biro 22 | 23 | This file is part of Tox Qt GUI. 24 | 25 | This program is free software: you can redistribute it and/or modify 26 | it under the terms of the GNU General Public License as published by 27 | the Free Software Foundation, either version 3 of the License, or 28 | (at your option) any later version. 29 | This program is distributed in the hope that it will be useful, 30 | but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 32 | 33 | See the COPYING file for more details. 34 | */ 35 | 36 | #ifndef CDATA_H 37 | #define CDATA_H 38 | 39 | #include 40 | 41 | class QString; 42 | class CData 43 | { 44 | public: 45 | uint8_t* data(); 46 | uint16_t size(); 47 | 48 | protected: 49 | explicit CData(const QString& data, uint16_t byteSize); 50 | virtual ~CData(); 51 | 52 | static QString toString(const uint8_t* cData, const uint16_t cDataSize); 53 | 54 | private: 55 | uint8_t* cData; 56 | uint16_t cDataSize; 57 | 58 | static uint16_t fromString(const QString& userId, uint8_t* cData); 59 | }; 60 | 61 | class CUserId : public CData 62 | { 63 | public: 64 | explicit CUserId(const QString& userId); 65 | 66 | static QString toString(const uint8_t *cUserId); 67 | 68 | private: 69 | static const uint16_t SIZE; 70 | 71 | }; 72 | 73 | class CFriendAddress : public CData 74 | { 75 | public: 76 | explicit CFriendAddress(const QString& friendAddress); 77 | 78 | static QString toString(const uint8_t* cFriendAddress); 79 | 80 | private: 81 | static const uint16_t SIZE; 82 | 83 | }; 84 | 85 | #endif // CDATA_H 86 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/contactsmodel.cpp: -------------------------------------------------------------------------------- 1 | #include "contactsmodel.h" 2 | 3 | #include 4 | 5 | #include "cstring.h" 6 | #include "cdata.h" 7 | 8 | ContactsModel::ContactsModel(QObject *parent) : 9 | QAbstractListModel(parent), 10 | friendList(QList()) 11 | { 12 | connect(this, &ContactsModel::backendChanged, this, &ContactsModel::init); 13 | } 14 | 15 | int ContactsModel::rowCount(const QModelIndex &parent) const { 16 | if (tox == nullptr) 17 | return 0; 18 | 19 | return friendList.size(); 20 | } 21 | 22 | QHash ContactsModel::roleNames() const { 23 | QHash roles; 24 | roles[Qt::DisplayRole] = "name"; 25 | roles[ContactsModel::StatusMessageRole] = "statusMessage"; 26 | return roles; 27 | } 28 | 29 | QVariant ContactsModel::data(const QModelIndex &index, int role) const 30 | { 31 | if (tox == nullptr) 32 | return QVariant(); 33 | 34 | if (!index.isValid()) 35 | return QVariant(); 36 | 37 | if (index.row() >= tox_count_friendlist(tox)) 38 | return QVariant(); 39 | 40 | Friend f = friendList.at(index.row()); 41 | 42 | switch (role) { 43 | case Qt::DisplayRole: { 44 | QString name = f.getName(); 45 | return (name.size() != 0) ? name : f.getClientId(); 46 | } 47 | case ContactsModel::StatusMessageRole: 48 | return f.getStatusMessage(); 49 | default: 50 | return QVariant(); 51 | } 52 | } 53 | 54 | void ContactsModel::init() { 55 | if (backend == nullptr) 56 | return; 57 | 58 | qDebug() << "Got backend"; 59 | tox = backend->getToxObject(); 60 | 61 | qDebug() << "Getting friends..."; 62 | 63 | //Clear friend list 64 | friendList.clear(); 65 | 66 | //Get friends 67 | 68 | const uint32_t friendCount = tox_count_friendlist(tox); 69 | if (friendCount > 0) { 70 | //Get the list of friend ids 71 | int32_t *ids = new int32_t[friendCount]; 72 | tox_get_friendlist(tox, ids, friendCount); 73 | 74 | //Create new friend objects for all retrieved friends 75 | for (int32_t i = 0; i < static_cast(friendCount); ++i) { 76 | addFriendToModel(ids[i], ""); 77 | } 78 | delete[] ids; 79 | } 80 | 81 | qDebug() << "ContactsModel init() finished"; 82 | 83 | connect(this, &ContactsModel::friendNameChanged, this, &ContactsModel::setFriendName); 84 | connect(this, &ContactsModel::friendStatusMessageChanged, this, &ContactsModel::setFriendStatusMessage); 85 | 86 | connect(backend, &ToxBackend::friendAdded, this, &ContactsModel::addFriendToModel); 87 | 88 | tox_callback_friend_action(tox, onFriendAction, this); 89 | tox_callback_name_change(tox, onFriendNameChange, this); 90 | tox_callback_status_message(tox, onFriendStatusMessageChanged, this); 91 | } 92 | 93 | void ContactsModel::setFriendName(int id, QString name) { 94 | //Get friend with given id from friend list 95 | Friend f; int i; 96 | for (i = 0; i < friendList.size(); i++) { 97 | f = friendList[i]; 98 | if (f.getFriendId() == id) { 99 | break; 100 | } 101 | } 102 | 103 | if (i >= friendList.size()) 104 | return; 105 | 106 | //Set name and replace in list 107 | f.setName(name); 108 | friendList[i] = f; 109 | 110 | //Notify ListView of changes 111 | QModelIndex updateIndex = index(i, 0, QModelIndex()); 112 | emit dataChanged(updateIndex, updateIndex); 113 | } 114 | 115 | void ContactsModel::setFriendStatusMessage(int id, QString message) { 116 | //Get friend with given id from friend list 117 | Friend f; int i; 118 | for (i = 0; i < friendList.size(); i++) { 119 | f = friendList[i]; 120 | if (f.getFriendId() == id) { 121 | break; 122 | } 123 | } 124 | 125 | if (i >= friendList.size()) 126 | return; 127 | 128 | //Set name and replace in list 129 | f.setStatusMessage(message); 130 | friendList[i] = f; 131 | 132 | //Notify ListView of changes 133 | QModelIndex updateIndex = index(i, 0, QModelIndex()); 134 | emit dataChanged(updateIndex, updateIndex); 135 | } 136 | 137 | void ContactsModel::onFriendAction(Tox*/* tox*/, int friendId, const uint8_t *cMessage, uint16_t cMessageSize, void *model) { 138 | emit static_cast(model)->friendMessageReceived(friendId, CString::toString(cMessage, cMessageSize), true); 139 | } 140 | 141 | void ContactsModel::onFriendNameChange(Tox*/* tox*/, int friendId, const uint8_t* cName, uint16_t cNameSize, void* model) { 142 | emit static_cast(model)->friendNameChanged(friendId, CString::toString(cName, cNameSize)); 143 | } 144 | 145 | void ContactsModel::onFriendStatusMessageChanged(Tox*/* tox*/, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* model) { 146 | emit static_cast(model)->friendStatusMessageChanged(friendId, CString::toString(cMessage, cMessageSize)); 147 | } 148 | 149 | void ContactsModel::addFriendToModel(int friendId, const QString &userId) { 150 | uint8_t clientId[TOX_CLIENT_ID_SIZE]; 151 | 152 | if (tox_get_client_id(tox, friendId, clientId) == 0) { 153 | Friend f; 154 | f.setFriendId(friendId); 155 | f.setClientId(CUserId::toString(clientId)); 156 | 157 | //Get the friend's name 158 | const int nameSize = tox_get_name_size(tox, friendId); 159 | if (nameSize > 0) { 160 | uint8_t *name = new uint8_t[nameSize]; 161 | if (tox_get_name(tox, friendId, name) == nameSize) { 162 | f.setName(CString::toString(name, nameSize)); 163 | } 164 | delete[] name; 165 | } 166 | 167 | //Get the friend's status message 168 | const int statusMessageSize = tox_get_status_message_size(tox, friendId); 169 | if (statusMessageSize > 0) { 170 | uint8_t *statusMessage = new uint8_t[statusMessageSize]; 171 | if (tox_get_status_message(tox, friendId, statusMessage, statusMessageSize) == statusMessageSize) { 172 | f.setStatusMessage(CString::toString(statusMessage, statusMessageSize)); 173 | } 174 | delete[] statusMessage; 175 | } 176 | 177 | beginInsertRows(QModelIndex(), rowCount(), rowCount()); 178 | 179 | //Add friend to friend list 180 | friendList << f; 181 | 182 | endInsertRows(); 183 | 184 | qDebug() << "Added friend"; 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/contactsmodel.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTACTSMODEL_H 2 | #define CONTACTSMODEL_H 3 | 4 | #include 5 | 6 | #include "tox/tox.h" 7 | #include "toxbackend.h" 8 | #include "friend.h" 9 | 10 | class ContactsModel : public QAbstractListModel 11 | { 12 | Q_OBJECT 13 | Q_PROPERTY(ToxBackend *toxBackend MEMBER backend NOTIFY backendChanged) 14 | 15 | public: 16 | explicit ContactsModel(QObject *parent = 0); 17 | 18 | int rowCount(const QModelIndex &parent = QModelIndex()) const; 19 | QVariant data(const QModelIndex &index, int role) const; 20 | 21 | signals: 22 | void backendChanged(); 23 | 24 | void friendMessageReceived(int friendId, const QString& message, bool isAction); 25 | void friendNameChanged(int friendId, const QString& name); 26 | void friendStatusMessageChanged(int friendId, const QString& message); 27 | 28 | public slots: 29 | void init(); 30 | 31 | void setFriendName(int id, QString name); 32 | void setFriendStatusMessage(int id, QString message); 33 | 34 | void addFriendToModel(int friendId, const QString& userId); 35 | 36 | protected: 37 | QHash roleNames() const; 38 | 39 | private: 40 | ToxBackend *backend; 41 | Tox *tox = nullptr; 42 | 43 | QList friendList; 44 | 45 | static void onFriendAction(Tox*/* tox*/, int friendId, const uint8_t *cMessage, uint16_t cMessageSize, void *model); 46 | static void onFriendNameChange(Tox* tox, int friendId, const uint8_t* cName, uint16_t cNameSize, void* model); 47 | static void onFriendStatusMessageChanged(Tox* tox, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* model); 48 | 49 | enum Roles { 50 | StatusMessageRole = Qt::UserRole+100, 51 | }; 52 | 53 | 54 | }; 55 | 56 | #endif // CONTACTSMODEL_H 57 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/cstring.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /* 21 | Copyright (C) 2013 by Maxim Biro 22 | 23 | This file is part of Tox Qt GUI. 24 | 25 | This program is free software: you can redistribute it and/or modify 26 | it under the terms of the GNU General Public License as published by 27 | the Free Software Foundation, either version 3 of the License, or 28 | (at your option) any later version. 29 | This program is distributed in the hope that it will be useful, 30 | but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 32 | 33 | See the COPYING file for more details. 34 | */ 35 | 36 | #include "cstring.h" 37 | #include 38 | 39 | CString::CString(const QString& string) : 40 | CString(string.toUtf8()) 41 | { 42 | } 43 | 44 | CString::CString(const QByteArray& ba_string) 45 | { 46 | cString = new uint8_t[ba_string.size()](); 47 | cStringSize = ba_string.size(); 48 | memcpy(cString, reinterpret_cast(ba_string.data()), cStringSize); 49 | } 50 | 51 | CString::CString(const CString &cstr) 52 | { 53 | cStringSize = cstr.cStringSize; 54 | cString = new uint8_t[cStringSize](); 55 | memcpy(cString, cstr.cString, cStringSize); 56 | } 57 | 58 | CString::~CString() 59 | { 60 | delete[] cString; 61 | } 62 | 63 | uint8_t* CString::data() 64 | { 65 | return cString; 66 | } 67 | 68 | uint16_t CString::size() 69 | { 70 | return cStringSize; 71 | } 72 | 73 | QString CString::toString(const uint8_t* cString, uint16_t cStringSize) 74 | { 75 | return QString::fromUtf8(reinterpret_cast(cString), cStringSize); 76 | } 77 | 78 | uint16_t CString::fromString(const QString& string, uint8_t* cString) 79 | { 80 | QByteArray byteArray = QByteArray(string.toUtf8()); 81 | memcpy(cString, reinterpret_cast(byteArray.data()), byteArray.size()); 82 | return byteArray.size(); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/cstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /* 21 | Copyright (C) 2013 by Maxim Biro 22 | 23 | This file is part of Tox Qt GUI. 24 | 25 | This program is free software: you can redistribute it and/or modify 26 | it under the terms of the GNU General Public License as published by 27 | the Free Software Foundation, either version 3 of the License, or 28 | (at your option) any later version. 29 | This program is distributed in the hope that it will be useful, 30 | but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 32 | 33 | See the COPYING file for more details. 34 | */ 35 | 36 | #ifndef CSTRING_H 37 | #define CSTRING_H 38 | 39 | #include 40 | 41 | class QString; 42 | class QByteArray; 43 | 44 | class CString 45 | { 46 | public: 47 | explicit CString(const QString& string); 48 | explicit CString(const QByteArray& ba_string); 49 | explicit CString(const CString& cstr); 50 | ~CString(); 51 | 52 | uint8_t* data(); 53 | uint16_t size(); 54 | 55 | static QString toString(const uint8_t* cMessage, const uint16_t cMessageSize); 56 | static uint16_t fromString(const QString& message, uint8_t* cMessage); 57 | 58 | private: 59 | const static int MAX_SIZE_OF_UTF8_ENCODED_CHARACTER = 4; 60 | 61 | uint8_t* cString; 62 | uint16_t cStringSize; 63 | }; 64 | #endif // CSTRING_H 65 | 66 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/friend.cpp: -------------------------------------------------------------------------------- 1 | #include "friend.h" 2 | 3 | Friend::Friend() : 4 | name(""), 5 | statusMessage("") 6 | { 7 | } 8 | 9 | Friend::Friend(const Friend& f) 10 | { 11 | setFriendId(f.friendId); 12 | setClientId(f.clientId); 13 | setName(f.name); 14 | setStatusMessage(f.statusMessage); 15 | } 16 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/friend.h: -------------------------------------------------------------------------------- 1 | #ifndef FRIEND_H 2 | #define FRIEND_H 3 | 4 | #include 5 | 6 | class Friend 7 | { 8 | 9 | public: 10 | explicit Friend(); 11 | Friend(const Friend&); 12 | 13 | void setFriendId(int friendId) { this->friendId = friendId; } 14 | void setClientId(QString clientId) { this->clientId = clientId; } 15 | void setName(QString name) { this->name = name; } 16 | void setStatusMessage(QString statusMessage) { this->statusMessage = statusMessage; } 17 | 18 | int getFriendId() { return friendId; } 19 | QString getClientId() { return clientId; } 20 | QString getName() { return name; } 21 | QString getStatusMessage() { return statusMessage; } 22 | 23 | private: 24 | //NOTE: When adding private attributes, make sure to adjust the copy constructor! 25 | int friendId; 26 | QString clientId; 27 | QString name; 28 | QString statusMessage; 29 | 30 | }; 31 | 32 | #endif // FRIEND_H 33 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/include/tox/tox.h: -------------------------------------------------------------------------------- 1 | /* tox.h 2 | * 3 | * The Tox public API. 4 | * 5 | * Copyright (C) 2013 Tox project All Rights Reserved. 6 | * 7 | * This file is part of Tox. 8 | * 9 | * Tox is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Tox is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Tox. If not, see . 21 | * 22 | */ 23 | 24 | #ifndef TOX_H 25 | #define TOX_H 26 | 27 | #include 28 | 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | #define TOX_MAX_NAME_LENGTH 128 35 | 36 | /* Maximum length of single messages after which they should be split. */ 37 | #define TOX_MAX_MESSAGE_LENGTH 1368 38 | #define TOX_MAX_STATUSMESSAGE_LENGTH 1007 39 | #define TOX_MAX_FRIENDREQUEST_LENGTH 1016 40 | 41 | #define TOX_CLIENT_ID_SIZE 32 42 | #define TOX_AVATAR_MAX_DATA_LENGTH 16384 43 | #define TOX_HASH_LENGTH /*crypto_hash_sha256_BYTES*/ 32 44 | 45 | #define TOX_FRIEND_ADDRESS_SIZE (TOX_CLIENT_ID_SIZE + sizeof(uint32_t) + sizeof(uint16_t)) 46 | 47 | #define TOX_ENABLE_IPV6_DEFAULT 1 48 | 49 | #define TOX_ENC_SAVE_MAGIC_NUMBER "toxEsave" 50 | #define TOX_ENC_SAVE_MAGIC_LENGTH 8 51 | 52 | /* Errors for m_addfriend 53 | * FAERR - Friend Add Error 54 | */ 55 | enum { 56 | TOX_FAERR_TOOLONG = -1, 57 | TOX_FAERR_NOMESSAGE = -2, 58 | TOX_FAERR_OWNKEY = -3, 59 | TOX_FAERR_ALREADYSENT = -4, 60 | TOX_FAERR_UNKNOWN = -5, 61 | TOX_FAERR_BADCHECKSUM = -6, 62 | TOX_FAERR_SETNEWNOSPAM = -7, 63 | TOX_FAERR_NOMEM = -8 64 | }; 65 | 66 | /* USERSTATUS - 67 | * Represents userstatuses someone can have. 68 | */ 69 | typedef enum { 70 | TOX_USERSTATUS_NONE, 71 | TOX_USERSTATUS_AWAY, 72 | TOX_USERSTATUS_BUSY, 73 | TOX_USERSTATUS_INVALID 74 | } 75 | TOX_USERSTATUS; 76 | 77 | 78 | /* AVATAR_FORMAT - 79 | * Data formats for user avatar images 80 | */ 81 | typedef enum { 82 | TOX_AVATAR_FORMAT_NONE = 0, 83 | TOX_AVATAR_FORMAT_PNG 84 | } 85 | TOX_AVATAR_FORMAT; 86 | 87 | #ifndef __TOX_DEFINED__ 88 | #define __TOX_DEFINED__ 89 | typedef struct Tox Tox; 90 | #endif 91 | 92 | /* NOTE: Strings in Tox are all UTF-8, (This means that there is no terminating NULL character.) 93 | * 94 | * The exact buffer you send will be received at the other end without modification. 95 | * 96 | * Do not treat Tox strings as C strings. 97 | */ 98 | 99 | /* return TOX_FRIEND_ADDRESS_SIZE byte address to give to others. 100 | * format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] 101 | */ 102 | void tox_get_address(const Tox *tox, uint8_t *address); 103 | 104 | /* Add a friend. 105 | * Set the data that will be sent along with friend request. 106 | * address is the address of the friend (returned by getaddress of the friend you wish to add) it must be TOX_FRIEND_ADDRESS_SIZE bytes. TODO: add checksum. 107 | * data is the data and length is the length (maximum length of data is TOX_MAX_FRIENDREQUEST_LENGTH). 108 | * 109 | * return the friend number if success. 110 | * return TOX_FAERR_TOOLONG if message length is too long. 111 | * return TOX_FAERR_NOMESSAGE if no message (message length must be >= 1 byte). 112 | * return TOX_FAERR_OWNKEY if user's own key. 113 | * return TOX_FAERR_ALREADYSENT if friend request already sent or already a friend. 114 | * return TOX_FAERR_UNKNOWN for unknown error. 115 | * return TOX_FAERR_BADCHECKSUM if bad checksum in address. 116 | * return TOX_FAERR_SETNEWNOSPAM if the friend was already there but the nospam was different. 117 | * (the nospam for that friend was set to the new one). 118 | * return TOX_FAERR_NOMEM if increasing the friend list size fails. 119 | */ 120 | int32_t tox_add_friend(Tox *tox, const uint8_t *address, const uint8_t *data, uint16_t length); 121 | 122 | 123 | /* Add a friend without sending a friendrequest. 124 | * return the friend number if success. 125 | * return -1 if failure. 126 | */ 127 | int32_t tox_add_friend_norequest(Tox *tox, const uint8_t *client_id); 128 | 129 | /* return the friend number associated to that client id. 130 | return -1 if no such friend */ 131 | int32_t tox_get_friend_number(const Tox *tox, const uint8_t *client_id); 132 | 133 | /* Copies the public key associated to that friend id into client_id buffer. 134 | * Make sure that client_id is of size CLIENT_ID_SIZE. 135 | * return 0 if success. 136 | * return -1 if failure. 137 | */ 138 | int tox_get_client_id(const Tox *tox, int32_t friendnumber, uint8_t *client_id); 139 | 140 | /* Remove a friend. 141 | * 142 | * return 0 if success. 143 | * return -1 if failure. 144 | */ 145 | int tox_del_friend(Tox *tox, int32_t friendnumber); 146 | 147 | /* Checks friend's connecting status. 148 | * 149 | * return 1 if friend is connected to us (Online). 150 | * return 0 if friend is not connected to us (Offline). 151 | * return -1 on failure. 152 | */ 153 | int tox_get_friend_connection_status(const Tox *tox, int32_t friendnumber); 154 | 155 | /* Checks if there exists a friend with given friendnumber. 156 | * 157 | * return 1 if friend exists. 158 | * return 0 if friend doesn't exist. 159 | */ 160 | int tox_friend_exists(const Tox *tox, int32_t friendnumber); 161 | 162 | /* Send a text chat message to an online friend. 163 | * 164 | * return the message id if packet was successfully put into the send queue. 165 | * return 0 if it was not. 166 | * 167 | * maximum length of messages is TOX_MAX_MESSAGE_LENGTH, your client must split larger messages 168 | * or else sending them will not work. No the core will not split messages for you because that 169 | * requires me to parse UTF-8. 170 | * 171 | * You will want to retain the return value, it will be passed to your read_receipt callback 172 | * if one is received. 173 | */ 174 | uint32_t tox_send_message(Tox *tox, int32_t friendnumber, const uint8_t *message, uint32_t length); 175 | 176 | /* Send an action to an online friend. 177 | * 178 | * return the message id if packet was successfully put into the send queue. 179 | * return 0 if it was not. 180 | * 181 | * maximum length of actions is TOX_MAX_MESSAGE_LENGTH, your client must split larger actions 182 | * or else sending them will not work. No the core will not split actions for you because that 183 | * requires me to parse UTF-8. 184 | * 185 | * You will want to retain the return value, it will be passed to your read_receipt callback 186 | * if one is received. 187 | */ 188 | uint32_t tox_send_action(Tox *tox, int32_t friendnumber, const uint8_t *action, uint32_t length); 189 | 190 | /* Set our nickname. 191 | * name must be a string of maximum MAX_NAME_LENGTH length. 192 | * length must be at least 1 byte. 193 | * length is the length of name. 194 | * 195 | * return 0 if success. 196 | * return -1 if failure. 197 | */ 198 | int tox_set_name(Tox *tox, const uint8_t *name, uint16_t length); 199 | 200 | /* 201 | * Get your nickname. 202 | * m - The messenger context to use. 203 | * name - needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. 204 | * 205 | * return length of name. 206 | * return 0 on error. 207 | */ 208 | uint16_t tox_get_self_name(const Tox *tox, uint8_t *name); 209 | 210 | /* Get name of friendnumber and put it in name. 211 | * name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. 212 | * 213 | * return length of name if success. 214 | * return -1 if failure. 215 | */ 216 | int tox_get_name(const Tox *tox, int32_t friendnumber, uint8_t *name); 217 | 218 | /* returns the length of name on success. 219 | * returns -1 on failure. 220 | */ 221 | int tox_get_name_size(const Tox *tox, int32_t friendnumber); 222 | int tox_get_self_name_size(const Tox *tox); 223 | 224 | /* Set our user status. 225 | * 226 | * userstatus must be one of TOX_USERSTATUS values. 227 | * max length of the status is TOX_MAX_STATUSMESSAGE_LENGTH. 228 | * 229 | * returns 0 on success. 230 | * returns -1 on failure. 231 | */ 232 | int tox_set_status_message(Tox *tox, const uint8_t *status, uint16_t length); 233 | int tox_set_user_status(Tox *tox, uint8_t userstatus); 234 | 235 | /* returns the length of status message on success. 236 | * returns -1 on failure. 237 | */ 238 | int tox_get_status_message_size(const Tox *tox, int32_t friendnumber); 239 | int tox_get_self_status_message_size(const Tox *tox); 240 | 241 | /* Copy friendnumber's status message into buf, truncating if size is over maxlen. 242 | * Get the size you need to allocate from m_get_statusmessage_size. 243 | * The self variant will copy our own status message. 244 | * 245 | * returns the length of the copied data on success 246 | * retruns -1 on failure. 247 | */ 248 | int tox_get_status_message(const Tox *tox, int32_t friendnumber, uint8_t *buf, uint32_t maxlen); 249 | int tox_get_self_status_message(const Tox *tox, uint8_t *buf, uint32_t maxlen); 250 | 251 | /* return one of TOX_USERSTATUS values. 252 | * Values unknown to your application should be represented as TOX_USERSTATUS_NONE. 253 | * As above, the self variant will return our own TOX_USERSTATUS. 254 | * If friendnumber is invalid, this shall return TOX_USERSTATUS_INVALID. 255 | */ 256 | uint8_t tox_get_user_status(const Tox *tox, int32_t friendnumber); 257 | uint8_t tox_get_self_user_status(const Tox *tox); 258 | 259 | /* returns timestamp of last time friendnumber was seen online, or 0 if never seen. 260 | * returns -1 on error. 261 | */ 262 | uint64_t tox_get_last_online(const Tox *tox, int32_t friendnumber); 263 | 264 | /* Set our typing status for a friend. 265 | * You are responsible for turning it on or off. 266 | * 267 | * returns 0 on success. 268 | * returns -1 on failure. 269 | */ 270 | int tox_set_user_is_typing(Tox *tox, int32_t friendnumber, uint8_t is_typing); 271 | 272 | /* Get the typing status of a friend. 273 | * 274 | * returns 0 if friend is not typing. 275 | * returns 1 if friend is typing. 276 | */ 277 | uint8_t tox_get_is_typing(const Tox *tox, int32_t friendnumber); 278 | 279 | /* Return the number of friends in the instance m. 280 | * You should use this to determine how much memory to allocate 281 | * for copy_friendlist. */ 282 | uint32_t tox_count_friendlist(const Tox *tox); 283 | 284 | /* Return the number of online friends in the instance m. */ 285 | uint32_t tox_get_num_online_friends(const Tox *tox); 286 | 287 | /* Copy a list of valid friend IDs into the array out_list. 288 | * If out_list is NULL, returns 0. 289 | * Otherwise, returns the number of elements copied. 290 | * If the array was too small, the contents 291 | * of out_list will be truncated to list_size. */ 292 | uint32_t tox_get_friendlist(const Tox *tox, int32_t *out_list, uint32_t list_size); 293 | 294 | /* Set the function that will be executed when a friend request is received. 295 | * Function format is function(Tox *tox, const uint8_t * public_key, const uint8_t * data, uint16_t length, void *userdata) 296 | */ 297 | void tox_callback_friend_request(Tox *tox, void (*function)(Tox *tox, const uint8_t *, const uint8_t *, uint16_t, 298 | void *), void *userdata); 299 | 300 | /* Set the function that will be executed when a message from a friend is received. 301 | * Function format is: function(Tox *tox, int32_t friendnumber, const uint8_t * message, uint16_t length, void *userdata) 302 | */ 303 | void tox_callback_friend_message(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, uint16_t, void *), 304 | void *userdata); 305 | 306 | /* Set the function that will be executed when an action from a friend is received. 307 | * Function format is: function(Tox *tox, int32_t friendnumber, const uint8_t * action, uint16_t length, void *userdata) 308 | */ 309 | void tox_callback_friend_action(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, uint16_t, void *), 310 | void *userdata); 311 | 312 | /* Set the callback for name changes. 313 | * function(Tox *tox, int32_t friendnumber, const uint8_t *newname, uint16_t length, void *userdata) 314 | * You are not responsible for freeing newname 315 | */ 316 | void tox_callback_name_change(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, uint16_t, void *), 317 | void *userdata); 318 | 319 | /* Set the callback for status message changes. 320 | * function(Tox *tox, int32_t friendnumber, const uint8_t *newstatus, uint16_t length, void *userdata) 321 | * You are not responsible for freeing newstatus. 322 | */ 323 | void tox_callback_status_message(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, uint16_t, void *), 324 | void *userdata); 325 | 326 | /* Set the callback for status type changes. 327 | * function(Tox *tox, int32_t friendnumber, uint8_t TOX_USERSTATUS, void *userdata) 328 | */ 329 | void tox_callback_user_status(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, void *), void *userdata); 330 | 331 | /* Set the callback for typing changes. 332 | * function (Tox *tox, int32_t friendnumber, uint8_t is_typing, void *userdata) 333 | */ 334 | void tox_callback_typing_change(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, void *), void *userdata); 335 | 336 | /* Set the callback for read receipts. 337 | * function(Tox *tox, int32_t friendnumber, uint32_t receipt, void *userdata) 338 | * 339 | * If you are keeping a record of returns from m_sendmessage; 340 | * receipt might be one of those values, meaning the message 341 | * has been received on the other side. 342 | * Since core doesn't track ids for you, receipt may not correspond to any message. 343 | * In that case, you should discard it. 344 | */ 345 | void tox_callback_read_receipt(Tox *tox, void (*function)(Tox *tox, int32_t, uint32_t, void *), void *userdata); 346 | 347 | /* Set the callback for connection status changes. 348 | * function(Tox *tox, int32_t friendnumber, uint8_t status, void *userdata) 349 | * 350 | * Status: 351 | * 0 -- friend went offline after being previously online 352 | * 1 -- friend went online 353 | * 354 | * NOTE: This callback is not called when adding friends, thus the "after 355 | * being previously online" part. it's assumed that when adding friends, 356 | * their connection status is offline. 357 | */ 358 | void tox_callback_connection_status(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, void *), void *userdata); 359 | 360 | 361 | /**********ADVANCED FUNCTIONS (If you don't know what they do you can safely ignore them.) ************/ 362 | 363 | /* Functions to get/set the nospam part of the id. 364 | */ 365 | uint32_t tox_get_nospam(const Tox *tox); 366 | void tox_set_nospam(Tox *tox, uint32_t nospam); 367 | 368 | /* Copy the public and secret key from the Tox object. 369 | public_key and secret_key must be 32 bytes big. 370 | if the pointer is NULL, no data will be copied to it.*/ 371 | void tox_get_keys(Tox *tox, uint8_t *public_key, uint8_t *secret_key); 372 | 373 | /* Maximum size of custom packets. */ 374 | #define TOX_MAX_CUSTOM_PACKET_SIZE 1373 375 | 376 | /* Set handlers for custom lossy packets. 377 | * Set the function to be called when friend sends us a lossy packet starting with byte. 378 | * byte must be in the 200-254 range. 379 | * 380 | * NOTE: lossy packets behave like UDP packets meaning they might never reach the other side 381 | * or might arrive more than once (if someone is messing with the connection) or might arrive 382 | * in the wrong order. 383 | * 384 | * Unless latency is an issue, it is recommended that you use lossless packets instead. 385 | * 386 | * return -1 on failure. 387 | * return 0 on success. 388 | */ 389 | int tox_lossy_packet_registerhandler(Tox *tox, int32_t friendnumber, uint8_t byte, 390 | int (*packet_handler_callback)(Tox *tox, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object), 391 | void *object); 392 | 393 | /* Function to send custom lossy packets. 394 | * First byte of data must be in the range: 200-254. 395 | * 396 | * return -1 on failure. 397 | * return 0 on success. 398 | */ 399 | int tox_send_lossy_packet(const Tox *tox, int32_t friendnumber, const uint8_t *data, uint32_t length); 400 | 401 | /* Set handlers for custom lossless packets. 402 | * Set the function to be called when friend sends us a lossless packet starting with byte. 403 | * byte must be in the 160-191 range. 404 | * 405 | * Lossless packets behave kind of like TCP (reliability, arrive in order.) but with packets instead of a stream. 406 | * 407 | * return -1 on failure. 408 | * return 0 on success. 409 | */ 410 | int tox_lossless_packet_registerhandler(Tox *tox, int32_t friendnumber, uint8_t byte, 411 | int (*packet_handler_callback)(Tox *tox, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object), 412 | void *object); 413 | 414 | /* Function to send custom lossless packets. 415 | * First byte of data must be in the range: 160-191. 416 | * 417 | * return -1 on failure. 418 | * return 0 on success. 419 | */ 420 | int tox_send_lossless_packet(const Tox *tox, int32_t friendnumber, const uint8_t *data, uint32_t length); 421 | 422 | /**********GROUP CHAT FUNCTIONS: WARNING Group chats will be rewritten so this might change ************/ 423 | 424 | /* Group chat types for tox_callback_group_invite function. 425 | * 426 | * TOX_GROUPCHAT_TYPE_TEXT groupchats must be accepted with the tox_join_groupchat() function. 427 | * The function to accept TOX_GROUPCHAT_TYPE_AV is in toxav. 428 | */ 429 | enum { 430 | TOX_GROUPCHAT_TYPE_TEXT, 431 | TOX_GROUPCHAT_TYPE_AV 432 | }; 433 | 434 | /* Set the callback for group invites. 435 | * 436 | * Function(Tox *tox, int32_t friendnumber, uint8_t type, const uint8_t *data, uint16_t length, void *userdata) 437 | * 438 | * data of length is what needs to be passed to join_groupchat(). 439 | * 440 | * for what type means see the enum right above this comment. 441 | */ 442 | void tox_callback_group_invite(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, const uint8_t *, uint16_t, 443 | void *), void *userdata); 444 | 445 | /* Set the callback for group messages. 446 | * 447 | * Function(Tox *tox, int groupnumber, int peernumber, const uint8_t * message, uint16_t length, void *userdata) 448 | */ 449 | void tox_callback_group_message(Tox *tox, void (*function)(Tox *tox, int, int, const uint8_t *, uint16_t, void *), 450 | void *userdata); 451 | 452 | /* Set the callback for group actions. 453 | * 454 | * Function(Tox *tox, int groupnumber, int peernumber, const uint8_t * action, uint16_t length, void *userdata) 455 | */ 456 | void tox_callback_group_action(Tox *tox, void (*function)(Tox *tox, int, int, const uint8_t *, uint16_t, void *), 457 | void *userdata); 458 | 459 | /* Set callback function for title changes. 460 | * 461 | * Function(Tox *tox, int groupnumber, int peernumber, uint8_t * title, uint8_t length, void *userdata) 462 | * if peernumber == -1, then author is unknown (e.g. initial joining the group) 463 | */ 464 | void tox_callback_group_title(Tox *tox, void (*function)(Tox *tox, int, int, const uint8_t *, uint8_t, 465 | void *), void *userdata); 466 | 467 | /* Set callback function for peer name list changes. 468 | * 469 | * It gets called every time the name list changes(new peer/name, deleted peer) 470 | * Function(Tox *tox, int groupnumber, int peernumber, TOX_CHAT_CHANGE change, void *userdata) 471 | */ 472 | typedef enum { 473 | TOX_CHAT_CHANGE_PEER_ADD, 474 | TOX_CHAT_CHANGE_PEER_DEL, 475 | TOX_CHAT_CHANGE_PEER_NAME, 476 | } TOX_CHAT_CHANGE; 477 | 478 | void tox_callback_group_namelist_change(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), 479 | void *userdata); 480 | 481 | /* Creates a new groupchat and puts it in the chats array. 482 | * 483 | * return group number on success. 484 | * return -1 on failure. 485 | */ 486 | int tox_add_groupchat(Tox *tox); 487 | 488 | /* Delete a groupchat from the chats array. 489 | * 490 | * return 0 on success. 491 | * return -1 if failure. 492 | */ 493 | int tox_del_groupchat(Tox *tox, int groupnumber); 494 | 495 | /* Copy the name of peernumber who is in groupnumber to name. 496 | * name must be at least TOX_MAX_NAME_LENGTH long. 497 | * 498 | * return length of name if success 499 | * return -1 if failure 500 | */ 501 | int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t *name); 502 | 503 | /* Copy the public key of peernumber who is in groupnumber to pk. 504 | * pk must be TOX_CLIENT_ID_SIZE long. 505 | * 506 | * returns 0 on success 507 | * returns -1 on failure 508 | */ 509 | int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *pk); 510 | 511 | /* invite friendnumber to groupnumber 512 | * return 0 on success 513 | * return -1 on failure 514 | */ 515 | int tox_invite_friend(Tox *tox, int32_t friendnumber, int groupnumber); 516 | 517 | /* Join a group (you need to have been invited first.) using data of length obtained 518 | * in the group invite callback. 519 | * 520 | * returns group number on success 521 | * returns -1 on failure. 522 | */ 523 | int tox_join_groupchat(Tox *tox, int32_t friendnumber, const uint8_t *data, uint16_t length); 524 | 525 | /* send a group message 526 | * return 0 on success 527 | * return -1 on failure 528 | */ 529 | int tox_group_message_send(Tox *tox, int groupnumber, const uint8_t *message, uint16_t length); 530 | 531 | /* send a group action 532 | * return 0 on success 533 | * return -1 on failure 534 | */ 535 | int tox_group_action_send(Tox *tox, int groupnumber, const uint8_t *action, uint16_t length); 536 | 537 | /* set the group's title, limited to MAX_NAME_LENGTH 538 | * return 0 on success 539 | * return -1 on failure 540 | */ 541 | int tox_group_set_title(Tox *tox, int groupnumber, const uint8_t *title, uint8_t length); 542 | 543 | /* Get group title from groupnumber and put it in title. 544 | * title needs to be a valid memory location with a max_length size of at least MAX_NAME_LENGTH (128) bytes. 545 | * 546 | * return length of copied title if success. 547 | * return -1 if failure. 548 | */ 549 | int tox_group_get_title(Tox *tox, int groupnumber, uint8_t *title, uint32_t max_length); 550 | 551 | /* Check if the current peernumber corresponds to ours. 552 | * 553 | * return 1 if the peernumber corresponds to ours. 554 | * return 0 on failure. 555 | */ 556 | unsigned int tox_group_peernumber_is_ours(const Tox *tox, int groupnumber, int peernumber); 557 | 558 | /* Return the number of peers in the group chat on success. 559 | * return -1 on failure 560 | */ 561 | int tox_group_number_peers(const Tox *tox, int groupnumber); 562 | 563 | /* List all the peers in the group chat. 564 | * 565 | * Copies the names of the peers to the name[length][TOX_MAX_NAME_LENGTH] array. 566 | * 567 | * Copies the lengths of the names to lengths[length] 568 | * 569 | * returns the number of peers on success. 570 | * 571 | * return -1 on failure. 572 | */ 573 | int tox_group_get_names(const Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t lengths[], 574 | uint16_t length); 575 | 576 | /* Return the number of chats in the instance m. 577 | * You should use this to determine how much memory to allocate 578 | * for copy_chatlist. */ 579 | uint32_t tox_count_chatlist(const Tox *tox); 580 | 581 | /* Copy a list of valid chat IDs into the array out_list. 582 | * If out_list is NULL, returns 0. 583 | * Otherwise, returns the number of elements copied. 584 | * If the array was too small, the contents 585 | * of out_list will be truncated to list_size. */ 586 | uint32_t tox_get_chatlist(const Tox *tox, int32_t *out_list, uint32_t list_size); 587 | 588 | /* return the type of groupchat (TOX_GROUPCHAT_TYPE_) that groupnumber is. 589 | * 590 | * return -1 on failure. 591 | * return type on success. 592 | */ 593 | int tox_group_get_type(const Tox *tox, int groupnumber); 594 | 595 | /****************AVATAR FUNCTIONS*****************/ 596 | 597 | /* Set the callback function for avatar information. 598 | * This callback will be called when avatar information are received from friends. These events 599 | * can arrive at anytime, but are usually received uppon connection and in reply of avatar 600 | * information requests. 601 | * 602 | * Function format is: 603 | * function(Tox *tox, int32_t friendnumber, uint8_t format, uint8_t *hash, void *userdata) 604 | * 605 | * where 'format' is the avatar image format (see TOX_AVATAR_FORMAT) and 'hash' is the hash of 606 | * the avatar data for caching purposes and it is exactly TOX_HASH_LENGTH long. If the image 607 | * format is NONE, the hash is zeroed. 608 | * 609 | */ 610 | void tox_callback_avatar_info(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, uint8_t *, void *), 611 | void *userdata); 612 | 613 | 614 | /* Set the callback function for avatar data. 615 | * This callback will be called when the complete avatar data was correctly received from a 616 | * friend. This only happens in reply of a avatar data request (see tox_request_avatar_data); 617 | * 618 | * Function format is: 619 | * function(Tox *tox, int32_t friendnumber, uint8_t format, uint8_t *hash, uint8_t *data, uint32_t datalen, void *userdata) 620 | * 621 | * where 'format' is the avatar image format (see TOX_AVATAR_FORMAT); 'hash' is the 622 | * locally-calculated cryptographic hash of the avatar data and it is exactly 623 | * TOX_HASH_LENGTH long; 'data' is the avatar image data and 'datalen' is the length 624 | * of such data. 625 | * 626 | * If format is NONE, 'data' is NULL, 'datalen' is zero, and the hash is zeroed. The hash is 627 | * always validated locally with the function tox_hash and ensured to match the image data, 628 | * so this value can be safely used to compare with cached avatars. 629 | * 630 | * WARNING: users MUST treat all avatar image data received from another peer as untrusted and 631 | * potentially malicious. The library only ensures that the data which arrived is the same the 632 | * other user sent, and does not interpret or validate any image data. 633 | */ 634 | void tox_callback_avatar_data(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, uint8_t *, uint8_t *, uint32_t, 635 | void *), void *userdata); 636 | 637 | /* Set the user avatar image data. 638 | * This should be made before connecting, so we will not announce that the user have no avatar 639 | * before setting and announcing a new one, forcing the peers to re-download it. 640 | * 641 | * Notice that the library treats the image as raw data and does not interpret it by any way. 642 | * 643 | * Arguments: 644 | * format - Avatar image format or NONE for user with no avatar (see TOX_AVATAR_FORMAT); 645 | * data - pointer to the avatar data (may be NULL it the format is NONE); 646 | * length - length of image data. Must be <= TOX_AVATAR_MAX_DATA_LENGTH. 647 | * 648 | * returns 0 on success 649 | * returns -1 on failure. 650 | */ 651 | int tox_set_avatar(Tox *tox, uint8_t format, const uint8_t *data, uint32_t length); 652 | 653 | /* Unsets the user avatar. 654 | 655 | returns 0 on success (currently always returns 0) */ 656 | int tox_unset_avatar(Tox *tox); 657 | 658 | /* Get avatar data from the current user. 659 | * Copies the current user avatar data to the destination buffer and sets the image format 660 | * accordingly. 661 | * 662 | * If the avatar format is NONE, the buffer 'buf' isleft uninitialized, 'hash' is zeroed, and 663 | * 'length' is set to zero. 664 | * 665 | * If any of the pointers format, buf, length, and hash are NULL, that particular field will be ignored. 666 | * 667 | * Arguments: 668 | * format - destination pointer to the avatar image format (see TOX_AVATAR_FORMAT); 669 | * buf - destination buffer to the image data. Must have at least 'maxlen' bytes; 670 | * length - destination pointer to the image data length; 671 | * maxlen - length of the destination buffer 'buf'; 672 | * hash - destination pointer to the avatar hash (it must be exactly TOX_HASH_LENGTH bytes long). 673 | * 674 | * returns 0 on success; 675 | * returns -1 on failure. 676 | * 677 | */ 678 | int tox_get_self_avatar(const Tox *tox, uint8_t *format, uint8_t *buf, uint32_t *length, uint32_t maxlen, 679 | uint8_t *hash); 680 | 681 | 682 | /* Generates a cryptographic hash of the given data. 683 | * This function may be used by clients for any purpose, but is provided primarily for 684 | * validating cached avatars. This use is highly recommended to avoid unnecessary avatar 685 | * updates. 686 | * This function is a wrapper to internal message-digest functions. 687 | * 688 | * Arguments: 689 | * hash - destination buffer for the hash data, it must be exactly TOX_HASH_LENGTH bytes long. 690 | * data - data to be hashed; 691 | * datalen - length of the data; for avatars, should be TOX_AVATAR_MAX_DATA_LENGTH 692 | * 693 | * returns 0 on success 694 | * returns -1 on failure. 695 | */ 696 | int tox_hash(uint8_t *hash, const uint8_t *data, const uint32_t datalen); 697 | 698 | /* Request avatar information from a friend. 699 | * Asks a friend to provide their avatar information (image format and hash). The friend may 700 | * or may not answer this request and, if answered, the information will be provided through 701 | * the callback 'avatar_info'. 702 | * 703 | * returns 0 on success 704 | * returns -1 on failure. 705 | */ 706 | int tox_request_avatar_info(const Tox *tox, const int32_t friendnumber); 707 | 708 | 709 | /* Send an unrequested avatar information to a friend. 710 | * Sends our avatar format and hash to a friend; he/she can use this information to validate 711 | * an avatar from the cache and may (or not) reply with an avatar data request. 712 | * 713 | * Notice: it is NOT necessary to send these notification after changing the avatar or 714 | * connecting. The library already does this. 715 | * 716 | * returns 0 on success 717 | * returns -1 on failure. 718 | */ 719 | int tox_send_avatar_info(Tox *tox, const int32_t friendnumber); 720 | 721 | 722 | /* Request the avatar data from a friend. 723 | * Ask a friend to send their avatar data. The friend may or may not answer this request and, 724 | * if answered, the information will be provided in callback 'avatar_data'. 725 | * 726 | * returns 0 on sucess 727 | * returns -1 on failure. 728 | */ 729 | int tox_request_avatar_data(const Tox *tox, const int32_t friendnumber); 730 | 731 | /****************FILE SENDING FUNCTIONS*****************/ 732 | /* NOTE: This how to will be updated. 733 | * 734 | * HOW TO SEND FILES CORRECTLY: 735 | * 1. Use tox_new_file_sender(...) to create a new file sender. 736 | * 2. Wait for the callback set with tox_callback_file_control(...) to be called with receive_send == 1 and control_type == TOX_FILECONTROL_ACCEPT 737 | * 3. Send the data with tox_file_send_data(...) with chunk size tox_file_data_size(...) 738 | * 4. When sending is done, send a tox_file_send_control(...) with send_receive = 0 and message_id = TOX_FILECONTROL_FINISHED 739 | * 5. when the callback set with tox_callback_file_control(...) is called with receive_send == 1 and control_type == TOX_FILECONTROL_FINISHED 740 | * the other person has received the file correctly. 741 | * 742 | * HOW TO RECEIVE FILES CORRECTLY: 743 | * 1. wait for the callback set with tox_callback_file_send_request(...) 744 | * 2. accept or refuse the connection with tox_file_send_control(...) with send_receive = 1 and message_id = TOX_FILECONTROL_ACCEPT or TOX_FILECONTROL_KILL 745 | * 3. save all the data received with the callback set with tox_callback_file_data(...) to a file. 746 | * 4. when the callback set with tox_callback_file_control(...) is called with receive_send == 0 and control_type == TOX_FILECONTROL_FINISHED 747 | * the file is done transferring. 748 | * 5. send a tox_file_send_control(...) with send_receive = 1 and message_id = TOX_FILECONTROL_FINISHED to confirm that we did receive the file. 749 | * 750 | * tox_file_data_remaining(...) can be used to know how many bytes are left to send/receive. 751 | * 752 | * If the connection breaks during file sending (The other person goes offline without pausing the sending and then comes back) 753 | * the receiver must send a control packet with send_receive == 1 message_id = TOX_FILECONTROL_RESUME_BROKEN and the data being 754 | * a uint64_t (in host byte order) containing the number of bytes received. 755 | * 756 | * If the sender receives this packet, he must send a control packet with send_receive == 0 and control_type == TOX_FILECONTROL_ACCEPT 757 | * then he must start sending file data from the position (data , uint64_t in host byte order) received in the TOX_FILECONTROL_RESUME_BROKEN packet. 758 | * 759 | * To pause a file transfer send a control packet with control_type == TOX_FILECONTROL_PAUSE. 760 | * To unpause a file transfer send a control packet with control_type == TOX_FILECONTROL_ACCEPT. 761 | * 762 | * If you receive a control packet with receive_send == 1 and control_type == TOX_FILECONTROL_PAUSE, you must stop sending filenumber until the other 763 | * person sends a control packet with send_receive == 0 and control_type == TOX_FILECONTROL_ACCEPT with the filenumber being a paused filenumber. 764 | * 765 | * If you receive a control packet with receive_send == 0 and control_type == TOX_FILECONTROL_PAUSE, it means the sender of filenumber has paused the 766 | * transfer and will resume it later with a control packet with send_receive == 1 and control_type == TOX_FILECONTROL_ACCEPT for that file number. 767 | * 768 | * More to come... 769 | */ 770 | 771 | enum { 772 | TOX_FILECONTROL_ACCEPT, 773 | TOX_FILECONTROL_PAUSE, 774 | TOX_FILECONTROL_KILL, 775 | TOX_FILECONTROL_FINISHED, 776 | TOX_FILECONTROL_RESUME_BROKEN 777 | }; 778 | /* Set the callback for file send requests. 779 | * 780 | * Function(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, const uint8_t *filename, uint16_t filename_length, void *userdata) 781 | */ 782 | void tox_callback_file_send_request(Tox *tox, void (*function)(Tox *m, int32_t, uint8_t, uint64_t, const uint8_t *, 783 | uint16_t, void *), void *userdata); 784 | 785 | /* Set the callback for file control requests. 786 | * 787 | * receive_send is 1 if the message is for a slot on which we are currently sending a file and 0 if the message 788 | * is for a slot on which we are receiving the file 789 | * 790 | * Function(Tox *tox, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber, uint8_t control_type, const uint8_t *data, uint16_t length, void *userdata) 791 | * 792 | */ 793 | void tox_callback_file_control(Tox *tox, void (*function)(Tox *m, int32_t, uint8_t, uint8_t, uint8_t, const uint8_t *, 794 | uint16_t, void *), void *userdata); 795 | 796 | /* Set the callback for file data. 797 | * 798 | * Function(Tox *tox, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length, void *userdata) 799 | * 800 | */ 801 | void tox_callback_file_data(Tox *tox, void (*function)(Tox *m, int32_t, uint8_t, const uint8_t *, uint16_t length, 802 | void *), void *userdata); 803 | 804 | 805 | /* Send a file send request. 806 | * Maximum filename length is 255 bytes. 807 | * return file number on success 808 | * return -1 on failure 809 | */ 810 | int tox_new_file_sender(Tox *tox, int32_t friendnumber, uint64_t filesize, const uint8_t *filename, 811 | uint16_t filename_length); 812 | 813 | /* Send a file control request. 814 | * 815 | * send_receive is 0 if we want the control packet to target a file we are currently sending, 816 | * 1 if it targets a file we are currently receiving. 817 | * 818 | * return 0 on success 819 | * return -1 on failure 820 | */ 821 | int tox_file_send_control(Tox *tox, int32_t friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t message_id, 822 | const uint8_t *data, uint16_t length); 823 | 824 | /* Send file data. 825 | * 826 | * return 0 on success 827 | * return -1 on failure 828 | */ 829 | int tox_file_send_data(Tox *tox, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length); 830 | 831 | /* Returns the recommended/maximum size of the filedata you send with tox_file_send_data() 832 | * 833 | * return size on success 834 | * return -1 on failure (currently will never return -1) 835 | */ 836 | int tox_file_data_size(const Tox *tox, int32_t friendnumber); 837 | 838 | /* Give the number of bytes left to be sent/received. 839 | * 840 | * send_receive is 0 if we want the sending files, 1 if we want the receiving. 841 | * 842 | * return number of bytes remaining to be sent/received on success 843 | * return 0 on failure 844 | */ 845 | uint64_t tox_file_data_remaining(const Tox *tox, int32_t friendnumber, uint8_t filenumber, uint8_t send_receive); 846 | 847 | /***************END OF FILE SENDING FUNCTIONS******************/ 848 | 849 | /* 850 | * Use this function to bootstrap the client. 851 | */ 852 | 853 | /* Resolves address into an IP address. If successful, sends a "get nodes" 854 | * request to the given node with ip, port (in host byte order). 855 | * and public_key to setup connections 856 | * 857 | * address can be a hostname or an IP address (IPv4 or IPv6). 858 | * 859 | * returns 1 if the address could be converted into an IP address 860 | * returns 0 otherwise 861 | */ 862 | int tox_bootstrap_from_address(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key); 863 | 864 | /* Like tox_bootstrap_from_address but for TCP relays only. 865 | * 866 | * return 0 on failure. 867 | * return 1 on success. 868 | */ 869 | int tox_add_tcp_relay(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key); 870 | 871 | /* return 0 if we are not connected to the DHT. 872 | * return 1 if we are. 873 | */ 874 | int tox_isconnected(const Tox *tox); 875 | 876 | typedef enum { 877 | TOX_PROXY_NONE, 878 | TOX_PROXY_SOCKS5, 879 | TOX_PROXY_HTTP 880 | } TOX_PROXY_TYPE; 881 | 882 | typedef struct { 883 | /* 884 | * The type of UDP socket created depends on ipv6enabled: 885 | * If set to 0 (zero), creates an IPv4 socket which subsequently only allows 886 | * IPv4 communication 887 | * If set to anything else (default), creates an IPv6 socket which allows both IPv4 AND 888 | * IPv6 communication 889 | */ 890 | uint8_t ipv6enabled; 891 | 892 | /* Set to 1 to disable udp support. (default: 0) 893 | This will force Tox to use TCP only which may slow things down. 894 | Disabling udp support is necessary when using proxies or Tor.*/ 895 | uint8_t udp_disabled; 896 | uint8_t proxy_type; /* a value from TOX_PROXY_TYPE */ 897 | char proxy_address[256]; /* Proxy ip or domain in NULL terminated string format. */ 898 | uint16_t proxy_port; /* Proxy port in host byte order. */ 899 | } Tox_Options; 900 | 901 | /* 902 | * Run this function at startup. 903 | * 904 | * Options are some options that can be passed to the Tox instance (see above struct). 905 | * 906 | * If options is NULL, tox_new() will use default settings. 907 | * 908 | * Initializes a tox structure 909 | * return allocated instance of tox on success. 910 | * return NULL on failure. 911 | */ 912 | Tox *tox_new(Tox_Options *options); 913 | 914 | /* Run this before closing shop. 915 | * Free all datastructures. */ 916 | void tox_kill(Tox *tox); 917 | 918 | /* Return the time in milliseconds before tox_do() should be called again 919 | * for optimal performance. 920 | * 921 | * returns time (in ms) before the next tox_do() needs to be run on success. 922 | */ 923 | uint32_t tox_do_interval(Tox *tox); 924 | 925 | /* The main loop that needs to be run in intervals of tox_do_interval() ms. */ 926 | void tox_do(Tox *tox); 927 | 928 | /* SAVING AND LOADING FUNCTIONS: */ 929 | 930 | /* return size of messenger data (for saving). */ 931 | uint32_t tox_size(const Tox *tox); 932 | 933 | /* Save the messenger in data (must be allocated memory of size Messenger_size()). */ 934 | void tox_save(const Tox *tox, uint8_t *data); 935 | 936 | /* Load the messenger from data of size length. 937 | * NOTE: The Tox save format isn't stable yet meaning this function sometimes 938 | * returns -1 when loading older saves. This however does not mean nothing was 939 | * loaded from the save. 940 | * 941 | * returns 0 on success 942 | * returns -1 on failure 943 | * returns +1 on finding encrypted save data 944 | */ 945 | int tox_load(Tox *tox, const uint8_t *data, uint32_t length); 946 | 947 | #ifdef __cplusplus 948 | } 949 | #endif 950 | 951 | #endif 952 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/amd64/libsodium.so: -------------------------------------------------------------------------------- 1 | libsodium.so.13 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/amd64/libsodium.so.13: -------------------------------------------------------------------------------- 1 | libsodium.so.13.0.2 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/amd64/libsodium.so.13.0.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikwen/ubuntu-tox-client/eceb2a005f4c6b86e3f858241f671c902bc4d4f1/backend/modules/UbuntuToxClient/libs/amd64/libsodium.so.13.0.2 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/amd64/libtoxcore.so: -------------------------------------------------------------------------------- 1 | libtoxcore.so.0 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/amd64/libtoxcore.so.0: -------------------------------------------------------------------------------- 1 | libtoxcore.so.0.0.0 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/amd64/libtoxcore.so.0.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikwen/ubuntu-tox-client/eceb2a005f4c6b86e3f858241f671c902bc4d4f1/backend/modules/UbuntuToxClient/libs/amd64/libtoxcore.so.0.0.0 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/armhf/libsodium.so: -------------------------------------------------------------------------------- 1 | libsodium.so.13 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/armhf/libsodium.so.13: -------------------------------------------------------------------------------- 1 | libsodium.so.13.0.2 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/armhf/libsodium.so.13.0.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikwen/ubuntu-tox-client/eceb2a005f4c6b86e3f858241f671c902bc4d4f1/backend/modules/UbuntuToxClient/libs/armhf/libsodium.so.13.0.2 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/armhf/libtoxcore.so: -------------------------------------------------------------------------------- 1 | libtoxcore.so.0 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/armhf/libtoxcore.so.0: -------------------------------------------------------------------------------- 1 | libtoxcore.so.0.0.0 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/armhf/libtoxcore.so.0.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikwen/ubuntu-tox-client/eceb2a005f4c6b86e3f858241f671c902bc4d4f1/backend/modules/UbuntuToxClient/libs/armhf/libtoxcore.so.0.0.0 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/i386/libsodium.so: -------------------------------------------------------------------------------- 1 | libsodium.so.13 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/i386/libsodium.so.13: -------------------------------------------------------------------------------- 1 | libsodium.so.13.0.2 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/i386/libsodium.so.13.0.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikwen/ubuntu-tox-client/eceb2a005f4c6b86e3f858241f671c902bc4d4f1/backend/modules/UbuntuToxClient/libs/i386/libsodium.so.13.0.2 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/i386/libtoxcore.so: -------------------------------------------------------------------------------- 1 | libtoxcore.so.0 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/i386/libtoxcore.so.0: -------------------------------------------------------------------------------- 1 | libtoxcore.so.0.0.0 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/libs/i386/libtoxcore.so.0.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikwen/ubuntu-tox-client/eceb2a005f4c6b86e3f858241f671c902bc4d4f1/backend/modules/UbuntuToxClient/libs/i386/libtoxcore.so.0.0.0 -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/qmldir: -------------------------------------------------------------------------------- 1 | module UbuntuToxClient 2 | plugin UbuntuToxClientbackend 3 | 4 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/toxbackend.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "toxbackend.h" 30 | #include "cstring.h" 31 | #include "cdata.h" 32 | #include "bootstrapnodes.h" 33 | 34 | //Static members from header file: 35 | int ToxBackend::sigtermFd[2]; 36 | 37 | ToxBackend::ToxBackend(QObject *parent) : 38 | QObject(parent), 39 | m_toxId(""), 40 | m_connected(false) 41 | { 42 | //Setup SIGTERM handlers to get notified when the application is closed 43 | 44 | int setUpHandlersResult = ToxBackend::setUpUnixSignalHandlers(); 45 | 46 | if (setUpHandlersResult > 0) { 47 | qFatal("sigaction(SIGTERM) exited with return code > 0"); 48 | } else { 49 | if (::socketpair(AF_UNIX, SOCK_STREAM, 0, ToxBackend::sigtermFd)) { 50 | qFatal("Couldn't create TERM socketpair"); 51 | } 52 | termSocketNotifier = new QSocketNotifier(ToxBackend::sigtermFd[1], QSocketNotifier::Read, this); 53 | connect(termSocketNotifier, SIGNAL(activated(int)), this, SLOT(handleSigTerm())); 54 | } 55 | 56 | //Create timer for tox "main loop" 57 | 58 | toxTimer = new QTimer(this); 59 | toxTimer->setSingleShot(true); 60 | connect(toxTimer, &QTimer::timeout, this, &ToxBackend::tick); 61 | 62 | //Create tox object 63 | 64 | Tox_Options toxOptions; 65 | toxOptions.proxy_type = TOX_PROXY_NONE; 66 | toxOptions.proxy_address[0] = 0; 67 | toxOptions.proxy_port = 0; 68 | 69 | tox = tox_new(&toxOptions); 70 | 71 | if (tox == NULL) { 72 | qCritical() << "Tox core failed to start"; 73 | return; 74 | } 75 | 76 | //Try to load saved tox status 77 | 78 | if (!loadTox()) { 79 | //Set a default username and status message 80 | 81 | setUserName(QString("Ubuntu User")); 82 | setStatusMessage(QString("Toxing from my Ubuntu phone")); 83 | } 84 | 85 | //Set the user status 86 | 87 | tox_set_user_status(tox, TOX_USERSTATUS_NONE); 88 | 89 | //Set handlers for events 90 | tox_callback_friend_request(tox, onFriendRequest, this); 91 | 92 | //Get own id: 93 | 94 | uint8_t friendAddress[TOX_FRIEND_ADDRESS_SIZE]; 95 | tox_get_address(tox, friendAddress); 96 | QString addressString = CFriendAddress::toString(friendAddress); 97 | 98 | qDebug() << "Tox-ID:" << addressString; 99 | // qDebug() << "Public Key:" << addressString.left(64); 100 | // qDebug() << "Nospam:" << addressString.mid(64, 8); 101 | // qDebug() << "Checksum:" << addressString.mid(64 + 8, 4); 102 | 103 | setToxId(addressString); 104 | 105 | //Start main loop 106 | tick(); 107 | } 108 | 109 | ToxBackend::~ToxBackend() { 110 | 111 | } 112 | 113 | bool ToxBackend::isConnectedCheck() { 114 | setConnected(tox_isconnected(tox)); 115 | return m_connected; 116 | } 117 | 118 | void ToxBackend::setConnected(bool connected) { 119 | if (m_connected != connected) { 120 | m_connected = connected; 121 | emit connectedChanged(); 122 | } 123 | } 124 | 125 | void ToxBackend::setToxId(QString id) { //TODO: Better solution 126 | m_toxId = id; 127 | emit toxIdChanged(); 128 | } 129 | 130 | #define CORE_DISCONNECT_TOLERANCE 30 131 | 132 | /* 133 | * The body of the tox "main loop" 134 | * Executes tox_do() 135 | */ 136 | void ToxBackend::tick() { 137 | static int tolerance = CORE_DISCONNECT_TOLERANCE; 138 | 139 | tox_do(tox); 140 | 141 | if (isConnectedCheck()) 142 | tolerance = CORE_DISCONNECT_TOLERANCE; 143 | else if (!(--tolerance)) { 144 | qDebug() << "Bootstrapping..."; 145 | bootstrap(); 146 | } 147 | 148 | toxTimer->start(tox_do_interval(tox)); 149 | } 150 | 151 | /* 152 | * Bootstrap to the DHT using the set of bootstrap nodes in bootstrapnodes.h 153 | */ 154 | void ToxBackend::bootstrap() { 155 | int nodeCount = sizeof(bootstrapNodes)/sizeof(bootstrapNodes[0]); 156 | 157 | int i = 0; 158 | static unsigned int j = qrand() % nodeCount; 159 | 160 | while (i < 4) { 161 | struct BootstrapNode *d = &bootstrapNodes[j % nodeCount]; 162 | tox_bootstrap_from_address(tox, d->address, d->port, d->key); 163 | i++; 164 | j++; 165 | } 166 | } 167 | 168 | void ToxBackend::onFriendRequest(Tox*, const uint8_t* cUserId, const uint8_t* cMessage, uint16_t cMessageSize, void* backend) { 169 | emit static_cast(backend)->friendRequestReceived(CUserId::toString(cUserId), CString::toString(cMessage, cMessageSize)); 170 | } 171 | 172 | void ToxBackend::acceptFriendRequest(const QString& userId) { 173 | int friendId = tox_add_friend_norequest(tox, CUserId(userId).data()); 174 | if (friendId == -1) { 175 | emit failedToAddFriend(userId); 176 | } else { 177 | saveTox(); 178 | emit friendAdded(friendId, userId); 179 | } 180 | } 181 | 182 | void ToxBackend::sendFriendRequest(const QString &address, const QString &message) { 183 | const QString userId = address.mid(0, TOX_CLIENT_ID_SIZE * 2); 184 | 185 | if (hasFriendWithAddress(address)) { //TODO: Think about removing this as it is already handled by tox_add_friend 186 | emit failedToAddFriend(userId, TOX_FAERR_ALREADYSENT); 187 | } else { 188 | CString cMessage(message); 189 | int friendId = tox_add_friend(tox, CFriendAddress(address).data(), cMessage.data(), cMessage.size()); 190 | if (friendId < 0) { 191 | emit failedToAddFriend(userId, friendId); 192 | } else { 193 | emit friendAdded(friendId, userId); 194 | } 195 | } 196 | 197 | saveTox(); 198 | } 199 | 200 | bool ToxBackend::hasFriendWithPublicKey(const QString &publicKey) const { 201 | //Return if public key is too short 202 | if (publicKey.length() != (TOX_CLIENT_ID_SIZE * 2)) { 203 | return false; 204 | } 205 | 206 | const uint32_t friendCount = tox_count_friendlist(tox); 207 | 208 | if (friendCount > 0) { 209 | int32_t *ids = new int32_t[friendCount]; 210 | tox_get_friendlist(tox, ids, friendCount); 211 | 212 | for (int32_t i = 0; i < static_cast(friendCount); ++i) { 213 | QString friendUserId = getFriendUserId(ids[i]); 214 | if (friendUserId.toUpper().startsWith(publicKey.toUpper())) { 215 | delete[] ids; 216 | return true; 217 | } 218 | } 219 | delete[] ids; 220 | } 221 | return false; 222 | } 223 | 224 | QString ToxBackend::getFriendUserId(int friendNumber) const { 225 | uint8_t rawid[TOX_CLIENT_ID_SIZE]; 226 | tox_get_client_id(tox, friendNumber, rawid); 227 | QByteArray data((char*) rawid, TOX_CLIENT_ID_SIZE); 228 | QString id = data.toHex().toUpper(); 229 | 230 | return id; 231 | } 232 | 233 | bool ToxBackend::hasFriendWithAddress(const QString &address) const { 234 | //Return if address is too short 235 | if (address.length() != (TOX_FRIEND_ADDRESS_SIZE * 2)) { 236 | return false; 237 | } 238 | 239 | QString publicKey = address.left(TOX_CLIENT_ID_SIZE * 2); 240 | return hasFriendWithPublicKey(publicKey); 241 | } 242 | 243 | void ToxBackend::setUserName(const QString& name) { 244 | CString cName(name); 245 | tox_set_name(tox, cName.data(), std::min((int) cName.size(), TOX_MAX_NAME_LENGTH)); 246 | saveTox(); 247 | emit userNameChanged(); 248 | } 249 | 250 | void ToxBackend::setStatusMessage(const QString& message) { 251 | CString cMessage(message); 252 | tox_set_status_message(tox, cMessage.data(), std::min((int) cMessage.size(), TOX_MAX_STATUSMESSAGE_LENGTH)); 253 | saveTox(); 254 | emit statusMessageChanged(); 255 | } 256 | 257 | QString ToxBackend::getOwnUserName() { 258 | QString name; 259 | 260 | int size = tox_get_self_name_size(tox); 261 | uint8_t* nameData = new uint8_t[size]; 262 | 263 | if (tox_get_self_name(tox, nameData) == size) { 264 | name = CString::toString(nameData, size); 265 | } 266 | delete[] nameData; 267 | 268 | return name; 269 | } 270 | 271 | QString ToxBackend::getOwnStatusMessage() { 272 | QString message; 273 | 274 | int size = tox_get_self_status_message_size(tox); 275 | uint8_t* messageData = new uint8_t[size]; 276 | 277 | if (tox_get_self_status_message(tox, messageData, size) == size) { 278 | message = CString::toString(messageData, size); 279 | } 280 | delete[] messageData; 281 | 282 | return message; 283 | } 284 | 285 | QString ToxBackend::getConfigurationFilePath() { 286 | //Create app data directory if it does not exist 287 | 288 | QDir dataDir = QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); 289 | 290 | if (!dataDir.exists() && !dataDir.mkpath(dataDir.absolutePath())) { 291 | qCritical() << "Failed to create directory:" << dataDir; 292 | return nullptr; 293 | } 294 | 295 | //Return path for file "save.txt" in dataDir 296 | 297 | QString path = dataDir.absoluteFilePath("save.tox"); //TODO: Change file name? 298 | 299 | return path; 300 | } 301 | 302 | void ToxBackend::saveTox() { 303 | if (!tox) { 304 | qWarning() << "Tox not started, will not save tox status!"; 305 | return; 306 | } 307 | 308 | qDebug() << "Saving tox status"; 309 | 310 | //Open file to save tox status to 311 | 312 | QString path = getConfigurationFilePath(); 313 | if (path == nullptr) { 314 | qCritical() << "Failed to receive configuration file path"; 315 | return; 316 | } 317 | 318 | QSaveFile configurationFile(path); 319 | if (!configurationFile.open(QIODevice::WriteOnly)) { 320 | qCritical() << "Failed to open file:" << path; 321 | return; 322 | } 323 | 324 | qDebug() << "Saving tox status to" << path; 325 | 326 | //Get tox size and save tox data 327 | 328 | uint32_t fileSize = tox_size(tox); 329 | 330 | if (fileSize > 0 && fileSize <= INT32_MAX) { 331 | uint8_t *data = new uint8_t[fileSize]; 332 | tox_save(tox, data); 333 | configurationFile.write(reinterpret_cast(data), fileSize); 334 | configurationFile.commit(); 335 | delete[] data; 336 | 337 | qDebug() << "Saved tox status"; 338 | } else { 339 | qCritical() << "Invalid fileSize for tox status"; 340 | } 341 | } 342 | 343 | /* 344 | * Returns whether loading was successful 345 | */ 346 | bool ToxBackend::loadTox() { 347 | qDebug() << "Loading tox status"; 348 | 349 | //Open file to load the tox status from 350 | 351 | QString path = getConfigurationFilePath(); 352 | if (path == nullptr) { 353 | qCritical() << "Failed to receive configuration file path"; 354 | return false; 355 | } 356 | 357 | QFile configurationFile(path); 358 | 359 | if (!configurationFile.exists()) { 360 | qWarning() << "File does not exist:" << path; 361 | return false; 362 | } 363 | 364 | if (!configurationFile.open(QIODevice::ReadOnly)) { 365 | qCritical() << "Failed to open file:" << path; 366 | return false; 367 | } 368 | 369 | //Get file size and load tox data 370 | 371 | bool returnValue; 372 | 373 | qint64 fileSize = configurationFile.size(); 374 | if (fileSize > 0) { 375 | QByteArray data = configurationFile.readAll(); 376 | int error = tox_load(tox, reinterpret_cast(data.data()), data.size()); 377 | 378 | if (error != 0) { 379 | qWarning() << "tox_load failed with error" << error; 380 | returnValue = false; 381 | } else { 382 | qDebug() << "Loaded tox status"; 383 | returnValue = true; 384 | } 385 | } 386 | configurationFile.close(); 387 | 388 | return returnValue; 389 | } 390 | 391 | void ToxBackend::cleanUpOnClose() { 392 | saveTox(); 393 | 394 | qDebug() << "Killing tox..."; 395 | 396 | if (tox) { 397 | tox_kill(tox); 398 | tox = nullptr; 399 | } 400 | } 401 | 402 | //SIGTERM handling 403 | 404 | int ToxBackend::setUpUnixSignalHandlers() { 405 | struct sigaction term; 406 | 407 | term.sa_handler = ToxBackend::termSignalHandler; 408 | sigemptyset(&term.sa_mask); 409 | term.sa_flags |= SA_RESTART; 410 | 411 | if (sigaction(SIGTERM, &term, 0) > 0) { 412 | return 2; 413 | } 414 | 415 | return 0; 416 | } 417 | 418 | void ToxBackend::termSignalHandler(int) { 419 | char a = 1; 420 | ::write(ToxBackend::sigtermFd[0], &a, sizeof(a)); 421 | } 422 | 423 | void ToxBackend::handleSigTerm() { 424 | termSocketNotifier->setEnabled(false); 425 | char tmp; 426 | ::read(ToxBackend::sigtermFd[1], &tmp, sizeof(tmp)); 427 | 428 | qDebug() << "SIGTERM received"; 429 | 430 | cleanUpOnClose(); 431 | 432 | termSocketNotifier->setEnabled(true); 433 | } 434 | -------------------------------------------------------------------------------- /backend/modules/UbuntuToxClient/toxbackend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ubuntu-tox-client 3 | * 4 | * Copyright (c) 2015 Niklas Wenzel 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef TOXBACKEND_H 21 | #define TOXBACKEND_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include "tox/tox.h" 28 | 29 | class ToxBackend : public QObject 30 | { 31 | Q_OBJECT 32 | Q_PROPERTY(QString toxId READ getToxId NOTIFY toxIdChanged) 33 | Q_PROPERTY(QString userName READ getOwnUserName NOTIFY userNameChanged) 34 | Q_PROPERTY(QString statusMessage READ getOwnStatusMessage NOTIFY statusMessageChanged) 35 | Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged) 36 | 37 | public: 38 | explicit ToxBackend(QObject *parent = 0); 39 | ~ToxBackend(); 40 | 41 | //SIGTERM handling 42 | static int setUpUnixSignalHandlers(); 43 | static void termSignalHandler(int unused); 44 | 45 | public slots: 46 | QString getToxId() { return m_toxId; } 47 | QString getOwnUserName(); 48 | QString getOwnStatusMessage(); 49 | bool isConnected() { return m_connected; } 50 | 51 | QString getFriendUserId(int friendNumber) const; 52 | bool hasFriendWithPublicKey(const QString &publicKey) const; 53 | bool hasFriendWithAddress(const QString &address) const; 54 | 55 | void setUserName(const QString& name); 56 | void setStatusMessage(const QString& message); 57 | 58 | void acceptFriendRequest(const QString& userId); 59 | void sendFriendRequest(const QString& userId, const QString& message); 60 | 61 | qint16 getFriendAddressSize() { return TOX_FRIEND_ADDRESS_SIZE * 2; } 62 | qint16 getMaximumUserNameLength() { return TOX_MAX_NAME_LENGTH; } 63 | qint16 getMaximumStatusMessageLength() { return TOX_MAX_STATUSMESSAGE_LENGTH; } 64 | qint16 getMaximumFriendRequestLength() { return TOX_MAX_FRIENDREQUEST_LENGTH; } 65 | 66 | qint16 getFAErrTooLong() { return TOX_FAERR_TOOLONG; } 67 | qint16 getFAErrNoMessage() { return TOX_FAERR_NOMESSAGE; } 68 | qint16 getFAErrOwnKey() { return TOX_FAERR_OWNKEY; } 69 | qint16 getFAErrAlreadySent() { return TOX_FAERR_ALREADYSENT; } 70 | qint16 getFAErrUnknown() { return TOX_FAERR_UNKNOWN; } 71 | qint16 getFAErrBadChecksum() { return TOX_FAERR_BADCHECKSUM; } 72 | qint16 getFAErrSetNewNospam() { return TOX_FAERR_SETNEWNOSPAM; } 73 | qint16 getFAErrNoMem() { return TOX_FAERR_NOMEM; } 74 | 75 | //SIGTERM handling 76 | void handleSigTerm(); 77 | 78 | //Can also be called from the QML code (necessary for non-Unity8 desktop environments) 79 | void cleanUpOnClose(); 80 | 81 | //The following should only be used by ContactsModel!!! 82 | Tox *getToxObject() { return tox; } 83 | 84 | signals: 85 | void toxIdChanged(); 86 | void connectedChanged(); 87 | void userNameChanged(); 88 | void statusMessageChanged(); 89 | 90 | void friendRequestReceived(const QString& userId, const QString& message); 91 | 92 | void friendAdded(int friendId, const QString& userId); 93 | void failedToAddFriend(const QString& userId, const qint16 errorCode = 0); 94 | 95 | private: 96 | Tox *tox; 97 | QTimer *toxTimer; 98 | 99 | QString m_toxId; 100 | bool m_connected; 101 | 102 | void tick(); 103 | void bootstrap(); 104 | void setToxId(QString id); 105 | void setConnected(bool connected); 106 | bool isConnectedCheck(); 107 | 108 | QString getConfigurationFilePath(); 109 | void saveTox(); 110 | bool loadTox(); 111 | 112 | static void onFriendRequest(Tox* tox, const uint8_t* cUserId, const uint8_t* cMessage, uint16_t cMessageSize, void* backend); 113 | 114 | //SIGTERM handling 115 | static int sigtermFd[2]; 116 | QSocketNotifier *termSocketNotifier; 117 | }; 118 | 119 | #endif // TOXBACKEND_H 120 | 121 | -------------------------------------------------------------------------------- /cmake/Click.cmake: -------------------------------------------------------------------------------- 1 | if(CLICK_MODE) 2 | STRING(REPLACE "/usr/" "/" QT_IMPORTS_DIR ${QT_IMPORTS_DIR}) 3 | set(CMAKE_INSTALL_PREFIX /) 4 | set(CMAKE_INSTALL_BINDIR /) 5 | set(DATA_DIR /) 6 | set(EXEC "qmlscene $@ -I .${QT_IMPORTS_DIR} ${UBUNTU-TOX-CLIENT_DIR}/${MAIN_QML}") 7 | set(DESKTOP_DIR ${DATA_DIR}) 8 | set(ICON ".${DATA_DIR}/${ICON}") 9 | install(FILES manifest.json DESTINATION ${CMAKE_INSTALL_PREFIX}) 10 | install(DIRECTORY "app/graphics" DESTINATION ${DATA_DIR}) 11 | install(FILES "${CMAKE_PROJECT_NAME}.json" DESTINATION ${DATA_DIR}) 12 | else(CLICK_MODE) 13 | set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${APP_NAME}) 14 | set(EXEC "qmlscene $@ ${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/qml/${MAIN_QML}") 15 | set(ICON "${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/${ICON}") 16 | set(DESKTOP_DIR ${CMAKE_INSTALL_DATADIR}/applications) 17 | endif(CLICK_MODE) 18 | 19 | -------------------------------------------------------------------------------- /manifest.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@APP_ID@", 3 | "description": "Tox client", 4 | "architecture": "@CLICK_ARCH@", 5 | "title": "@APP_NAME@", 6 | "hooks": { 7 | "ubuntu-tox-client": { 8 | "apparmor": "ubuntu-tox-client.apparmor", 9 | "desktop": "ubuntu-tox-client.desktop" 10 | } 11 | }, 12 | "version": "0.0.2", 13 | "maintainer": "Niklas Wenzel ", 14 | "framework": "ubuntu-sdk-14.10" 15 | } 16 | -------------------------------------------------------------------------------- /po/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(FindGettext) 2 | 3 | # Find the translation tools 4 | find_program(INTLTOOL_MERGE intltool-merge) 5 | if(NOT INTLTOOL_MERGE) 6 | message(FATAL_ERROR "Could not find intltool-merge, please install the intltool package") 7 | endif() 8 | 9 | find_program(INTLTOOL_EXTRACT intltool-extract) 10 | if(NOT INTLTOOL_EXTRACT) 11 | message(FATAL_ERROR "Could not find intltool-extract, please install the intltool package") 12 | endif() 13 | 14 | if(NOT CMAKE_INSTALL_LOCALEDIR) 15 | set(CMAKE_INSTALL_LOCALEDIR "share/locale") 16 | endif() 17 | 18 | find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext) 19 | 20 | set(DOMAIN ${APP_ID}) 21 | set(POT_FILE ${DOMAIN}.pot) 22 | file(GLOB PO_FILES *.po) 23 | 24 | file(GLOB_RECURSE I18N_SRC_FILES 25 | RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 26 | ${CMAKE_SOURCE_DIR}/*.qml 27 | ${CMAKE_SOURCE_DIR}/*.js 28 | ${CMAKE_SOURCE_DIR}/*.cpp 29 | ${CMAKE_SOURCE_DIR}/*.h 30 | ) 31 | list(APPEND I18N_SRC_FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}.in.h) 32 | list(SORT I18N_SRC_FILES) 33 | 34 | add_custom_target(${POT_FILE} ALL 35 | COMMENT "Generating translation template" 36 | # Extract the translatable messages from the desktop file 37 | COMMAND ${INTLTOOL_EXTRACT} --update --type=gettext/ini 38 | --srcdir=${CMAKE_BINARY_DIR}/app ${DESKTOP_FILE_NAME}.in 39 | # Update the translation file 40 | COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} -o ${POT_FILE} 41 | --from-code=UTF-8 42 | --c++ --qt --add-comments=TRANSLATORS 43 | --keyword=tr --keyword=tr:1,2 --keyword=N_ 44 | --package-name='${PROJECT}' 45 | -D ${CMAKE_CURRENT_SOURCE_DIR} ${I18N_SRC_FILES} 46 | # Copy the up2date translation file to the source directory 47 | COMMAND ${CMAKE_COMMAND} -E copy ${POT_FILE} ${CMAKE_CURRENT_SOURCE_DIR} 48 | ) 49 | 50 | foreach(PO_FILE ${PO_FILES}) 51 | get_filename_component(LANG ${PO_FILE} NAME_WE) 52 | gettext_process_po_files(${LANG} ALL PO_FILES ${PO_FILE}) 53 | set(INSTALL_DIR ${CMAKE_INSTALL_LOCALEDIR}/${LANG}/LC_MESSAGES) 54 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo 55 | DESTINATION ${INSTALL_DIR} 56 | RENAME ${DOMAIN}.mo) 57 | endforeach(PO_FILE) 58 | 59 | add_custom_target(${DESKTOP_FILE_NAME} ALL 60 | COMMENT "Merging translations into ${DESKTOP_FILE_NAME}" 61 | COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/po ${CMAKE_BINARY_DIR}/app/${DESKTOP_FILE_NAME}.in ${CMAKE_BINARY_DIR}/app/${DESKTOP_FILE_NAME} > /dev/null 62 | ) 63 | 64 | -------------------------------------------------------------------------------- /po/com.ubuntu.developer.nikwen.ubuntu-tox-client.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: \n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2015-01-21 20:39+0100\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=CHARSET\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: ../app/main.qml:47 21 | msgid "Tox-Client" 22 | msgstr "" 23 | 24 | #: ../app/main.qml:53 ../app/main.qml:155 25 | msgid "Contacts" 26 | msgstr "" 27 | 28 | #: ../app/main.qml:60 29 | msgid "About" 30 | msgstr "" 31 | 32 | #: ../app/main.qml:67 ../app/main.qml:438 33 | msgid "Settings" 34 | msgstr "" 35 | 36 | #: ../app/main.qml:85 37 | msgid "Your Tox-ID is (click to copy):" 38 | msgstr "" 39 | 40 | #: ../app/main.qml:113 41 | msgid "You are connected to the DHT" 42 | msgstr "" 43 | 44 | #: ../app/main.qml:113 45 | msgid "You are not connected to the DHT" 46 | msgstr "" 47 | 48 | #: ../app/main.qml:124 49 | #, qt-format 50 | msgid "Incoming friend request from user %1
Message: %2" 51 | msgstr "" 52 | 53 | #: ../app/main.qml:134 54 | msgid "Accept friend request" 55 | msgstr "" 56 | 57 | #: ../app/main.qml:147 58 | msgid "Added friend successfully! :)" 59 | msgstr "" 60 | 61 | #: ../app/main.qml:147 62 | msgid "Failed to add friend! :(" 63 | msgstr "" 64 | 65 | #: ../app/main.qml:194 66 | msgid "Add a friend" 67 | msgstr "" 68 | 69 | #: ../app/main.qml:200 70 | msgid "Add friend" 71 | msgstr "" 72 | 73 | #: ../app/main.qml:212 ../app/main.qml:459 74 | msgid "Cancel" 75 | msgstr "" 76 | 77 | #: ../app/main.qml:228 78 | msgid "Tox ID:" 79 | msgstr "" 80 | 81 | #: ../app/main.qml:234 82 | msgid "Your friend's Tox ID" 83 | msgstr "" 84 | 85 | #: ../app/main.qml:252 86 | msgid "Message:" 87 | msgstr "" 88 | 89 | #: ../app/main.qml:258 90 | msgid "Let's tox!" 91 | msgstr "" 92 | 93 | #: ../app/main.qml:312 94 | msgid "Updated nospam value" 95 | msgstr "" 96 | 97 | #: ../app/main.qml:314 98 | msgid "Failed to add friend" 99 | msgstr "" 100 | 101 | #: ../app/main.qml:321 102 | msgid "The entered message is too long!" 103 | msgstr "" 104 | 105 | #: ../app/main.qml:323 106 | msgid "No message has been entered!" 107 | msgstr "" 108 | 109 | #: ../app/main.qml:325 110 | msgid "You cannot add yourself as a friend! ;)" 111 | msgstr "" 112 | 113 | #: ../app/main.qml:327 114 | msgid "You have already sent that user a friendship request!" 115 | msgstr "" 116 | 117 | #: ../app/main.qml:329 118 | msgid "Unknown error..." 119 | msgstr "" 120 | 121 | #: ../app/main.qml:331 122 | msgid "There is a checksum error in the entered Tox ID!" 123 | msgstr "" 124 | 125 | #: ../app/main.qml:333 126 | msgid "The nospam value has been updated!" 127 | msgstr "" 128 | 129 | #: ../app/main.qml:335 130 | msgid "Increasing the friend list size has failed!" 131 | msgstr "" 132 | 133 | #: ../app/main.qml:342 134 | msgid "OK" 135 | msgstr "" 136 | 137 | #: ../app/main.qml:357 138 | msgid "Chat with " 139 | msgstr "" 140 | 141 | #: ../app/main.qml:446 142 | msgid "Save" 143 | msgstr "" 144 | 145 | #: ../app/main.qml:483 146 | msgid "User name:" 147 | msgstr "" 148 | 149 | #: ../app/main.qml:506 150 | msgid "Status message:" 151 | msgstr "" 152 | 153 | #: ../app/ui/AboutPage.qml:26 154 | msgid "About ubuntu-tox-client" 155 | msgstr "" 156 | 157 | #: ../app/ui/AboutPage.qml:61 158 | msgid "Info:" 159 | msgstr "" 160 | 161 | #: ../app/ui/AboutPage.qml:65 162 | msgid "Version:" 163 | msgstr "" 164 | 165 | #: ../app/ui/AboutPage.qml:72 166 | msgid "Development:" 167 | msgstr "" 168 | 169 | #: ../app/ui/AboutPage.qml:76 170 | msgid "License:" 171 | msgstr "" 172 | 173 | #: ../app/ui/AboutPage.qml:85 174 | msgid "Source code & bug tracker:" 175 | msgstr "" 176 | 177 | #: ../app/ui/AboutPage.qml:94 178 | msgid "Authors:" 179 | msgstr "" 180 | 181 | #: ../app/ui/AboutPage.qml:100 182 | msgid "Maintainer" 183 | msgstr "" 184 | 185 | #: ../app/ui/AboutPage.qml:105 186 | msgid "Contact:" 187 | msgstr "" 188 | 189 | #: ../app/ui/AboutPage.qml:115 190 | msgid "Uses the following libraries:" 191 | msgstr "" 192 | 193 | #: ../app/ui/AboutPage.qml:130 194 | msgid "ISC license" 195 | msgstr "" 196 | 197 | #: ../app/ui/AboutPage.qml:137 198 | msgid "Uses code from the following projects:" 199 | msgstr "" 200 | 201 | #: /home/robbe/Programmieren/Ubuntu/build-ubuntu-tox-client-Desktop-Default/po/ubuntu-tox-client.desktop.in.h:1 202 | msgid "ubuntu-tox-client" 203 | msgstr "" 204 | -------------------------------------------------------------------------------- /ubuntu-tox-client.apparmor: -------------------------------------------------------------------------------- 1 | { 2 | "policy_groups": [ 3 | "networking" 4 | ], 5 | "policy_version": 1.2 6 | } 7 | 8 | 9 | --------------------------------------------------------------------------------