about summary refs log tree commit diff stats
path: root/tcoin.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fixed tcoin code1 and tcoin code2 leak, and refactored file permissions into ↵login2024-10-131-40/+96
| | | | | | | | a preprocessor macro Fixed issue with tcoin code1 and tcoin code2. Now they're sent via stdin instead of as arguments to tcoin. Refactored file permissions into a preprocessor macro.
* Fixed bug in thousands separator so that it's not used for messageslogin2023-11-271-6/+6
| | | | The thousands separator was being used for messages and thus became incompatible with pcoin. Now, the thousands separator is only used to display amounts and not stored in the message files for tcoin/pcoin
* Removing thousands separator whenever the output of tcoin is pipedlogin2023-11-251-3/+8
| | | | Whenever the output of tcoin is piped, the thousands separator will not show up now.
* Fixed bug in thousands separatorlogin2023-11-231-4/+10
| | | | When the input is 0, the thousands-separator function was sending nothing. Now, it sends 0.
* Fix to thousands separator functionlogin2023-11-221-4/+6
| | | | The thousands separator function used to add leading zeros to numbers less than three digits. That has been fixed now.
* Added thousands separator to tcoin balance displaylogin2023-11-191-7/+70
| | | | Added thousands separators to tcoin balance display to make large balances easier to read.
* Added the ability to block a user from running tcoinlogin2023-11-041-1/+14
| | | | This was added to prevent tcoin from being run by certain users
* Adding preprocessor directives TCOIN_ERR_CONTACT_EMAIL and ↵login2023-07-231-5/+5
| | | | | | TCOIN_PASS_RESET_CONTACT_EMAIL to parameterise contact details Parameterised contact details via TCOIN_ERR_CONTACT_EMAIL and TCOIN_PASS_RESET_CONTACT_EMAIL will allow them to be customised for tilde.green's tcoin
* locked users should not get krowbar, da or minerbot balanceslogin2023-06-171-0/+3
| | | | locked users should not get krowbar, da or minerbot balances
* Allowing krowbar balance to be negativelogin2023-06-171-1/+3
| | | | Allowing krowbar balance to be negative
* Weakened memory-hardness of scryptlogin (tilde.temm)2023-01-031-2/+2
| | | | Weakened memory-hardness of scrypt to cater to memory requirements of tilde.team
* Close parenthesis properlyJulian Marcos2022-06-271-4/+4
| | | | | | | | | As seems login forgot to close a parenthesis in the manual recovery messages, and also appears like I am hunting for errors in tcoin :) I have just changed the instances of the manual recovery messages from "login@tilde.town (town-only) or login@tilde.team (internet wide [...]" to: "login@tilde.town (town-only) or login@tilde.team (internet wide) [...]"
* Try-catch blocks in those cases where fork() failslogin2022-05-181-16/+35
| | | | | I've tried to add try-catch blocks in those cases where fork()s fail. It doesn't quite work well though.
* Fixes to how total balance are calculatedlogin2022-03-121-26/+26
| | | | I can't believe I made this mistake, but I doublecounted minercoins, so now that doesn't happen.
* Adding jmjl's 'ju coin' to the balancelogin2022-03-111-35/+59
| | | | Adding jmjl's 'ju coin' (which is a copy of tildebot) to the tcoin and pcoin balance
* Changed tildescores file locationlogin2022-01-231-1/+2
| | | | Due to krowbar not being here and krowbar's tildebot not rejoining, shifting tildescores file location to jmjl's tildescores location. jmjl is running krobwar's tildebot with the name 'ju' in tilde.town's internal irc's #bots channel
* made changes to be compatible with minerbot's new "username" format vs. the ↵login2021-12-121-1/+14
| | | | | | | | old "~username" format Made this change so that new "!minercoin ask" awarded minercoins will still show up in tcoin without losing old !minercoins awarded. In other words, the inflation will continue until morale improves.
* pcoin_keys fixedlogin2021-10-171-12/+48
| | | | Thanks to ~jmjl, I was able to find that pcoin_keys didn't work. To fix it, tcoin uses sneaky magic but with stdin isntead of an argument, and a new library imported called popen2, that lets me send both stdin and receive stdout, to successfully get "ls <path to the pcoin_keys directory>" to work (it execl's another instance of the tcoin comand so that it runs under setuid instead of as the original user who ran it.
* Simple mistake, !a || !b is wrong, !a && !b is correctlogin2021-09-301-1/+1
| | | | Simple logical mistake in checking for the TILDEGURU flag has been corrected in tcoin.cpp
* Fixes for tilde.guru to tcoin.cpp and ntcoin_freebsd_tildegurulogin2021-09-301-1/+1
| | | | /usr/bin/whoami doesn't give the euid's username, but the uid's on FreeBSD, so did the same thing I did for tilde.institute, but for tilde.guru too and introduced a new flag for it, TILDEGURU.
* Update the way pcoin_keys works to use a folder/directory instead of a ↵login2021-06-301-14/+23
| | | | | | | | | | single file This is preparing tcoin/pcoin for the automatic registration of program accounts. Eventually, I want program accounts to be tradeable by there being a way to regenerate a new key. So, send the current key to whomever you want the program account to be used by, then the new owner regenerates the key to complete the transfer. The old owner will no longer be able to use the old key to operate the new account. The key is long and the key generation random enough for key collisions to be virtually impossible.
* Better way to handle 5 argumentslogin (__tcoin) (tilde.my.to)2021-02-031-3/+4
| | | | | | Improved the way 5 arguments were handled, where the intention was to send a message along with the amount and receiver, with a new error code and a slightly modified error message.
* Fixed an unhandled case of too many arguments in 'tcoin send'login (__tcoin) (tilde.my.to)2021-02-031-1/+7
| | | | | Fixed a case of too many arguments in 'tcoin send' that wasn't handled. Thank you for finding this ~julian.
* More buffer overflows fixedlogin (__tcoin) (tilde.my.to)2021-01-311-18/+21
| | | | | | | | There were many more places where I had hardcoded values, but should have used strlen() or sizeof(). I have gone through tcoin.cpp and pcoin.cpp, found those, and fixed them. Hopefully, this is all of them.
* Fixed buffer overflow because of hardcoded lengthslogin (__tcoin) (tilde.my.to)2021-01-311-8/+8
| | | | | | | | In user_has_initialised(..), the path lengths were hardcoded. This has now been changed to being calculated via sizeof(). In get_file_value and add_file_value, strlen() was used. This has also been replaced with sizeof().
* Added comment to tcoin.cpplogin2021-01-061-0/+2
| | | | | Added comment to tcoin.cpp to send the actual error message to stderr when running exit_program(err_no).
* Refactored send function in tcoin and pcoinlogin (tilde.institute)2020-10-091-42/+76
| | | | | Refactored the send function in tcoin and pcoin, and in the process, fixed a bug in pcoin's silentsend function.
* Remove outdated commentMineRobber___T2020-10-041-1/+1
| | | The comment referred to using || instead of &&, despite the fact that the code now uses &&.
* Fixed bug in date generation for messages on OpenBSD systemslogin (tilde.institute)2020-09-221-2/+10
| | | | On OpenBSD, the equivalent of %_d is %e. This is fixed for OpenBSD/tilde.institute type systems now.
* Fixed a small syntax error in tcoin.cpplogin (tilde.club)2020-07-241-1/+1
| | | | | | I was planning to make a change that I did not adequately reverse, so I have reversed it fully now. The change I was planning to make was to remove references to login@tilde.town on systems that were not tilde.town, but I decided against that change eventually (but didn't reverse it fully).
* Custom host name possible in tcoin --help nowlogin (tilde.club)2020-07-241-3/+4
| | | | | | | 1. Custom host name now possible in tcoin --help 2. Changes to ntcoin and ntcoin_openbsd_tildeinstitute to fix a bug in -d/--def. 3. Changes to ntcoin and ntcoin_openbsd_tildeinstitute to check for the correct number of arguments. 4. Changes to ntcoin and ntcoin_openbsd_tildeinstitute to include the host name as a preprocessor constant.
* Updated tcoin.cpp and pcoin.cpplogin (tilde.institute)2020-07-141-2/+6
| | | | | | 1. Removed unneeded WHOAMI_PATH preprocessor constant from pcoin.cpp. 2. Updated WHOAMI_PATH for tilde.institute to use "id -ru" to get the real uid on OpenBSD (/usr/bin/whoami doesn't get the real username on OpenBSD).
* Fixed tcoin --help againlogin0002020-04-231-2/+2
| | | I forgot that base_amount held the number of centitildecoins, and that I had to use cout_formatted_amount() to actually send to stdout the number of tildecoins (with decimal places).
* Fixed a typo in void help(long long int)login0002020-04-231-1/+1
| | | I forgot to type "help(" and had just typed "void long long int base_amount)".
* Fixed a mistake in tcoin --helplogin0002020-04-231-3/+3
| | | Brought to my attention by ~mastergeek on tilde.team, the tcoin help incorrectly said that the number of tildecoins a user started with was 1000. It was actually the current base amount (unaltered by other sources like minercoin, tildebot or daily-adventure). Now, the help shows the right amount of starting coins.
* Fixed typo 'creata' to 'create'login2020-03-111-1/+1
| | | | Thanks to ~lickthecheese on tilde.town, tilde.team and other tildeboxes, I was informed of this typo: 'creata' -> 'create'
* Nobody's perfect: .n\n -> .\n\n in tcoin.cpp and pcoin.cpplogin (envs.net)2020-02-221-3/+3
| | | | | And I don't know how to clean my commits after having pushed them to remote origin/master. Maybe a Git stash and hard reset?
* Implemented message-character limits in tcoin.cpp and pcoin.cpplogin (tilde.temm)2020-02-211-0/+30
| | | | | | | | | | | | | After having received a 10000-character transaction message from ~jan6@envs.net, I finally came around to implementing character limits on transaction messages. Previously, I was of the opinion that one should be able to send a movie as a transaction message if one so wished. I took inspiration for an appropriate character limit from Australia's NPP (New Payments Platform), which has a 280-character limit on transaction messages. I strongly suspect this limit came from Twitter's analysis of tweets in different languages and Twitter research that concluded that a 280-character tweet was the appropriate length of tweet. A transaction message is supposedly like a tweet with some money sent along with it.
* Merge branch 'master' of https://github.com/login000/tcoinlogin (tilde.temm)2020-02-211-2/+6
|\ | | | | | | | | I made a mistake. I should have done this before making my commits. That's the only reason why this merge is necessary.
| * Many instances of \u23CE were left unmodified, so those were changed toologin (envs.net)2020-02-221-2/+6
| | | | | | | | | | | | I had forgotten to change \u23CE to <new-line> and introduce a check for <vertical-tab> in many many places in tcoin.cpp and pcoin.cpp. I should probably put these things in some kind of function so I don't repeat myself. I'll probably do that in a future commit.
* | Some more errors (specifically, fatal errors) were taken out into symbolic ↵login (tilde.temm)2020-02-211-10/+19
|/ | | | | | constants I had forgotten to handle the fatal errors and take the error numbers out into symbolic constants. I have now done that in tcoin.cpp and pcoin.cpp
* Separated error codes out into symbolic constants in tcoin.cpp and pcoin.cpplogin (envs.net)2020-02-221-20/+40
| | | | This doesn't change functionality. It is simply a refactor that separates error codes out into symbolic constants in tcoin.cpp and pcoin.cpp.
* Replacing newlines and vertical tabs in messages with <new-line> and ↵login (envs.net)2020-02-211-1/+3
| | | | | | <vertical-tab> Newlines and vertical tabs in messages are replaced with <new-line> and <vertical-tab> to prevent transaction spoofing inside a message.
* Minor grammatical correctionlogin2020-02-041-1/+1
| | | | Just added a period/fullstop to the message in the show_balances() function.
* Improving messaging around messageslogin2019-11-261-3/+43
| | | | The title is confusing, sorry. "No messages found" is shown in tcoin and pcoin when no messages are found (and this no-message message has one newline above and one newline below it instead of two newlines above it as before).
* Fixed newline extra gap when running 'tcoin init'login (tilde.temm)2019-11-151-5/+6
| | | | Just a minor aesthetic fix so that there is even newline gaps between statements when running 'tcoin init'.
* Improving the messaging around sending transaction messageslogin2019-11-151-24/+44
| | | | | | | | | | | Several changes were made that were difficult to separate into separate commits. Since features are directly committed to master, there are no feature branches. The high-level list of changes is as follows: 1. Fixed a bug in pcoin where using "pcoin send -s" for silentsend would forget to add the transaction message that provides a record of who transferred how much and when, even if there is no custom message appended (send_message(.) was not called). 2. Improved the help text to make it clear that sending messages could be done using silentsend too. 3. In several cases in tcoin and pcoin, certain ways of doing a silentsend would still send with verbose output because, by mistake, the option passed to send_message(.) was not changed from "verbose" to "silent". 4. In pcoin, there was the case of 6 arguments missing, where one does pcoin send -s <user> <amount> <message>. This case was handled in tcoin but not pcoin. Now, it is handled in pcoin too. 5. Now, when a custom message is sent in tcoin or pcoin, an additional text confirming the successful sending of the custom message as distinct from the one confirming the sending of the coins is displayed to the user.
* KROWBAR_OFF, DA_OFF and MINERCOIN_OFF are now treated as config definitions~login@aussies.space2019-11-141-4/+0
| | | | | | The KROWBAR_OFF, DA_OFF and MINERCOIN_OFF symbolic constants are now included in tcoin_defs.cpp and pcoin_defs.cpp and have been removed from the main source files, tcoin.cpp and pcoin.cpp. ntcoin has been modified to include #define KROWBAR_OFF, #define DA_OFF and #define MINERCOIN_OFF in pcoin_defs.cpp and tcoin_defs.cpp by default, since those three features are only (as of now) available on the tilde.town server and on no other server.
* Creates separate definition files for tcoin.cpp and pcoin.cpp~login@aussies.space2019-11-141-13/+1
| | | | | | I realised that different tilde servers will have different definitions but the same code otherwise, and 'git push' and 'git pull' to update the code on other servers would override those definitions. Thus, the tcoin.cpp and pcoin.cpp files now look the same for all tildeservers and have a #include "tcoin_defs.cpp" and #include "pcoin_defs.cpp" respectively. The configuration, which is in the form of #define symbolic constants, is stored in tcoin/bin/tcoin_defs.cpp and tcoin/bin/pcoin_defs.cpp. ntcoin is modified to create these two files with the right definitions. ntcoin is also modified so that compile_tcoin and compile_pcoin now include the -I option, which instructs the compiler to look for includes in additional directories, in this case, tcoin/bin .
* Fixing a bug with how time is calculated for messages~login@aussies.space2019-10-071-6/+5
| | | | Benjamin Harris (https://ben.tild3.org, https://github.com/benharri, and https://benharr.is) found a bug where the time recorded for transaction logs/messages was local server time instead of UTC. It should have been UTC no matter what the local time was.