Merge branch '2.3.0' into 2.4.0

Conflicts:
	AUTHORS
	CMakeLists.txt
	NEWS
	src/A3.cpp
	src/CMakeLists.txt
	src/Config.cpp
	src/Duration.cpp
	src/Duration.h
	src/Nibbler.cpp
	src/Nibbler.h
	src/RX.cpp
	src/RX.h
	src/columns/ColDate.cpp
	src/columns/ColScheduled.cpp
	src/commands/Command.cpp
	src/legacy.cpp
	src/utf8.cpp
	src/utf8.h
	test/CMakeLists.txt
	test/bug.mergedeps.t.postponed
	test/duration.t.cpp
	test/merge.duplicates.t
	test/merge.simple_duplication.t
	test/merge.t
	test/nibbler.t.cpp
	test/roundtrip.t
	test/rx.t.cpp
	test/utf8.t.cpp
This commit is contained in:
Paul Beckingham
2014-01-07 19:10:03 -05:00
550 changed files with 6129 additions and 2976 deletions

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <sstream>
#include <algorithm>
#include <stdlib.h>
@@ -39,7 +40,6 @@
#include <i18n.h>
#include <main.h>
#include <A3.h>
#include <cmake.h>
#ifdef FEATURE_STDIN
#include <sys/select.h>
@@ -72,38 +72,37 @@ static struct
std::string op;
int precedence;
char type;
int symbol;
char associativity;
} operators[] =
{
// Operator Precedence Type Symbol Associativity
{ "and", 5, 'b', 0, 'l' }, // Conjunction
{ "xor", 4, 'b', 0, 'l' }, // Disjunction
// Operator Precedence Type Associativity
{ "and", 5, 'b', 'l' }, // Conjunction
{ "xor", 4, 'b', 'l' }, // Disjunction
{ "or", 3, 'b', 0, 'l' }, // Disjunction
{ "<=", 10, 'b', 1, 'l' }, // Less than or equal
{ ">=", 10, 'b', 1, 'l' }, // Greater than or equal
{ "!~", 9, 'b', 1, 'l' }, // Regex non-match
{ "!=", 9, 'b', 1, 'l' }, // Inequal
{ "or", 3, 'b', 'l' }, // Disjunction
{ "<=", 10, 'b', 'l' }, // Less than or equal
{ ">=", 10, 'b', 'l' }, // Greater than or equal
{ "!~", 9, 'b', 'l' }, // Regex non-match
{ "!=", 9, 'b', 'l' }, // Inequal
{ "=", 9, 'b', 1, 'l' }, // Equal
// { "^", 16, 'b', 1, 'r' }, // Exponent
{ ">", 10, 'b', 1, 'l' }, // Greater than
{ "~", 9, 'b', 1, 'l' }, // Regex match
{ "!", 15, 'u', 1, 'r' }, // Not
{ "=", 9, 'b', 'l' }, // Equal
// { "^", 16, 'b', 'r' }, // Exponent
{ ">", 10, 'b', 'l' }, // Greater than
{ "~", 9, 'b', 'l' }, // Regex match
{ "!", 15, 'u', 'r' }, // Not
{ "_hastag_", 9, 'b', 0, 'l'}, // +tag [Pseudo-op]
{ "_notag_", 9, 'b', 0, 'l'}, // -tag [Pseudo-op]
{ "_hastag_", 9, 'b', 'l'}, // +tag [Pseudo-op]
{ "_notag_", 9, 'b', 'l'}, // -tag [Pseudo-op]
{ "-", 15, 'u', 1, 'r' }, // Unary minus
{ "*", 13, 'b', 1, 'l' }, // Multiplication
{ "/", 13, 'b', 1, 'l' }, // Division
// { "%", 13, 'b', 1, 'l' }, // Modulus
{ "+", 12, 'b', 1, 'l' }, // Addition
{ "-", 12, 'b', 1, 'l' }, // Subtraction
{ "<", 10, 'b', 1, 'l' }, // Less than
{ "(", 0, 'b', 1, 'l' }, // Precedence start
{ ")", 0, 'b', 1, 'l' }, // Precedence end
{ "-", 15, 'u', 'r' }, // Unary minus
{ "*", 13, 'b', 'l' }, // Multiplication
{ "/", 13, 'b', 'l' }, // Division
// { "%", 13, 'b', 'l' }, // Modulus
{ "+", 12, 'b', 'l' }, // Addition
{ "-", 12, 'b', 'l' }, // Subtraction
{ "<", 10, 'b', 'l' }, // Less than
{ "(", 0, 'b', 'l' }, // Precedence start
{ ")", 0, 'b', 'l' }, // Precedence end
};
#define NUM_MODIFIER_NAMES (sizeof (modifierNames) / sizeof (modifierNames[0]))
@@ -1141,6 +1140,9 @@ const A3 A3::sequence (const A3& input) const
if (ids.size () == 0 && uuids.size () == 0)
return input;
if (ids.size () == 1 && ids[0] < 1)
throw format (STRING_A3_ZERO_ID, ids[0]);
// Copy everything up to the first id/uuid.
for (arg = input.begin (); arg != input.end (); ++arg)
{
@@ -1371,7 +1373,6 @@ bool A3::is_attmod (Nibbler& n, Arg& arg)
std::string canonical;
std::string modifier;
std::string value;
// time_t date;
// If there is a valid attribute name.
if (n.getName (name) &&
@@ -1403,14 +1404,6 @@ bool A3::is_attmod (Nibbler& n, Arg& arg)
n.getUntilEOS (value) || // Redundant?
n.depleted ())
{
/*
TODO Eliminate anything that looks like a URL.
// Exclude certain URLs, that look like attrs.
if (value.find ('@') <= n.cursor () ||
value.find ('/') <= n.cursor ())
return false;
*/
arg._raw = canonical + '.' + modifier + ':' + value;
Column* col = context.columns[canonical];
arg._type = col ? Arg::type_id (col->type ()) : Arg::type_pseudo;
@@ -1575,6 +1568,7 @@ bool A3::is_dom (Nibbler& n, Arg& arg)
////////////////////////////////////////////////////////////////////////////////
bool A3::is_date (Nibbler& n, std::string& result)
{
#ifdef NIBBLER_FEATURE_DATE
std::string date_format = context.config.get ("dateformat");
std::string::size_type start = n.save ();
time_t t;
@@ -1586,6 +1580,7 @@ bool A3::is_date (Nibbler& n, std::string& result)
}
n.restore ();
#endif
return false;
}

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Arg.h>
#include <Context.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -33,6 +33,7 @@ set (task_SRCS A3.cpp A3.h
Task.cpp Task.h
Taskmod.cpp Taskmod.h
Timer.cpp Timer.h
TLSClient.cpp TLSClient.h
Transport.cpp Transport.h
TransportCurl.cpp TransportCurl.h
TransportRSYNC.cpp TransportRSYNC.h

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <iomanip>
#include <sstream>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,8 @@
#include <string>
#define FEATURE_COLOR 1
////////////////////////////////////////////////////////////////////////////////
#define _COLOR_INVERSE 0x00400000 // Inverse attribute.
#define _COLOR_256 0x00200000 // 256-color mode.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <fstream>
#include <sstream>
@@ -37,10 +38,10 @@
#include <Date.h>
#include <File.h>
#include <Timer.h>
#include <JSON.h>
#include <Config.h>
#include <text.h>
#include <util.h>
#include <cmake.h>
#include <i18n.h>
////////////////////////////////////////////////////////////////////////////////
@@ -290,17 +291,17 @@ std::string Config::_defaults =
"list.all.tags=no # Include old tag names in 'tags' command\n"
"print.empty.columns=no # Print columns which have no data for any task\n"
"debug=no # Display diagnostics\n"
"debug.tls=0 # GnuTLS log level\n"
"extensions=off # Extension system master switch\n"
"fontunderline=yes # Uses underlines rather than -------\n"
"shell.prompt=task> # Prompt used by the shell command\n"
"\n"
"# Merge options\n"
"#\n"
"# WARNING: Please read the documentation (man task-sync) before proceeding with these\n"
"# synchronization features. If improperly used, data can be lost!\n"
"merge.autopush=ask # Push database to remote origin after merge: yes, no, ask\n"
"#merge.default.uri=user@host.xz:.task/ # URI for merge\n"
"#pull.default.uri=rsync://host.xz/task-backup/ # URI for pull\n"
"# WARNING: Please read the documentation (man task-sync) before setting up\n"
"# Taskwarrior for Taskserver synchronization.\n"
"#taskd.certificate <certificat file>\n"
"#taskd.credentials <organization>/<name>/<password>\n"
"#taskd.server <server>:<port>\n"
"taskd.ciphers=NORMAL\n"
"\n"
"# Aliases - alternate names for commands\n"
"alias.rm=delete # Alias for the delete command\n"
@@ -308,6 +309,7 @@ std::string Config::_defaults =
"alias.ghistory=ghistory.monthly # Prefer monthly graphical over annual history reports\n"
"alias._query=export # _query is now export\n"
"alias.burndown=burndown.weekly # Prefer the weekly burndown chart\n"
"alias.shell=exec tasksh # Alias old shell command to new shell\n"
"\n"
"# Reports\n"
"\n"
@@ -377,7 +379,6 @@ std::string Config::_defaults =
"report.waiting.filter=+WAITING\n"
"report.waiting.sort=due+,wait+,entry+\n"
"\n"
// Updated.
"report.all.description=Pending, waiting and completed tasks by age\n"
"report.all.labels=ID,St,UUID,A,Age,Done,D,P,Project,Tags,R,Wait,Sch,Due,Until,Description\n"
"report.all.columns=id,status.short,uuid.short,start.active,entry.age,end.age,depends.indicator,priority,project.parent,tags.count,recur.indicator,wait.age,scheduled.age,due,until.age,description\n"
@@ -496,7 +497,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */)
std::string key = trim (line.substr (0, equal), " \t"); // no i18n
std::string value = trim (line.substr (equal+1, line.length () - equal), " \t"); // no i18n
(*this)[key] = value;
(*this)[key] = json::decode (value);
}
else
{

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006 - 2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <fstream>
#include <sstream>
@@ -40,7 +41,6 @@
#include <util.h>
#include <main.h>
#include <i18n.h>
#include <cmake.h>
#ifdef HAVE_COMMIT
#include <commit.h>
#endif
@@ -152,10 +152,6 @@ int Context::initialize (int argc, const char** argv)
// Apply rc overrides to Context::config, capturing raw args for later use.
a3.apply_overrides ();
// Now that the final RC is in place, initialize the urgency coefficients
// to speed the 'next' report.
initializeUrgencyCoefficients ();
// Initialize the color rules, if necessary.
if (color ())
initializeColorRules ();
@@ -166,6 +162,9 @@ int Context::initialize (int argc, const char** argv)
// Instantiate built-in column objects.
Column::factory (columns);
// Static initialization to decouple code.
staticInitialization ();
// Categorize all arguments one more time. THIS IS NECESSARY - it helps the
// following inject_defaults method determine whether there needs to be a
// default command assumed.
@@ -597,6 +596,48 @@ const std::vector <std::string> Context::getCommands () const
return output;
}
////////////////////////////////////////////////////////////////////////////////
// The 'Task' object, among others, is shared between projects. To make this
// easier, it has been decoupled from Context.
void Context::staticInitialization ()
{
Task::defaultProject = config.get ("default.project");
Task::defaultPriority = config.get ("default.priority");
Task::defaultDue = config.get ("default.due");
Task::searchCaseSensitive = config.getBoolean ("search.case.sensitive");
Task::regex = config.getBoolean ("regex");
std::map <std::string, Column*>::iterator i;
for (i = columns.begin (); i != columns.end (); ++i)
Task::attributes[i->first] = i->second->type ();
Task::urgencyPriorityCoefficient = config.getReal ("urgency.priority.coefficient");
Task::urgencyProjectCoefficient = config.getReal ("urgency.project.coefficient");
Task::urgencyActiveCoefficient = config.getReal ("urgency.active.coefficient");
Task::urgencyScheduledCoefficient = config.getReal ("urgency.scheduled.coefficient");
Task::urgencyWaitingCoefficient = config.getReal ("urgency.waiting.coefficient");
Task::urgencyBlockedCoefficient = config.getReal ("urgency.blocked.coefficient");
Task::urgencyAnnotationsCoefficient = config.getReal ("urgency.annotations.coefficient");
Task::urgencyTagsCoefficient = config.getReal ("urgency.tags.coefficient");
Task::urgencyNextCoefficient = config.getReal ("urgency.next.coefficient");
Task::urgencyDueCoefficient = config.getReal ("urgency.due.coefficient");
Task::urgencyBlockingCoefficient = config.getReal ("urgency.blocking.coefficient");
Task::urgencyAgeCoefficient = config.getReal ("urgency.age.coefficient");
Task::urgencyAgeMax = config.getReal ("urgency.age.max");
// Tag- and project-specific coefficients.
std::vector <std::string> all;
config.all (all);
std::vector <std::string>::iterator var;
for (var = all.begin (); var != all.end (); ++var)
{
if (var->substr (0, 13) == "urgency.user." ||
var->substr (0, 12) == "urgency.uda.")
Task::coefficients[*var] = config.getReal (*var);
}
}
////////////////////////////////////////////////////////////////////////////////
void Context::assumeLocations ()
{

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -75,6 +75,7 @@ public:
void decomposeSortField (const std::string&, std::string&, bool&);
private:
void staticInitialization ();
void assumeLocations ();
void createDefaultConfig ();
void loadAliases ();

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,13 +25,13 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <sstream>
#include <Context.h>
#include <Nibbler.h>
#include <text.h>
#include <i18n.h>
#include <DOM.h>
#include <cmake.h>
extern Context context;
@@ -73,6 +73,7 @@ const std::vector <std::string> DOM::get_references () const
//
// system.version
// system.os
//
const std::string DOM::get (const std::string& name)
{
int len = name.length ();
@@ -86,20 +87,20 @@ const std::string DOM::get (const std::string& name)
}
// context.*
else if (len > 8 &&
if (len > 8 &&
name.substr (0, 8) == "context.")
{
if (name == "context.program") return context.a3[0]._raw;
else if (name == "context.args") return context.a3.combine ();
else if (name == "context.width") return format (context.terminal_width);
else if (name == "context.height") return format (context.terminal_height);
else if (name == "context.width") return format (context.terminal_width ? context.terminal_width : context.getWidth ());
else if (name == "context.height") return format (context.terminal_height ? context.terminal_height : context.getHeight ());
else throw format (STRING_DOM_UNREC, name);
}
// TODO stats.<name>
// system. --> Implement locally.
else if (len > 7 &&
if (len > 7 &&
name.substr (0, 7) == "system.")
{
// Taskwarrior version number.
@@ -143,53 +144,26 @@ const std::string DOM::get (const std::string& name)
////////////////////////////////////////////////////////////////////////////////
// DOM Supported References:
//
// TODO <id>.{entry,start,end,scheduled,due,until,wait}
// TODO <id>.description
// TODO <id>.project
// TODO <id>.priority
// TODO <id>.parent
// TODO <id>.status
// TODO <id>.tags
// TODO <id>.urgency
// TODO <id>.recur
// TODO <id>.depends
//
// TODO <uuid>.{entry,start,end,scheduled,due,until,wait}
// TODO <uuid>.description
// TODO <uuid>.project
// TODO <uuid>.priority
// TODO <uuid>.parent
// TODO <uuid>.status
// TODO <uuid>.tags
// TODO <uuid>.urgency
// TODO <uuid>.recur
// TODO <uuid>.depends
//
// {entry,start,end,scheduled,due,until,wait}
// description
// project
// priority
// parent
// status
// tags
// urgency
// recur
// depends
// <attribute>
// <id>.<attribute>
// <uuid>.<attribute>
//
const std::string DOM::get (const std::string& name, const Task& task)
{
Nibbler n (name);
n.save ();
int id;
std::string uuid;
std::string canonical;
// <attr>
if (name == "id") return format (task.id);
else if (name == "urgency") return format (task.urgency_c (), 4, 3);
else if (name == "urgency") return format (task.urgency_c ());
else if (A3::is_attribute (name, canonical)) return task.get (canonical);
// <id>.<name>
else if (n.getInt (id))
if (n.getInt (id))
{
if (n.skip ('.'))
{
@@ -203,13 +177,15 @@ const std::string DOM::get (const std::string& name, const Task& task)
n.getUntilEOS (attr);
if (attr == "id") return format (ref.id);
else if (attr == "urgency") return format (ref.urgency_c (), 4, 3);
else if (attr == "urgency") return format (ref.urgency_c ());
else if (A3::is_attribute (attr, canonical)) return ref.get (canonical);
}
n.restore ();
}
// <uuid>.<name>
else if (n.getUUID (uuid))
if (n.getUUID (uuid))
{
if (n.skip ('.'))
{
@@ -222,10 +198,12 @@ const std::string DOM::get (const std::string& name, const Task& task)
std::string attr;
n.getUntilEOS (attr);
if (name == "id") return format (ref.id);
else if (name == "urgency") return format (ref.urgency_c (), 4, 3);
if (attr == "id") return format (ref.id);
else if (attr == "urgency") return format (ref.urgency_c (), 4, 3);
else if (A3::is_attribute (attr, canonical)) return ref.get (canonical);
}
n.restore ();
}
// Delegate to the context-free version of DOM::get.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iomanip>
#include <sstream>
#include <time.h>
@@ -133,8 +134,10 @@ Date::Date (const std::string& input, const std::string& format /* = "m/d/Y" */)
// Parse a formatted date.
Nibbler n (input);
#ifdef NIBBLER_FEATURE_DATE
if (n.getDate (format, _t) && n.depleted ())
return;
#endif
// Parse an ISO date.
if (n.getDateISO (_t) && n.depleted ())
@@ -582,6 +585,12 @@ int Date::month () const
return t->tm_mon + 1;
}
////////////////////////////////////////////////////////////////////////////////
int Date::week () const
{
return Date::weekOfYear (Date::dayOfWeek (context.config.get ("weekstart")));
}
////////////////////////////////////////////////////////////////////////////////
int Date::day () const
{
@@ -676,6 +685,16 @@ bool Date::sameDay (const Date& rhs) const
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Date::sameWeek (const Date& rhs) const
{
if (this->year () == rhs.year () &&
this->week () == rhs.week ())
return true;
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Date::sameMonth (const Date& rhs) const
{
@@ -834,8 +853,7 @@ bool Date::isRelativeDate (const std::string& input)
found == "eoww" ||
found == "eocw" ||
found == "sow" ||
found == "soww" ||
found == "socw")
found == "soww")
{
if (found == "eow" || found == "eoww")
dow = 5;
@@ -846,9 +864,6 @@ bool Date::isRelativeDate (const std::string& input)
if (found == "sow" || found == "soww")
dow = 1;
if (found == "socw")
dow = Date::dayOfWeek (context.config.get ("weekstart"));
if (today.dayOfWeek () >= dow)
today += (dow - today.dayOfWeek () + 7) * 86400;
else
@@ -861,6 +876,28 @@ bool Date::isRelativeDate (const std::string& input)
_t = then._t;
return true;
}
else if (found == "socw")
{
// day S M T W T F S
// dow 0 1 2 3 4 5 6
// -----------------------
// weekstart ^
// today1 ^
// today2 ^
//
// delta1 = 6 <-- (0 - 1 + 7) % 7
// delta2 = 3 <-- (4 - 1 + 7) % 7
dow = Date::dayOfWeek (context.config.get ("weekstart"));
int delta = (today.dayOfWeek () - dow + 7) % 7;
today -= delta * 86400;
Date then (today.month (), today.day (), today.year ());
_t = then._t;
return true;
}
else if (found == "today")
{
Date then (today.month (),

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -29,9 +29,9 @@
#define INCLUDED_DATE
#include <stdio.h>
#include <vector>
#include <string>
class Date;
class Date
@@ -76,6 +76,7 @@ public:
static int length (const std::string&);
int month () const;
int week () const;
int day () const;
int year () const;
int weekOfYear (int) const;
@@ -93,6 +94,7 @@ public:
bool operator>= (const Date&) const;
bool sameHour (const Date&) const;
bool sameDay (const Date&) const;
bool sameWeek (const Date&) const;
bool sameMonth (const Date&) const;
bool sameYear (const Date&) const;

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -33,7 +34,6 @@
#include <errno.h>
#include <stdlib.h>
#include <Directory.h>
#include <cmake.h>
#ifdef SOLARIS
#include <limits.h>
@@ -85,19 +85,19 @@ Directory& Directory::operator= (const Directory& other)
}
////////////////////////////////////////////////////////////////////////////////
bool Directory::create ()
bool Directory::create (int mode /* = 0755 */)
{
return mkdir (_data.c_str (), 0755) == 0 ? true : false;
return mkdir (_data.c_str (), mode) == 0 ? true : false;
}
////////////////////////////////////////////////////////////////////////////////
bool Directory::remove ()
bool Directory::remove () const
{
return remove_directory (_data);
}
////////////////////////////////////////////////////////////////////////////////
bool Directory::remove_directory (const std::string& dir)
bool Directory::remove_directory (const std::string& dir) const
{
DIR* dp = opendir (dir.c_str ());
if (dp != NULL)
@@ -191,6 +191,12 @@ bool Directory::up ()
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Directory::cd () const
{
return chdir (_data.c_str ()) == 0 ? true : false;
}
////////////////////////////////////////////////////////////////////////////////
void Directory::list (
const std::string& base,

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -42,18 +42,19 @@ public:
Directory& operator= (const Directory&);
virtual bool create ();
virtual bool remove ();
virtual bool create (int mode = 0755);
virtual bool remove () const;
std::vector <std::string> list ();
std::vector <std::string> listRecursive ();
static std::string cwd ();
bool up ();
bool cd () const;
private:
void list (const std::string&, std::vector <std::string>&, bool);
bool remove_directory (const std::string&);
bool remove_directory (const std::string&) const;
};
#endif

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,8 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <stdlib.h>
#include <Context.h>
#include <Date.h>
@@ -183,7 +185,10 @@ void E9::eval (const Task& task, std::vector <Arg>& value_stack)
{
OldDuration dur (operand._raw);
Date now;
now += (int)(time_t) dur;
if (dur.negative ())
now -= (int)(time_t) dur;
else
now += (int)(time_t) dur;
operand._value = now.toEpochString ();
}
else

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,8 +25,10 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <fstream>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <pwd.h>
#include <unistd.h>
@@ -89,10 +91,11 @@ File& File::operator= (const File& other)
}
////////////////////////////////////////////////////////////////////////////////
bool File::create ()
bool File::create (int mode /* = 0640 */)
{
if (open ())
{
fchmod (_h, mode);
close ();
return true;
}
@@ -101,7 +104,7 @@ bool File::create ()
}
////////////////////////////////////////////////////////////////////////////////
bool File::remove ()
bool File::remove () const
{
return unlink (_data.c_str ()) == 0 ? true : false;
}
@@ -193,12 +196,13 @@ bool File::waitForLock ()
void File::read (std::string& contents)
{
contents = "";
contents.reserve (size ());
std::ifstream in (_data.c_str ());
if (in.good ())
{
std::string line;
line.reserve (1024);
line.reserve (512 * 1024);
while (getline (in, line))
contents += line + "\n";
@@ -216,7 +220,7 @@ void File::read (std::vector <std::string>& contents)
if (in.good ())
{
std::string line;
line.reserve (1024);
line.reserve (512 * 1024);
while (getline (in, line))
contents.push_back (line);
@@ -336,12 +340,38 @@ time_t File::mtime () const
}
////////////////////////////////////////////////////////////////////////////////
bool File::create (const std::string& name)
time_t File::ctime () const
{
std::ofstream out (expand (name).c_str ());
struct stat s;
if (!stat (_data.c_str (), &s))
return s.st_ctime;
return 0;
}
////////////////////////////////////////////////////////////////////////////////
time_t File::btime () const
{
struct stat s;
if (!stat (_data.c_str (), &s))
#ifdef HAVE_ST_BIRTHTIME
return s.st_birthtime;
#else
return s.st_ctime;
#endif
return 0;
}
////////////////////////////////////////////////////////////////////////////////
bool File::create (const std::string& name, int mode /* = 0640 */)
{
std::string full_name = expand (name);
std::ofstream out (full_name.c_str ());
if (out.good ())
{
out.close ();
chmod (full_name.c_str (), mode);
return true;
}

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -45,8 +45,8 @@ public:
File& operator= (const File&);
virtual bool create ();
virtual bool remove ();
virtual bool create (int mode = 0640);
virtual bool remove () const;
bool open ();
bool openAndLock ();
@@ -69,8 +69,10 @@ public:
virtual mode_t mode ();
virtual size_t size () const;
virtual time_t mtime () const;
virtual time_t ctime () const;
virtual time_t btime () const;
static bool create (const std::string&);
static bool create (const std::string&, int mode = 0640);
static std::string read (const std::string&);
static bool read (const std::string&, std::string&);
static bool read (const std::string&, std::vector <std::string>&);

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <algorithm>
#include <Context.h>
@@ -105,25 +106,21 @@ void Hooks::initialize ()
bool big_red_switch = context.config.getBoolean ("extensions");
if (big_red_switch)
{
std::vector <std::string> vars;
context.config.all (vars);
std::vector <std::string>::iterator it;
for (it = vars.begin (); it != vars.end (); ++it)
Config::const_iterator it;
for (it = context.config.begin (); it != context.config.end (); ++it)
{
std::string type;
std::string name;
std::string value;
// "<type>.<name>"
Nibbler n (*it);
Nibbler n (it->first);
if (n.getUntil ('.', type) &&
type == "hook" &&
n.skip ('.') &&
n.getUntilEOS (name))
{
std::string value = context.config.get (*it);
Nibbler n (value);
Nibbler n (it->second);
// <path>:<function> [, ...]
while (!n.depleted ())
@@ -141,7 +138,7 @@ void Hooks::initialize ()
(void) n.skip (',');
}
else
; // Was: throw std::string (format ("Malformed hook definition '{1}'.", *it));
; // Was: throw std::string (format ("Malformed hook definition '{1}'.", it->first));
}
}
}

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -30,7 +30,6 @@
#include <vector>
#include <string>
#include <cmake.h>
// Hook class representing a single hook, which is just a three-way map.
class Hook

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <text.h>
#include <i18n.h>
#include <utf8.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2012, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,9 +25,9 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Msg.h>
#include <text.h>
#include <cmake.h>
////////////////////////////////////////////////////////////////////////////////
Msg::Msg ()
@@ -35,7 +35,7 @@ Msg::Msg ()
{
// All messages are marked with the version number, so that the messages may
// be properly evaluated in context.
_header["version"] = PACKAGE_STRING;
_header["client"] = PACKAGE_STRING;
}
////////////////////////////////////////////////////////////////////////////////
@@ -145,26 +145,25 @@ bool Msg::parse (const std::string& input)
_header.clear ();
_payload = "";
std::vector <std::string> lines;
split (lines, input.substr (0, input.size ()), '\n');
std::string::size_type separator = input.find ("\n\n");
if (separator == std::string::npos)
throw std::string ("ERROR: Malformed message");
// Parse header.
std::vector <std::string> lines;
split (lines, input.substr (0, separator), '\n');
std::vector <std::string>::iterator i;
bool tripped = false;
for (i = lines.begin (); i != lines.end (); ++i)
{
if (*i == "")
tripped = true;
else if (tripped)
_payload += *i + "\n";
else
{
std::string::size_type delim = i->find (": ");
if (delim != std::string::npos)
_header[i->substr (0, delim)] = i->substr (delim + 2);
else
std::string::size_type delimiter = i->find (':');
if (delimiter == std::string::npos)
throw std::string ("ERROR: Malformed message header '") + *i + "'";
_header[trim (i->substr (0, delimiter))] = trim (i->substr (delimiter + 1));
}
}
// Parse payload.
_payload = input.substr (separator + 2);
return true;
}

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2012, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <fstream>
#include <glob.h>
#include <sys/types.h>
@@ -33,8 +34,8 @@
#include <pwd.h>
#include <stdio.h>
#include <unistd.h>
#include <limits.h>
#include <Path.h>
#include <cmake.h>
////////////////////////////////////////////////////////////////////////////////
std::ostream& operator<< (std::ostream& out, const Path& path)
@@ -88,6 +89,13 @@ bool Path::operator== (const Path& other)
return _data == other._data;
}
////////////////////////////////////////////////////////////////////////////////
Path& Path::operator+= (const std::string& dir)
{
_data += "/" + dir;
return *this;
}
////////////////////////////////////////////////////////////////////////////////
Path::operator std::string () const
{
@@ -153,7 +161,7 @@ bool Path::is_directory () const
////////////////////////////////////////////////////////////////////////////////
bool Path::is_absolute () const
{
if (_data.length () && _data.substr (0, 1) == "/")
if (_data.length () && _data[0] == '/')
return true;
return false;
@@ -197,6 +205,8 @@ bool Path::rename (const std::string& new_name)
// ~ --> /home/user
// ~foo/x --> /home/foo/s
// ~/x --> /home/foo/x
// ./x --> $PWD/x
// x --> $PWD/x
std::string Path::expand (const std::string& in)
{
std::string copy = in;
@@ -234,6 +244,23 @@ std::string Path::expand (const std::string& in)
}
}
// Relative paths
else if (in.length () > 2 &&
in.substr (0, 2) == "./")
{
char buf[PATH_MAX];
getcwd (buf, PATH_MAX - 1);
copy = std::string (buf) + "/" + in.substr (2);
}
else if (in.length () > 1 &&
in[0] != '.' &&
in[0] != '/')
{
char buf[PATH_MAX];
getcwd (buf, PATH_MAX - 1);
copy = std::string (buf) + "/" + in;
}
return copy;
}

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -28,7 +28,6 @@
#ifndef INCLUDED_PATH
#define INCLUDED_PATH
#include <iostream>
#include <vector>
#include <string>
@@ -42,6 +41,7 @@ public:
Path& operator= (const Path&);
bool operator== (const Path&);
Path& operator+= (const std::string&);
operator std::string () const;
std::string name () const;

View File

@@ -1,307 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2012, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// http://www.opensource.org/licenses/mit-license.php
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <stdarg.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/errno.h>
#include <netdb.h>
#include <unistd.h>
#include <string.h>
#include <Socket.h>
////////////////////////////////////////////////////////////////////////////////
Socket::Socket () :
_socket (0),
_limit (0), // Unlimited
_debug (false)
{
}
////////////////////////////////////////////////////////////////////////////////
Socket::Socket (int s) :
_socket (s),
_limit (0), // Unlimited
_debug (false)
{
}
////////////////////////////////////////////////////////////////////////////////
Socket::~Socket ()
{
close ();
}
////////////////////////////////////////////////////////////////////////////////
// For clients.
void Socket::connect (const std::string& host, const std::string& port)
{
// use IPv4 or IPv6, does not matter.
struct addrinfo hints;
memset (&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE; // use my IP
struct addrinfo* res;
if (::getaddrinfo (host.c_str (), port.c_str (), &hints, &res) != 0)
throw "ERROR: " + std::string (::gai_strerror (errno));
// Try them all, stop on success.
struct addrinfo* p;
for (p = res; p != NULL; p = p->ai_next)
{
if ((_socket = ::socket (p->ai_family, p->ai_socktype, p->ai_protocol)) == -1)
continue;
// When a socket is closed, it remains unavailable for a while (netstat -an).
// Setting SO_REUSEADDR allows this program to assume control of a closed,
// but unavailable socket.
int on = 1;
if (::setsockopt (_socket,
SOL_SOCKET,
SO_REUSEADDR,
(const void*) &on,
sizeof (on)) == -1)
throw "ERROR: " + std::string (::strerror (errno));
if (::connect (_socket, p->ai_addr, p->ai_addrlen) == -1)
{
close ();
continue;
}
break;
}
free (res);
if (p == NULL)
throw "ERROR: Could not connect to " + host + " " + port;
}
////////////////////////////////////////////////////////////////////////////////
void Socket::close ()
{
if (_socket)
::close (_socket);
_socket = 0;
}
////////////////////////////////////////////////////////////////////////////////
// For servers.
void Socket::bind (const std::string& port)
{
// use IPv4 or IPv6, does not matter.
struct addrinfo hints;
memset (&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE; // use my IP
struct addrinfo* res;
if (::getaddrinfo (NULL, port.c_str (), &hints, &res) != 0)
throw "ERROR: " + std::string (::gai_strerror (errno));
if ((_socket = ::socket (res->ai_family,
res->ai_socktype,
res->ai_protocol)) == -1)
throw "ERROR: Can not bind to port " + port;
// When a socket is closed, it remains unavailable for a while (netstat -an).
// Setting SO_REUSEADDR allows this program to assume control of a closed, but
// unavailable socket.
int on = 1;
if (::setsockopt (_socket,
SOL_SOCKET,
SO_REUSEADDR,
(const void*) &on,
sizeof (on)) == -1)
throw "ERROR: " + std::string (::strerror (errno));
if (::bind (_socket, res->ai_addr, res->ai_addrlen) == -1)
throw "ERROR: " + std::string (::strerror (errno));
}
////////////////////////////////////////////////////////////////////////////////
void Socket::listen (int queue /*= 5*/)
{
if (::listen (_socket, queue) < 0)
throw "ERROR: " + std::string (::strerror (errno));
}
////////////////////////////////////////////////////////////////////////////////
int Socket::accept ()
{
struct sockaddr_storage client;
socklen_t length = sizeof client;
int connection;
do
{
memset (&client, 0, length);
connection = ::accept (_socket, (struct sockaddr*) &client, &length);
}
while (errno == EINTR);
if (connection < 0)
throw "ERROR: " + std::string (::strerror (errno));
return connection;
}
////////////////////////////////////////////////////////////////////////////////
void Socket::write (const std::string& data)
{
std::string packet = "XXXX" + data;
// Encode the length.
unsigned long l = packet.length ();
packet[0] = l >>24;
packet[1] = l >>16;
packet[2] = l >>8;
packet[3] = l;
int total = 0;
int remaining = packet.length ();
while (total < remaining)
{
int status;
do
{
status = ::send (_socket, packet.c_str () + total, remaining, 0);
}
while (errno == EINTR);
if (status == -1)
break;
total += status;
remaining -= status;
}
if (_debug)
std::cout << ">>> "
<< data.c_str ()
<< " (" << total << " bytes)"
<< std::endl;
}
////////////////////////////////////////////////////////////////////////////////
void Socket::read (std::string& data)
{
data = ""; // No appending of data.
int received = 0;
// Get the encoded length.
unsigned char header[4];
do
{
received = ::recv (_socket, header, sizeof (header), 0);
}
while (errno == EINTR);
int total = received;
// Decode the length.
unsigned long expected = (header[0]<<24) |
(header[1]<<16) |
(header[2]<<8) |
header[3];
// TODO This would be a good place to assert 'expected < _limit'.
// Arbitrary buffer size.
char buffer[8192];
// Keep reading until no more data. Concatenate chunks of data if a) the
// read was interrupted by a signal, and b) if there is more data than
// fits in the buffer.
do
{
do
{
received = ::recv (_socket, buffer, sizeof (buffer) - 1, 0);
}
while (errno == EINTR);
// Other end closed the connection.
if (received == 0)
break;
// Something happened.
if (received < 0)
throw "ERROR: " + std::string (::strerror (errno));
buffer [received] = '\0';
data += buffer;
total += received;
// Stop at defined limit.
if (_limit && total > _limit)
break;
}
while (received > 0 && total < (int) expected);
if (_debug)
std::cout << "<<< "
<< data.c_str ()
<< " (" << total << " bytes)"
<< std::endl;
}
////////////////////////////////////////////////////////////////////////////////
void Socket::limit (int max)
{
_limit = max;
}
////////////////////////////////////////////////////////////////////////////////
// Calling this method results in all subsequent socket traffic being sent to
// std::cout, labelled with >>> for outgoing, <<< for incoming.
void Socket::debug ()
{
_debug = true;
}
////////////////////////////////////////////////////////////////////////////////
// get sockaddr, IPv4 or IPv6:
void* Socket::get_in_addr (struct sockaddr* sa)
{
if (sa->sa_family == AF_INET)
return &(((struct sockaddr_in*) sa)->sin_addr);
return &(((struct sockaddr_in6*) sa)->sin6_addr);
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,12 +25,14 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <list>
#include <set>
#include <stdlib.h>
#include <signal.h>
#include <Context.h>
#include <Color.h>
#include <Date.h>
@@ -110,12 +112,15 @@ bool TF2::get (int id, Task& task)
if (! _loaded_tasks)
load_tasks ();
std::vector <Task>::iterator i;
for (i = _tasks.begin (); i != _tasks.end (); ++i)
// This is an optimization. Since the 'id' is based on the line number of
// pending.data file, the task in question cannot appear earlier than line
// (id - 1) in the file. It can, however, appear significantly later because
// it is not known how recent a GC operation was run.
for (int i = id - 1; i < _tasks.size (); ++i)
{
if (i->id == id)
if (_tasks[i].id == id)
{
task = *i;
task = _tasks[i];
return true;
}
}
@@ -222,7 +227,7 @@ void TF2::commit ()
task != _added_tasks.end ();
++task)
{
_file.append (task->composeF4 ());
_file.append (task->composeF4 () + "\n");
}
_added_tasks.clear ();
@@ -254,7 +259,7 @@ void TF2::commit ()
task != _tasks.end ();
++task)
{
_file.append (task->composeF4 ());
_file.append (task->composeF4 () + "\n");
}
// Write out all the added lines.
@@ -564,12 +569,12 @@ void TDB2::add (Task& task, bool add_to_backlog /* = true */)
// new <task>
// ---
undo.add_line ("time " + Date ().toEpochString () + "\n");
undo.add_line ("new " + task.composeF4 ());
undo.add_line ("new " + task.composeF4 () + "\n");
undo.add_line ("---\n");
// Add task to backlog.
if (add_to_backlog)
backlog.add_task (task);
backlog.add_line (task.composeJSON () + "\n");
}
////////////////////////////////////////////////////////////////////////////////
@@ -596,19 +601,28 @@ void TDB2::modify (Task& task, bool add_to_backlog /* = true */)
// new <task>
// ---
undo.add_line ("time " + Date ().toEpochString () + "\n");
undo.add_line ("old " + original.composeF4 ());
undo.add_line ("new " + task.composeF4 ());
undo.add_line ("old " + original.composeF4 () + "\n");
undo.add_line ("new " + task.composeF4 () + "\n");
undo.add_line ("---\n");
// Add modified task to backlog.
if (add_to_backlog)
backlog.add_task (task);
backlog.add_line (task.composeJSON () + "\n");
}
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::commit ()
{
// Ignore harmful signals.
signal (SIGHUP, SIG_IGN);
signal (SIGINT, SIG_IGN);
signal (SIGKILL, SIG_IGN);
signal (SIGPIPE, SIG_IGN);
signal (SIGTERM, SIG_IGN);
signal (SIGUSR1, SIG_IGN);
signal (SIGUSR2, SIG_IGN);
dump ();
context.timer_commit.start ();
@@ -617,6 +631,15 @@ void TDB2::commit ()
undo.commit ();
backlog.commit ();
// Restore signal handling.
signal (SIGHUP, SIG_DFL);
signal (SIGINT, SIG_DFL);
signal (SIGKILL, SIG_DFL);
signal (SIGPIPE, SIG_DFL);
signal (SIGTERM, SIG_DFL);
signal (SIGUSR1, SIG_DFL);
signal (SIGUSR2, SIG_DFL);
context.timer_commit.stop ();
}
@@ -675,7 +698,7 @@ void readTaskmods (std::vector <std::string> &input,
void TDB2::merge (const std::string& mergeFile)
{
///////////////////////////////////////
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
///////////////////////////////////////
// list of modifications that we want to add to the local database
@@ -746,7 +769,7 @@ void TDB2::merge (const std::string& mergeFile)
tmp_lit++;
tmp_rit++;
}
if (lookahead == -1) {
// at this point we know that the first lines are the same
undo_lines.push_back (lline + "\n");
@@ -763,7 +786,7 @@ void TDB2::merge (const std::string& mergeFile)
bool found = false;
for (std::vector<std::string>::const_iterator tmp_lit = lit, tmp_rit = rit;
(tmp_lit != l.end ()) && (tmp_rit != r.end ());
++tmp_lit, ++tmp_rit)
++tmp_lit, ++tmp_rit)
{
lline = *tmp_lit;
rline = *tmp_rit;
@@ -855,7 +878,7 @@ void TDB2::merge (const std::string& mergeFile)
// point in time. Normally this case will be solved by the merge logic,
// BUT if the UUID is considered new the merge logic will be skipped.
//
// This flaw resulted in a couple of duplication issues and bloated
// This flaw resulted in a couple of duplication issues and bloated
// undo files (e.g. #1104).
//
// This is just a "hack" which discards all the modifications of the
@@ -969,7 +992,7 @@ void TDB2::merge (const std::string& mergeFile)
// inserting right mod into history of local database
// so that it can be restored later
// AND more important: create a history that looks the same
// AND more important: create a history that looks the same
// as if we switched the roles 'remote' and 'local'
// thus we have to find the oldest change on the local branch that is not on remote branch
@@ -1111,9 +1134,7 @@ void TDB2::merge (const std::string& mergeFile)
<< "\n";
*/
// remove the \n from composeF4() string
std::string newline = tmod.getAfter ().composeF4 ();
newline = newline.substr (0, newline.length ()-1);
// does the tasks move to pending data?
// this taskmod will not arise from
@@ -1153,10 +1174,7 @@ void TDB2::merge (const std::string& mergeFile)
cutOff (tmod.getBefore ().get ("description"), 10))
<< "\n";
// remove the \n from composeF4() string
// which will replace the current line
std::string newline = tmod.getAfter ().composeF4 ();
newline = newline.substr (0, newline.length ()-1);
// does the tasks move to completed data
if ( (statusAfter == Task::completed)
@@ -1214,10 +1232,7 @@ void TDB2::merge (const std::string& mergeFile)
cutOff (tmod.getAfter ().get ("description"), 10))
<< "\n";
// remove the \n from composeF4() string
std::string newline = tmod.getAfter ().composeF4 ();
newline = newline.substr (0, newline.length ()-1);
pending_lines.push_back (newline);
pending_lines.push_back (tmod.getAfter ().composeF4 ());
}
else
{
@@ -1262,18 +1277,92 @@ void TDB2::merge (const std::string& mergeFile)
////////////////////////////////////////////////////////////////////////////////
void TDB2::revert ()
{
// Extract the details of the last txn, and roll it back.
std::vector <std::string> u = undo.get_lines ();
std::string uuid;
std::string when;
std::string current;
std::string prior;
revert_undo (u, uuid, when, current, prior);
// Display diff and confirm.
show_diff (current, prior, when);
if (! context.config.getBoolean ("confirmation") ||
confirm (STRING_TDB2_UNDO_CONFIRM))
{
// There are six kinds of change possible. Determine which one, and act
// accordingly.
//
// Revert: task add
// [1] 0 --> p
// - erase from pending
// - if in backlog, erase, else cannot undo
//
// Revert: task modify
// [2] p --> p'
// - write prior over current in pending
// - add prior to backlog
//
// Revert: task done/delete
// [3] p --> c
// - add prior to pending
// - erase from completed
// - add prior to backlog
//
// Revert: task modify
// [4] c --> p
// - add prior to completed
// - erase from pending
// - add prior to backlog
//
// Revert: task modify
// [5] c --> c'
// - write prior over current in completed
// - add prior to backlog
//
// Revert: task log
// [6] 0 --> c
// - erase from completed
// - if in backlog, erase, else cannot undo
// Modify other data files accordingly.
std::vector <std::string> p = pending.get_lines ();
revert_pending (p, uuid, current, prior);
std::vector <std::string> c = completed.get_lines ();
revert_completed (p, c, uuid, current, prior);
std::vector <std::string> b = backlog.get_lines ();
revert_backlog (b, uuid, current, prior);
// Commit. If processing makes it this far with no exceptions, then we're
// done.
File::write (undo._file._data, u);
File::write (pending._file._data, p);
File::write (completed._file._data, c);
File::write (backlog._file._data, b);
}
else
std::cout << STRING_CMD_CONFIG_NO_CHANGE << "\n";
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::revert_undo (
std::vector <std::string>& u,
std::string& uuid,
std::string& when,
std::string& current,
std::string& prior)
{
if (u.size () < 3)
throw std::string (STRING_TDB2_NO_UNDO);
// pop last tx
u.pop_back (); // separator.
std::string current = u.back ().substr (4);
current = u.back ().substr (4);
u.pop_back ();
std::string prior;
std::string when;
if (u.back ().substr (0, 5) == "time ")
{
when = u.back ().substr (5);
@@ -1288,6 +1377,146 @@ void TDB2::revert ()
u.pop_back ();
}
// Extract identifying uuid.
std::string::size_type uuidAtt = current.find ("uuid:\"");
if (uuidAtt != std::string::npos)
uuid = current.substr (uuidAtt + 6, 36); // "uuid:"<uuid>" --> <uuid>
else
throw std::string (STRING_TDB2_MISSING_UUID);
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::revert_pending (
std::vector <std::string>& p,
const std::string& uuid,
const std::string& current,
const std::string& prior)
{
std::string uuid_att = "uuid:\"" + uuid + "\"";
// is 'current' in pending?
std::vector <std::string>::iterator task;
for (task = p.begin (); task != p.end (); ++task)
{
if (task->find (uuid_att) != std::string::npos)
{
context.debug ("TDB::revert - task found in pending.data");
// Either revert if there was a prior state, or remove the task.
if (prior != "")
{
*task = prior;
std::cout << STRING_TDB2_REVERTED << "\n";
}
else
{
p.erase (task);
std::cout << STRING_TDB2_REMOVED << "\n";
}
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::revert_completed (
std::vector <std::string>& p,
std::vector <std::string>& c,
const std::string& uuid,
const std::string& current,
const std::string& prior)
{
std::string uuid_att = "uuid:\"" + uuid + "\"";
// is 'current' in completed?
std::vector <std::string>::iterator task;
for (task = c.begin (); task != c.end (); ++task)
{
if (task->find (uuid_att) != std::string::npos)
{
context.debug ("TDB::revert_completed - task found in completed.data");
// Either revert if there was a prior state, or remove the task.
if (prior != "")
{
*task = prior;
if (task->find ("status:\"pending\"") != std::string::npos ||
task->find ("status:\"waiting\"") != std::string::npos ||
task->find ("status:\"recurring\"") != std::string::npos)
{
c.erase (task);
p.push_back (prior);
std::cout << STRING_TDB2_REVERTED << "\n";
context.debug ("TDB::revert_completed - task belongs in pending.data");
}
else
{
std::cout << STRING_TDB2_REVERTED << "\n";
context.debug ("TDB::revert_completed - task belongs in completed.data");
}
}
else
{
c.erase (task);
std::cout << STRING_TDB2_REVERTED << "\n";
context.debug ("TDB::revert_completed - task removed");
}
std::cout << STRING_TDB2_UNDO_COMPLETE << "\n";
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::revert_backlog (
std::vector <std::string>& b,
const std::string& uuid,
const std::string& current,
const std::string& prior)
{
std::string uuid_att = "\"uuid\":\"" + uuid + "\"";
bool found = false;
std::vector <std::string>::reverse_iterator task;
for (task = b.rbegin (); task != b.rend (); ++task)
{
if (task->find (uuid_att) != std::string::npos)
{
context.debug ("TDB::revert_backlog - task found in backlog.data");
found = true;
// If this is a new task (no prior), then just remove it from the backlog.
if (current != "" && prior == "")
{
// Yes, this is what is needed, when you want to erase using a reverse
// iterator.
b.erase ((++task).base ());
}
// If this is a modification of some kind, add the prior to the backlog.
else
{
Task t (prior);
b.push_back (t.composeJSON ());
}
break;
}
}
if (!found)
throw std::string (STRING_TDB2_UNDO_SYNCED);
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::show_diff (
const std::string& current,
const std::string& prior,
const std::string& when)
{
Date lastChange (strtol (when.c_str (), NULL, 10));
// Set the colors.
@@ -1500,106 +1729,6 @@ void TDB2::revert ()
<< "\n";
}
// Output displayed, now confirm.
if (context.config.getBoolean ("confirmation") &&
!confirm (STRING_TDB2_UNDO_CONFIRM))
{
std::cout << STRING_CMD_CONFIG_NO_CHANGE << "\n";
return;
}
// Extract identifying uuid.
std::string uuid;
std::string::size_type uuidAtt = current.find ("uuid:\"");
if (uuidAtt != std::string::npos)
uuid = current.substr (uuidAtt, 43); // 43 = uuid:"..."
else
throw std::string (STRING_TDB2_MISSING_UUID);
// load pending.data
std::vector <std::string> p = pending.get_lines ();
// is 'current' in pending?
std::vector <std::string>::iterator task;
for (task = p.begin (); task != p.end (); ++task)
{
if (task->find (uuid) != std::string::npos)
{
context.debug ("TDB::undo - task found in pending.data");
// Either revert if there was a prior state, or remove the task.
if (prior != "")
{
*task = prior;
std::cout << STRING_TDB2_REVERTED << "\n";
}
else
{
p.erase (task);
std::cout << STRING_TDB2_REMOVED << "\n";
}
// Rewrite files.
File::write (pending._file._data, p);
File::write (undo._file._data, u);
return;
}
}
// load completed.data
std::vector <std::string> c = completed.get_lines ();
// is 'current' in completed?
for (task = c.begin (); task != c.end (); ++task)
{
if (task->find (uuid) != std::string::npos)
{
context.debug ("TDB::undo - task found in completed.data");
// Either revert if there was a prior state, or remove the task.
if (prior != "")
{
*task = prior;
if (task->find ("status:\"pending\"") != std::string::npos ||
task->find ("status:\"waiting\"") != std::string::npos ||
task->find ("status:\"recurring\"") != std::string::npos)
{
c.erase (task);
p.push_back (prior);
File::write (completed._file._data, c);
File::write (pending._file._data, p);
File::write (undo._file._data, u);
std::cout << STRING_TDB2_REVERTED << "\n";
context.debug ("TDB::undo - task belongs in pending.data");
}
else
{
File::write (completed._file._data, c);
File::write (undo._file._data, u);
std::cout << STRING_TDB2_REVERTED << "\n";
context.debug ("TDB::undo - task belongs in completed.data");
}
}
else
{
c.erase (task);
File::write (completed._file._data, c);
File::write (undo._file._data, u);
std::cout << STRING_TDB2_REVERTED << "\n";
context.debug ("TDB::undo - task removed");
}
std::cout << STRING_TDB2_UNDO_COMPLETE << "\n";
return;
}
}
// Perhaps user hand-edited the data files?
// Perhaps the task was in completed.data, which was still in file format 3?
std::cout << format (STRING_TDB2_MISSING_TASK, uuid.substr (6, 36))
<< "\n"
<< STRING_TDB2_UNDO_IMPOSSIBLE
<< "\n";
}
////////////////////////////////////////////////////////////////////////////////
@@ -1752,9 +1881,9 @@ int TDB2::next_id ()
const std::vector <Task> TDB2::all_tasks ()
{
std::vector <Task> all (pending._tasks.size () +
pending._added_tasks.size () +
completed._tasks.size () +
completed._added_tasks.size ());
pending._added_tasks.size () +
completed._tasks.size () +
completed._added_tasks.size ());
all = pending.get_tasks ();
std::vector <Task> extra (completed._tasks.size () +

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -127,6 +127,11 @@ public:
private:
bool verifyUniqueUUID (const std::string&);
void show_diff (const std::string&, const std::string&, const std::string&);
void revert_undo (std::vector <std::string>&, std::string&, std::string&, std::string&, std::string&);
void revert_pending (std::vector <std::string>&, const std::string&, const std::string&, const std::string&);
void revert_completed (std::vector <std::string>&, std::vector <std::string>&, const std::string&, const std::string&, const std::string&);
void revert_backlog (std::vector <std::string>&, const std::string&, const std::string&, const std::string&);
public:
TF2 pending;

407
src/TLSClient.cpp Normal file
View File

@@ -0,0 +1,407 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// http://www.opensource.org/licenses/mit-license.php
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#ifdef HAVE_LIBGNUTLS
#include <iostream>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#ifdef OPENBSD
#include <errno.h>
#else
#include <sys/errno.h>
#endif
#include <sys/types.h>
#include <netdb.h>
#include <TLSClient.h>
#include <text.h>
#include <i18n.h>
#define MAX_BUF 16384
static int verify_certificate_callback (gnutls_session_t);
static bool trust_override = false;
////////////////////////////////////////////////////////////////////////////////
static void gnutls_log_function (int level, const char* message)
{
std::cout << "c: " << level << " " << message;
}
////////////////////////////////////////////////////////////////////////////////
static int verify_certificate_callback (gnutls_session_t session)
{
if (trust_override)
return 0;
// Get the hostname from the session.
const char* hostname = (const char*) gnutls_session_get_ptr (session);
// This verification function uses the trusted CAs in the credentials
// structure. So you must have installed one or more CA certificates.
unsigned int status = 0;
#if GNUTLS_VERSION_NUMBER >= 0x030104
int ret = gnutls_certificate_verify_peers3 (session, NULL, &status);
#else
int ret = gnutls_certificate_verify_peers2 (session, &status);
#endif
if (ret < 0)
return GNUTLS_E_CERTIFICATE_ERROR;
#if GNUTLS_VERSION_NUMBER >= 0x030105
gnutls_certificate_type_t type = gnutls_certificate_type_get (session);
gnutls_datum_t out;
ret = gnutls_certificate_verification_status_print (status, type, &out, 0);
if (ret < 0)
return GNUTLS_E_CERTIFICATE_ERROR;
std::cout << "c: INFO " << out.data << "\n";
gnutls_free (out.data);
#endif
if (status != 0)
return GNUTLS_E_CERTIFICATE_ERROR;
// Continue handshake.
return 0;
}
////////////////////////////////////////////////////////////////////////////////
TLSClient::TLSClient ()
: _ca ("")
, _cert ("")
, _key ("")
, _socket (0)
, _limit (0)
, _debug (false)
{
}
////////////////////////////////////////////////////////////////////////////////
TLSClient::~TLSClient ()
{
gnutls_deinit (_session);
gnutls_certificate_free_credentials (_credentials);
gnutls_global_deinit ();
if (_socket)
{
shutdown (_socket, SHUT_RDWR);
close (_socket);
}
}
////////////////////////////////////////////////////////////////////////////////
void TLSClient::limit (int max)
{
_limit = max;
}
////////////////////////////////////////////////////////////////////////////////
// Calling this method results in all subsequent socket traffic being sent to
// std::cout, labelled with 'c: ...'.
void TLSClient::debug (int level)
{
if (level)
_debug = true;
gnutls_global_set_log_function (gnutls_log_function);
gnutls_global_set_log_level (level);
}
////////////////////////////////////////////////////////////////////////////////
void TLSClient::trust (bool value)
{
trust_override = value;
if (_debug)
{
if (trust_override)
std::cout << "c: INFO Server certificate trusted automatically.\n";
else
std::cout << "c: INFO Server certificate trust verified.\n";
}
}
////////////////////////////////////////////////////////////////////////////////
void TLSClient::ciphers (const std::string& cipher_list)
{
_ciphers = cipher_list;
}
////////////////////////////////////////////////////////////////////////////////
void TLSClient::init (
const std::string& ca,
const std::string& cert,
const std::string& key)
{
_ca = ca;
_cert = cert;
_key = key;
gnutls_global_init ();
gnutls_certificate_allocate_credentials (&_credentials);
if (_ca != "" &&
gnutls_certificate_set_x509_trust_file (_credentials, _ca.c_str (), GNUTLS_X509_FMT_PEM) < 0)
throw std::string ("Missing CA file.");
if (_cert != "" &&
_key != "" &&
gnutls_certificate_set_x509_key_file (_credentials, _cert.c_str (), _key.c_str (), GNUTLS_X509_FMT_PEM) < 0)
throw std::string ("Missing CERT file.");
#if GNUTLS_VERSION_NUMBER >= 0x02090a
gnutls_certificate_set_verify_function (_credentials, verify_certificate_callback);
#endif
gnutls_init (&_session, GNUTLS_CLIENT);
// Use default priorities unless overridden.
if (_ciphers == "")
_ciphers = "NORMAL";
const char *err;
int ret = gnutls_priority_set_direct (_session, _ciphers.c_str (), &err);
if (ret < 0)
{
if (_debug && ret == GNUTLS_E_INVALID_REQUEST)
std::cout << "c: ERROR Priority error at: " << err << "\n";
throw std::string (STRING_TLS_INIT_FAIL);
}
// Apply the x509 credentials to the current session.
gnutls_credentials_set (_session, GNUTLS_CRD_CERTIFICATE, _credentials);
}
////////////////////////////////////////////////////////////////////////////////
void TLSClient::connect (const std::string& host, const std::string& port)
{
// Store the host name, so the verification callback can access it during the
// handshake below.
gnutls_session_set_ptr (_session, (void*) host.c_str ());
// use IPv4 or IPv6, does not matter.
struct addrinfo hints = {0};
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE; // use my IP
struct addrinfo* res;
if (::getaddrinfo (host.c_str (), port.c_str (), &hints, &res) != 0)
throw std::string (::gai_strerror (errno));
// Try them all, stop on success.
struct addrinfo* p;
for (p = res; p != NULL; p = p->ai_next)
{
if ((_socket = ::socket (p->ai_family, p->ai_socktype, p->ai_protocol)) == -1)
continue;
// When a socket is closed, it remains unavailable for a while (netstat -an).
// Setting SO_REUSEADDR allows this program to assume control of a closed,
// but unavailable socket.
int on = 1;
if (::setsockopt (_socket,
SOL_SOCKET,
SO_REUSEADDR,
(const void*) &on,
sizeof (on)) == -1)
throw std::string (::strerror (errno));
if (::connect (_socket, p->ai_addr, p->ai_addrlen) == -1)
continue;
break;
}
free (res);
if (p == NULL)
throw format (STRING_CMD_SYNC_CONNECT, host, port);
#if GNUTLS_VERSION_NUMBER >= 0x030109
gnutls_transport_set_int (_session, _socket);
#else
gnutls_transport_set_ptr (_session, (gnutls_transport_ptr_t) (long) _socket);
#endif
// Perform the TLS handshake
int ret;
do
{
ret = gnutls_handshake (_session);
}
while (ret < 0 && gnutls_error_is_fatal (ret) == 0);
if (ret < 0)
throw format (STRING_CMD_SYNC_HANDSHAKE, gnutls_strerror (ret));
if (_debug)
{
#if GNUTLS_VERSION_NUMBER >= 0x03010a
char* desc = gnutls_session_get_desc (_session);
std::cout << "c: INFO Handshake was completed: " << desc << "\n";
gnutls_free (desc);
#else
std::cout << "c: INFO Handshake was completed.\n";
#endif
}
}
////////////////////////////////////////////////////////////////////////////////
void TLSClient::bye ()
{
gnutls_bye (_session, GNUTLS_SHUT_RDWR);
}
////////////////////////////////////////////////////////////////////////////////
void TLSClient::send (const std::string& data)
{
std::string packet = "XXXX" + data;
// Encode the length.
unsigned long l = packet.length ();
packet[0] = l >>24;
packet[1] = l >>16;
packet[2] = l >>8;
packet[3] = l;
unsigned int total = 0;
unsigned int remaining = packet.length ();
while (total < packet.length ())
{
int status;
do
{
status = gnutls_record_send (_session, packet.c_str () + total, remaining);
}
while (errno == GNUTLS_E_INTERRUPTED ||
errno == GNUTLS_E_AGAIN);
if (status == -1)
break;
total += (unsigned int) status;
remaining -= (unsigned int) status;
}
if (_debug)
std::cout << "c: INFO Sending 'XXXX"
<< data.c_str ()
<< "' (" << total << " bytes)"
<< std::endl;
}
////////////////////////////////////////////////////////////////////////////////
void TLSClient::recv (std::string& data)
{
data = ""; // No appending of data.
int received = 0;
// Get the encoded length.
unsigned char header[4] = {0};
do
{
received = gnutls_record_recv (_session, header, 4);
}
while (received > 0 &&
(errno == GNUTLS_E_INTERRUPTED ||
errno == GNUTLS_E_AGAIN));
int total = received;
// Decode the length.
unsigned long expected = (header[0]<<24) |
(header[1]<<16) |
(header[2]<<8) |
header[3];
if (_debug)
std::cout << "c: INFO expecting " << expected << " bytes.\n";
// TODO This would be a good place to assert 'expected < _limit'.
// Arbitrary buffer size.
char buffer[MAX_BUF];
// Keep reading until no more data. Concatenate chunks of data if a) the
// read was interrupted by a signal, and b) if there is more data than
// fits in the buffer.
do
{
do
{
received = gnutls_record_recv (_session, buffer, MAX_BUF - 1);
}
while (received > 0 &&
(errno == GNUTLS_E_INTERRUPTED ||
errno == GNUTLS_E_AGAIN));
// Other end closed the connection.
if (received == 0)
{
if (_debug)
std::cout << "c: INFO Peer has closed the TLS connection\n";
break;
}
// Something happened.
if (received < 0 && gnutls_error_is_fatal (received) == 0)
{
if (_debug)
std::cout << "c: WARNING " << gnutls_strerror (received) << "\n";
}
else if (received < 0)
throw std::string (gnutls_strerror (received));
buffer [received] = '\0';
data += buffer;
total += received;
// Stop at defined limit.
if (_limit && total > _limit)
break;
}
while (received > 0 && total < (int) expected);
if (_debug)
std::cout << "c: INFO Receiving 'XXXX"
<< data.c_str ()
<< "' (" << total << " bytes)"
<< std::endl;
}
////////////////////////////////////////////////////////////////////////////////
#endif

67
src/TLSClient.h Normal file
View File

@@ -0,0 +1,67 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// http://www.opensource.org/licenses/mit-license.php
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_TLSCLIENT
#define INCLUDED_TLSCLIENT
#ifdef HAVE_LIBGNUTLS
#include <string>
#include <gnutls/gnutls.h>
class TLSClient
{
public:
TLSClient ();
~TLSClient ();
void limit (int);
void debug (int);
void trust (bool);
void ciphers (const std::string&);
void init (const std::string&, const std::string&, const std::string&);
void connect (const std::string&, const std::string&);
void bye ();
void send (const std::string&);
void recv (std::string&);
private:
std::string _ca;
std::string _cert;
std::string _key;
std::string _ciphers;
gnutls_certificate_credentials_t _credentials;
gnutls_session_t _session;
int _socket;
int _limit;
bool _debug;
};
#endif
#endif
////////////////////////////////////////////////////////////////////////////////

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -32,12 +32,32 @@
#include <map>
#include <string>
#include <stdio.h>
void initializeUrgencyCoefficients ();
#include <A3.h>
class Task : public std::map <std::string, std::string>
{
public:
static std::string defaultProject;
static std::string defaultPriority;
static std::string defaultDue;
static bool searchCaseSensitive;
static bool regex;
static std::map <std::string, std::string> attributes; // name -> type
static std::map <std::string, float> coefficients;
static float urgencyPriorityCoefficient;
static float urgencyProjectCoefficient;
static float urgencyActiveCoefficient;
static float urgencyScheduledCoefficient;
static float urgencyWaitingCoefficient;
static float urgencyBlockedCoefficient;
static float urgencyAnnotationsCoefficient;
static float urgencyTagsCoefficient;
static float urgencyNextCoefficient;
static float urgencyDueCoefficient;
static float urgencyBlockingCoefficient;
static float urgencyAgeCoefficient;
static float urgencyAgeMax;
public:
Task (); // Default constructor
Task (const Task&); // Copy constructor
@@ -48,7 +68,7 @@ public:
void parse (const std::string&);
std::string composeF4 () const;
std::string composeJSON (bool include_id = false) const;
std::string composeJSON (bool decorate = false) const;
// Status values.
enum status {pending, completed, deleted, recurring, waiting};
@@ -83,9 +103,14 @@ public:
void set (const std::string&, int);
void remove (const std::string&);
#ifdef PRODUCT_TASKWARRIOR
bool is_due () const;
bool is_duetoday () const;
bool is_dueweek () const;
bool is_duemonth () const;
bool is_dueyear () const;
bool is_overdue () const;
#endif
status getStatus () const;
void setStatus (status);
@@ -103,6 +128,7 @@ public:
void addAnnotation (const std::string&);
void removeAnnotations ();
#ifdef PRODUCT_TASKWARRIOR
void addDependency (int);
void addDependency (const std::string&);
void removeDependency (int);
@@ -114,15 +140,20 @@ public:
void getUDAOrphans (std::vector <std::string>&) const;
void substitute (const std::string&, const std::string&, bool);
#endif
void validate (bool applyDefault = true);
float urgency_c () const;
float urgency ();
void modify (const A3&, std::string&);
bool next_mod_group (const A3&, Arg&, unsigned int&);
private:
int determineVersion (const std::string&);
void legacyParse (const std::string&);
void parseJSON (const std::string&);
void parseLegacy (const std::string&);
void validate_before (const std::string&, const std::string&);
inline float urgency_priority () const;

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <sstream>
#include <iostream>
#include <i18n.h>
@@ -181,10 +182,10 @@ std::string Taskmod::toString ()
if (_bBeforeSet)
{
stream << STRING_TASKMOD_OLD << _before.composeF4();
stream << STRING_TASKMOD_OLD << _before.composeF4() << "\n";
}
stream << STRING_TASKMOD_NEW << _after.composeF4();
stream << STRING_TASKMOD_NEW << _after.composeF4() << "\n";
stream << "---\n";
return stream.str ();

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <iomanip>
#include <sstream>
@@ -112,3 +113,40 @@ void Timer::subtract (unsigned long value)
}
////////////////////////////////////////////////////////////////////////////////
HighResTimer::HighResTimer ()
{
_start.tv_sec = 0;
_start.tv_usec = 0;
_stop.tv_sec = 0;
_stop.tv_usec = 0;
}
////////////////////////////////////////////////////////////////////////////////
HighResTimer::~HighResTimer ()
{
}
////////////////////////////////////////////////////////////////////////////////
void HighResTimer::start ()
{
gettimeofday (&_start, NULL);
}
////////////////////////////////////////////////////////////////////////////////
void HighResTimer::stop ()
{
gettimeofday (&_stop, NULL);
}
////////////////////////////////////////////////////////////////////////////////
double HighResTimer::total () const
{
if (_stop.tv_sec > 0 || _stop.tv_usec > 0)
return (_stop.tv_sec - _start.tv_sec) +
(_stop.tv_usec - _start.tv_usec) / 1000000.0;
return 0.0;
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -31,6 +31,7 @@
#include <string>
#include <sys/time.h>
// Timer is a scope-activated timer that dumps to std::cout at end of scope.
class Timer
{
public:
@@ -52,6 +53,25 @@ private:
unsigned long _total;
};
// HighResTimer is a stop watch with microsecond resolution.
class HighResTimer
{
public:
HighResTimer ();
~HighResTimer ();
HighResTimer (const HighResTimer&);
HighResTimer& operator= (const HighResTimer&);
void start ();
void stop ();
double total () const;
private:
struct timeval _start;
struct timeval _stop;
};
#endif
////////////////////////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <stdlib.h>
#include <util.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <TransportCurl.h>
#include <text.h>
#include <i18n.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <text.h>
#include <i18n.h>
#include <TransportRSYNC.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <text.h>
#include <i18n.h>
#include <TransportSSH.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <text.h>
#include <i18n.h>
#include <TransportShell.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Context.h>
#include <text.h>
#include <i18n.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2013, Johannes Schlatow.
// Copyright 2010 - 2014, Johannes Schlatow.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <numeric>
#include <ViewTask.h>
#include <Context.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <ViewText.h>
#include <Context.h>
#include <text.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,7 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <cmake.h>
#include <math.h>
#include <Context.h>
#include <ColDate.h>
@@ -49,6 +49,8 @@ ColumnDate::ColumnDate ()
_styles.push_back ("epoch");
_styles.push_back ("iso");
_styles.push_back ("age");
_styles.push_back ("remaining");
_styles.push_back ("countdown");
Date now;
now -= 125; // So that "age" is non-zero.
@@ -57,6 +59,8 @@ ColumnDate::ColumnDate ()
_examples.push_back (now.toEpochString ());
_examples.push_back (now.toISO ());
_examples.push_back (OldDuration (Date () - now).formatCompact ());
_examples.push_back ("");
_examples.push_back (OldDuration (Date () - now).format ());
}
////////////////////////////////////////////////////////////////////////////////
@@ -78,7 +82,7 @@ void ColumnDate::measure (Task& task, unsigned int& minimum, unsigned int& maxim
if (task.has (_name))
{
Date date ((time_t) strtol (task.get (_name).c_str (), NULL, 10));
Date date (task.get_date (_name));
if (_style == "default" ||
_style == "formatted")
@@ -97,7 +101,6 @@ void ColumnDate::measure (Task& task, unsigned int& minimum, unsigned int& maxim
}
else if (_style == "countdown")
{
Date date ((time_t) strtol (task.get (_name).c_str (), NULL, 10));
Date now;
minimum = maximum = OldDuration (now - date).format ().length ();
}
@@ -118,6 +121,12 @@ void ColumnDate::measure (Task& task, unsigned int& minimum, unsigned int& maxim
Date now;
minimum = maximum = OldDuration (now - date).formatCompact ().length ();
}
else if (_style == "remaining")
{
Date now;
if (date > now)
minimum = maximum = Duration (date - now).format ().length ();
}
else
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
}
@@ -132,6 +141,8 @@ void ColumnDate::render (
{
if (task.has (_name))
{
Date date (task.get_date (_name));
if (_style == "default" ||
_style == "formatted")
{
@@ -148,12 +159,10 @@ void ColumnDate::render (
lines.push_back (
color.colorize (
leftJustify (
Date ((time_t) strtol (task.get (_name).c_str (), NULL, 10))
.toString (format), width)));
date.toString (format), width)));
}
else if (_style == "countdown")
{
Date date ((time_t) strtol (task.get (_name).c_str (), NULL, 10));
Date now;
lines.push_back (
@@ -166,28 +175,24 @@ void ColumnDate::render (
lines.push_back (
color.colorize (
rightJustify (
format (Date ((time_t) strtol (task.get (_name).c_str (), NULL, 10))
.toJulian (), 13, 12), width)));
format (date.toJulian (), 13, 12), width)));
}
else if (_style == "epoch")
{
lines.push_back (
color.colorize (
rightJustify (
Date ((time_t) strtol (task.get (_name).c_str (), NULL, 10))
.toEpochString (), width)));
date.toEpochString (), width)));
}
else if (_style == "iso")
{
lines.push_back (
color.colorize (
leftJustify (
Date ((time_t) strtol (task.get (_name).c_str (), NULL, 10))
.toISO (), width)));
date.toISO (), width)));
}
else if (_style == "age")
{
Date date ((time_t) strtol (task.get (_name).c_str (), NULL, 10));
Date now;
lines.push_back (
@@ -195,6 +200,17 @@ void ColumnDate::render (
leftJustify (
OldDuration (now - date).formatCompact (), width)));
}
else if (_style == "remaining")
{
Date now;
if (date > now)
lines.push_back (
color.colorize (
rightJustify (
Duration (date - now).format (), width)));
else
lines.push_back ("");
}
}
}

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <algorithm>
#include <Context.h>
#include <ColDepends.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <stdlib.h>
#include <Context.h>
#include <Date.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <stdlib.h>
#include <Context.h>
#include <ColDue.h>
@@ -41,8 +42,6 @@ ColumnDue::ColumnDue ()
_name = "due";
_label = STRING_COLUMN_LABEL_DUE;
_styles.push_back ("countdown");
Date now;
now += 125;
_examples.push_back (OldDuration (now - Date ()).formatCompact ());

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <ColEnd.h>
#include <i18n.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <ColEntry.h>
#include <i18n.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <math.h>
#include <Context.h>
#include <ColID.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <math.h>
#include <Context.h>
#include <ColIMask.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <math.h>
#include <Context.h>
#include <ColMask.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <ColModified.h>
#include <i18n.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <math.h>
#include <Context.h>
#include <ColParent.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Context.h>
#include <ColPriority.h>
#include <text.h>
@@ -118,3 +119,16 @@ void ColumnPriority::render (
}
////////////////////////////////////////////////////////////////////////////////
std::string ColumnPriority::modify (std::string& value)
{
return upperCase (value);
}
////////////////////////////////////////////////////////////////////////////////
bool ColumnPriority::can_modify ()
{
return true;
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -44,6 +44,8 @@ public:
void setStyle (const std::string&);
void measure (Task&, unsigned int&, unsigned int&);
void render (std::vector <std::string>&, Task&, int, Color&);
std::string modify (std::string&);
bool can_modify ();
private:
};

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Context.h>
#include <ColProject.h>
#include <text.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Context.h>
#include <OldDuration.h>
#include <ColRecur.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <stdlib.h>
#include <Context.h>
#include <ColScheduled.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Context.h>
#include <ColStart.h>
#include <text.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Context.h>
#include <ColStatus.h>
#include <text.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Context.h>
#include <ColString.h>
#include <text.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <algorithm>
#include <Context.h>
#include <ColTags.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Context.h>
#include <OldDuration.h>
#include <Date.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <math.h>
#include <Context.h>
#include <ColUUID.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <ColUntil.h>
#include <i18n.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Some files were not shown because too many files have changed in this diff Show More