As you offered on Identi.ca in reply to my question on Laconica group
support (http://identi.ca/notice/
6205615), created a patch for it.
Been like 6 years when i learned and wrote my last basic C code, but
tested it out and seems to be working fine.
Signed-off-by: Marvin Vek <laen@onedot.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ACTION_USER = 2,
ACTION_REPLIES = 4,
ACTION_PUBLIC = 8,
ACTION_USER = 2,
ACTION_REPLIES = 4,
ACTION_PUBLIC = 8,
+ ACTION_GROUP = 16,
+ ACTION_UNKNOWN = 32
char *homedir;
char *logfile;
char *user;
char *homedir;
char *logfile;
char *user;
char *hosturl;
int bash;
int shrink_urls;
char *hosturl;
int bash;
int shrink_urls;
fprintf(stdout, " --account accountname\n");
fprintf(stdout, " --password password\n");
fprintf(stdout, " --action action\n");
fprintf(stdout, " --account accountname\n");
fprintf(stdout, " --password password\n");
fprintf(stdout, " --action action\n");
- fprintf(stdout, " ('update', 'friends', 'public', 'replies' "
- "or 'user')\n");
+ fprintf(stdout, " ('update', 'friends', 'public', 'replies', "
+ "'group' or 'user')\n");
fprintf(stdout, " --user screenname\n");
fprintf(stdout, " --user screenname\n");
+ fprintf(stdout, " --group groupname\n");
fprintf(stdout, " --proxy PROXY:PORT\n");
fprintf(stdout, " --host HOST\n");
fprintf(stdout, " --logfile logfile\n");
fprintf(stdout, " --proxy PROXY:PORT\n");
fprintf(stdout, " --host HOST\n");
fprintf(stdout, " --logfile logfile\n");
free(session->time);
free(session->homedir);
free(session->user);
free(session->time);
free(session->homedir);
free(session->user);
free(session->hosturl);
free(session);
}
free(session->hosturl);
free(session);
}
static const char *public_uri = "/public_timeline.xml";
static const char *friends_uri = "/friends_timeline.xml";
static const char *replies_uri = "/replies.xml";
static const char *public_uri = "/public_timeline.xml";
static const char *friends_uri = "/friends_timeline.xml";
static const char *replies_uri = "/replies.xml";
+static const char *group_uri = "/../laconica/groups/timeline/";
static CURL *curl_init(void)
{
static CURL *curl_init(void)
{
sprintf(endpoint, "%s%s?page=%d", session->hosturl, public_uri, session->page);
curl_easy_setopt(curl, CURLOPT_URL, endpoint);
sprintf(endpoint, "%s%s?page=%d", session->hosturl, public_uri, session->page);
curl_easy_setopt(curl, CURLOPT_URL, endpoint);
+ break;
+ case ACTION_GROUP:
+ sprintf(endpoint, "%s%s%s.xml?page=%d", session->hosturl,
+ group_uri, session->group, session->page);
+ curl_easy_setopt(curl, CURLOPT_URL, endpoint);
+
session->action = ACTION_REPLIES;
else if (strcasecmp(action, "public") == 0)
session->action = ACTION_PUBLIC;
session->action = ACTION_REPLIES;
else if (strcasecmp(action, "public") == 0)
session->action = ACTION_PUBLIC;
+ else if (strcasecmp(action, "group") == 0)
+ session->action = ACTION_GROUP;
else
session->action = ACTION_UNKNOWN;
free(action);
else
session->action = ACTION_UNKNOWN;
free(action);
fprintf(log_file, "%s: host=%s retrieving public timeline\n",
session->time, host);
break;
fprintf(log_file, "%s: host=%s retrieving public timeline\n",
session->time, host);
break;
+ case ACTION_GROUP:
+ fprintf(log_file, "%s: host=%s retrieving group timeline\n",
+ session->time, host);
+ break;
{ "proxy", 1, NULL, 'P' },
{ "action", 1, NULL, 'A' },
{ "user", 1, NULL, 'u' },
{ "proxy", 1, NULL, 'P' },
{ "action", 1, NULL, 'A' },
{ "user", 1, NULL, 'u' },
+ { "group", 1, NULL, 'G' },
{ "logfile", 1, NULL, 'L' },
{ "shrink-urls", 0, NULL, 's' },
{ "help", 0, NULL, 'h' },
{ "logfile", 1, NULL, 'L' },
{ "shrink-urls", 0, NULL, 's' },
{ "help", 0, NULL, 'h' },
parse_configfile(session);
while (1) {
parse_configfile(session);
while (1) {
- option = getopt_long_only(argc, argv, "dp:P:H:a:A:u:hg:snVv",
+ option = getopt_long_only(argc, argv, "dp:P:H:a:A:u:hg:G:snVv",
options, NULL);
if (option == -1)
break;
options, NULL);
if (option == -1)
break;
session->action = ACTION_REPLIES;
else if (strcasecmp(optarg, "public") == 0)
session->action = ACTION_PUBLIC;
session->action = ACTION_REPLIES;
else if (strcasecmp(optarg, "public") == 0)
session->action = ACTION_PUBLIC;
+ else if (strcasecmp(optarg, "group") == 0)
+ session->action = ACTION_GROUP;
else
session->action = ACTION_UNKNOWN;
dbg("action = %d\n", session->action);
else
session->action = ACTION_UNKNOWN;
dbg("action = %d\n", session->action);
session->user = strdup(optarg);
dbg("user = %s\n", session->user);
break;
session->user = strdup(optarg);
dbg("user = %s\n", session->user);
break;
+
+ case 'G':
+ if (session->group)
+ free(session->group);
+ session->group = strdup(optarg);
+ dbg("group = %s\n", session->group);
+ break;
case 'L':
if (session->logfile)
free(session->logfile);
case 'L':
if (session->logfile)
free(session->logfile);
* Show the version to make it easier to determine what
* is going on here
*/
* Show the version to make it easier to determine what
* is going on here
*/
+ fprintf(stderr, session->group);
+ }
if (session->action == ACTION_UNKNOWN) {
fprintf(stderr, "Unknown action, valid actions are:\n");
fprintf(stderr, "'update', 'friends', 'public', "
if (session->action == ACTION_UNKNOWN) {
fprintf(stderr, "Unknown action, valid actions are:\n");
fprintf(stderr, "'update', 'friends', 'public', "
- "'replies' or 'user'.\n");
+ "'replies', 'group' or 'user'.\n");
+ if (session->host == HOST_TWITTER && session->action == ACTION_GROUP) {
+ fprintf(stderr, "Groups only work in Identi.ca.\n");
+ goto exit;
+ }
+
+ if (session->action == ACTION_GROUP && !session->group) {
+ fprintf(stdout, "Enter group name: ");
+ session->group = readline(NULL);
+ }
+
if (!session->account) {
fprintf(stdout, "Enter twitter account: ");
session->account = readline(NULL);
if (!session->account) {
fprintf(stdout, "Enter twitter account: ");
session->account = readline(NULL);