Skip to content

Commit

Permalink
Cleanup the libpurple user_dir files since we don't really need/want 'em
Browse files Browse the repository at this point in the history
  • Loading branch information
Vagabond committed Aug 19, 2009
1 parent 4f9bb00 commit 36d28b2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.markdown
Expand Up @@ -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.
24 changes: 22 additions & 2 deletions libpurperl.c
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand All @@ -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.