Exemplo n.º 1
0
Arquivo: note.c Projeto: bhutley/pit
/*
** A note could be deleted as standalone entity or as part of cascading task
** or project delete.
*/
void pit_note_delete(int id, PTask pt)
{
    PNote pn;
    bool standalone = (pt == NULL);

    if (standalone) pit_db_load();
    id = note_find_current(id, &pn);
    if (standalone) pt = (PTask)pit_table_find(tasks, pn->task_id);

    if (pt) {
        char *deleted_message = str2str(pn->message);

        pn = (PNote)pit_table_delete(notes, id);
        if (pn) {
            pit_table_mark(notes, 0); /* TODO: find better current note candidate. */
            note_log_delete(pt->project_id, pt->id, id, deleted_message);
            if (standalone) {
                pt->number_of_notes--;
                pit_db_save();
            }
            free(deleted_message);
        } else {
            free(deleted_message);
            die("could not delete note %d", id);
        }
    } else {
        die("could not find task for note %d", id);
    }
}
Exemplo n.º 2
0
char* torrent_magnet_uri(const struct torrent_handle* h)
{
    assert(h);

    WRAP(
        return str2str(libtorrent::make_magnet_uri(h->h));
    );