Skip to content

Instantly share code, notes, and snippets.

@sriramster
Created January 16, 2014 19:53
Show Gist options
  • Save sriramster/8462172 to your computer and use it in GitHub Desktop.
Save sriramster/8462172 to your computer and use it in GitHub Desktop.
diff --git a/.gitignore b/.gitignore
index 7a5db30..e7c6a00 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,8 @@
.pc
build
+po/*
+share/ca-certs/Makefile
+share/sounds/Makefile
+*.o
+*.la
+*.lo
diff --git a/libpurple/savedstatuses.c b/libpurple/savedstatuses.c
index 70f4190..9914969 100644
--- a/libpurple/savedstatuses.c
+++ b/libpurple/savedstatuses.c
@@ -551,6 +551,22 @@ load_statuses(void)
xmlnode_free(statuses);
}
+void list_statuses(void)
+{
+ GList *iter;
+ PurpleSavedStatus *status;
+ char *s;
+
+ load_statuses();
+
+ for(iter = saved_statuses; iter != NULL; iter = iter->next)
+ {
+ status = (PurpleSavedStatus *)iter->data;
+ *s = purple_savedstatus_get_message(status);
+ if(s != NULL)
+ printf("%s\n",s);
+ }
+}
/**************************************************************************
* Saved status API
@@ -755,7 +771,7 @@ purple_savedstatus_delete(const char *title)
GList *
purple_savedstatuses_get_all(void)
{
- return saved_statuses;
+ return saved_statuses;
}
GList *
diff --git a/libpurple/savedstatuses.h b/libpurple/savedstatuses.h
index bd5b091..48e0de9 100644
--- a/libpurple/savedstatuses.h
+++ b/libpurple/savedstatuses.h
@@ -167,6 +167,8 @@ void purple_savedstatus_delete_by_status(PurpleSavedStatus *saved_status);
*/
GList *purple_savedstatuses_get_all(void);
+void list_statuses(void);
+
/**
* Returns the n most popular saved statuses. "Popularity" is
* determined by when the last time a saved_status was used and
diff --git a/pidgin/gtkmain.c b/pidgin/gtkmain.c
index 6c579e4..5383786 100644
--- a/pidgin/gtkmain.c
+++ b/pidgin/gtkmain.c
@@ -442,6 +442,10 @@ show_usage(const char *name, gboolean terse)
_("allow multiple instances"));
g_string_append_printf(str, " -n, --nologin %s\n",
_("don't automatically login"));
+ g_string_append_printf(str, " -t, --list %s\n",
+ _("list status msg's"));
+ g_string_append_printf(str, " -p, --status %s\n",
+ _("set status msg's"));
g_string_append_printf(str, " -l, --login[=%s] %s\n",
_("NAME"),
_("enable specified account(s) (optional argument NAME\n"
@@ -476,6 +480,7 @@ int main(int argc, char *argv[])
gboolean opt_login = FALSE;
gboolean opt_nologin = FALSE;
gboolean opt_version = FALSE;
+ gboolean opt_status_list = FALSE;
gboolean opt_si = TRUE; /* Check for single instance? */
char *opt_config_dir_arg = NULL;
char *opt_login_arg = NULL;
@@ -647,9 +652,9 @@ int main(int argc, char *argv[])
opterr = 1;
while ((opt = getopt_long(argc, argv,
#ifndef _WIN32
- "c:dfhmnl::s:v",
+ "c:dfhmnl::s:vtp",
#else
- "c:dfhmnl::v",
+ "c:dfhmnl::vtp",
#endif
long_options, NULL)) != -1) {
switch (opt) {
@@ -685,6 +690,11 @@ int main(int argc, char *argv[])
case 'm': /* do not ensure single instance. */
opt_si = FALSE;
break;
+ case 't': printf("\n Listing status msg\n");
+ opt_status_list = TRUE;
+ break;
+ case 'p': printf("\n settting status list\n");
+ break;
case 'D': /* --display */
case 'S': /* --sync */
/* handled by gtk_init_check below */
@@ -718,6 +728,16 @@ int main(int argc, char *argv[])
return 0;
}
+
+ if(opt_status_list) {
+ list_statuses();
+
+#ifdef HAVE_SIGNAL_H
+ g_free(segfault_message);
+#endif
+ return 0;
+ }
+
/* set a user-specified config directory */
if (opt_config_dir_arg != NULL) {
purple_util_set_user_dir(opt_config_dir_arg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment