Permalink
Browse files

Cleanup the libpurple user_dir files since we don't really need/want 'em

  • Loading branch information...
1 parent 4f9bb00 commit 36d28b2f1781bd24040241474c5670ab2126b5cf @Vagabond committed Aug 19, 2009
Showing with 26 additions and 2 deletions.
  1. +4 −0 README.markdown
  2. +22 −2 libpurperl.c
View
@@ -7,3 +7,7 @@ message protocols and is part of the pidgin project (http://pidgin.im).
This library is currently in a very early stage of development, but
contribitions are welcome.
+
+Right now, I'm aiming for one port per account logon - if you want to connect to
+multiple accounts start a seperate port for each. This is to provide
+fault-tolerance and to make the port itself vastly simpler.
View
@@ -283,14 +283,14 @@ init_libpurple(void)
purple_blist_load();
/* Load the preferences. */
- purple_prefs_load();
+ /*purple_prefs_load();*/
/* Load the desired plugins. The client should save the list of loaded plugins in
* the preferences using purple_plugins_save_loaded(PLUGIN_SAVE_PREF) */
/*purple_plugins_load_saved(PLUGIN_SAVE_PREF);*/
/* Load the pounces. */
- purple_pounces_load();
+ /*purple_pounces_load();*/
}
static void
@@ -441,12 +441,22 @@ gboolean socket_data(GIOChannel *source, GIOCondition condition, gpointer data)
}
int main(int argc, char** argv) {
+ char tmpdir[100] = "/tmp/.libpurperl-XXXXXXX";
GIOChannel *chan = g_io_channel_unix_new(0);
+
+ if (mkdtemp(tmpdir) == NULL) {
+ port_write("-ERR Failed to initialize temporary directory");
+ return 1;
+ }
mainloop = g_main_loop_new (NULL, FALSE);
signal(SIGCHLD, SIG_IGN);
+ purple_util_set_user_dir(tmpdir);
+
+ port_write(purple_user_dir());
+
init_libpurple();
port_write("libpurple initialized");
@@ -457,5 +467,15 @@ int main(int argc, char** argv) {
g_main_loop_run (mainloop);
+ if (strlen(tmpdir) > 0) {
+ char *cmd;
+
+ /* TODO using system() for this is lame, but writing a recursive rmdir is
+ * almost as bad. Until I find/write a function to do it we'll just use this
+ * hack */
+ asprintf(&cmd, "rm -rf %s", tmpdir);
+ system(cmd);
+ }
+
return 0;
}

0 comments on commit 36d28b2

Please sign in to comment.