Email a note via the command line.
| 128 | |
| 129 | // Email a note via the command line. |
| 130 | int CmdLineTool::emailNote(StartupConfig config) { |
| 131 | // Look to see if another NixNote is running. If so, then we |
| 132 | // expect a response if the note was delete. Otherwise, we |
| 133 | // do it ourself. |
| 134 | bool useCrossMemory = true; |
| 135 | global.sharedMemory->unlock(); |
| 136 | global.sharedMemory->detach(); |
| 137 | if (!global.sharedMemory->attach()) { |
| 138 | useCrossMemory = false; |
| 139 | } |
| 140 | if (useCrossMemory) { |
| 141 | global.sharedMemory->write("EMAIL_NOTE:" + config.email->wrap()); |
| 142 | } else { |
| 143 | global.db = new DatabaseConnection("nixnote"); // Startup the database |
| 144 | return config.email->sendEmail(); |
| 145 | } |
| 146 | return 0; |
| 147 | } |
| 148 | |
| 149 | |
| 150 | // Delete a note via the command line |