[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src edit_local_accounts.c,1.1,1.2 main.c,1.1
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src edit_local_accounts.c,1.1,1.2 main.c,1.16,1.17 service.c,1.7,1.8 service.h,1.9,1.10 status.c,1.31,1.32 util.c,1.23,1.24 util.h,1.12,1.13 |
Date: |
Fri, 24 Jan 2003 00:25:37 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv764/src
Modified Files:
edit_local_accounts.c main.c service.c service.h status.c
util.c util.h
Log Message:
cosmetics
Index: edit_local_accounts.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/edit_local_accounts.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- edit_local_accounts.c 24 Jan 2003 04:38:27 -0000 1.1
+++ edit_local_accounts.c 24 Jan 2003 05:25:34 -0000 1.2
@@ -70,8 +70,7 @@
account_row text;
GList * node;
- for(node = accounts; node; node = node->next)
- {
+ for (node = accounts; node; node = node->next) {
eb_local_account * ela = node->data;
GList * pairs = RUN_SERVICE(ela)->write_local_config(ela);
@@ -128,8 +127,7 @@
static void remove_callback(GtkWidget * widget, gpointer data)
{
- if(selected_row != -1)
- {
+ if (selected_row != -1) {
gtk_clist_remove(GTK_CLIST(account_list), selected_row);
num_accounts--;
selected_row = -1;
@@ -148,7 +146,7 @@
return NULL;
while (l) {
- if(!strcmp(l->data, SERVICE_TYPE[text]))
+ if (!strcmp(l->data, SERVICE_TYPE[text]))
return
eb_services[get_service_id(l->data)].sc->check_login(USER_NAME[text],
PASSWORD[text]);
l = l->next;
}
@@ -165,8 +163,7 @@
text[SERVICE_TYPE] =
gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(service_type)->entry));
error_message = check_login_validity(text);
- if(error_message)
- {
+ if (error_message) {
do_error_dialog(error_message,
_("Wrong parameters"));
return;
@@ -206,7 +203,7 @@
static void cancel_callback(GtkWidget *widget, gpointer data)
{
gtk_widget_destroy(account_window);
- if(!statuswindow)
+ if (!statuswindow)
gtk_main_quit();
}
@@ -236,13 +233,12 @@
return;
}
- for(i = 0; i < num_accounts; i++)
- {
+ for (i = 0; i < num_accounts; i++) {
gtk_clist_get_text(GTK_CLIST(account_list), i, SERVICE_TYPE,
&service);
gtk_clist_get_text(GTK_CLIST(account_list), i, USER_NAME,
&user);
gtk_clist_get_text(GTK_CLIST(account_list), i, PASSWORD,
&pass);
id=get_service_id(service);
- if(accounts && (ela = find_local_account_by_handle(user, id))) {
+ if (accounts && (ela = find_local_account_by_handle(user, id)))
{
/* If the account exits, just update the password
*/
GList * config = NULL;
@@ -253,8 +249,7 @@
value_pair_print_values(config, fp, 1);
fprintf(fp, "</ACCOUNT>\n");
existing_accounts = g_list_append(existing_accounts,
ela);
- }
- else {
+ } else {
GList * config = NULL;
eb_debug(DBG_CORE, "Adding new account %s service
%s\n", user, service);
pairs = value_pair_add(NULL, "SCREEN_NAME", user);
@@ -262,18 +257,17 @@
save_account_info(service, pairs);
ela =
eb_services[id].sc->read_local_account_config(pairs);
//prevent segfault
- if(ela != NULL) {
+ if (ela != NULL) {
// Is this an account for which a module is not
loaded?
- if(ela->service_id==-1)
+ if (ela->service_id==-1)
ela->service_id=id;
new_accounts = g_list_append(new_accounts, ela);
config =
eb_services[id].sc->write_local_config(ela);
fprintf(fp, "<ACCOUNT %s>\n", service);
value_pair_print_values(config, fp, 1);
fprintf(fp, "</ACCOUNT>\n");
- } else {
+ } else
do_error_dialog(_("Can't add account : unknown
service"), _("Error"));
- }
}
}
@@ -283,10 +277,10 @@
acc_walk = accounts;
if (acc_walk) {
while(acc_walk != NULL && acc_walk->data != NULL) {
- if (g_list_find(existing_accounts, acc_walk->data) ==
NULL) {
+ if (!g_list_find(existing_accounts, acc_walk->data)) {
eb_local_account *removed = (eb_local_account
*)(acc_walk->data);
/* removed account */
- if(removed && removed->connected
+ if (removed && removed->connected
&& RUN_SERVICE(removed)->logout != NULL)
RUN_SERVICE(removed)->logout(removed);
to_remove = g_list_append(to_remove,
acc_walk->data);
@@ -309,8 +303,7 @@
gtk_widget_destroy(account_window);
/* if this was an initial launch, start up EB */
- if(!had_accounts)
- {
+ if (!had_accounts) {
load_accounts();
load_contacts();
eb_status_window();
@@ -337,7 +330,7 @@
GdkPixmap *icon;
GdkBitmap *mask;
- if(is_open)
+ if (is_open)
return;
is_open = 1;
@@ -517,5 +510,4 @@
GTK_SIGNAL_FUNC(destroy), NULL );
gtk_widget_show(account_window);
gtk_widget_grab_focus(username);
-
}
Index: main.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/main.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- main.c 24 Jan 2003 00:29:13 -0000 1.16
+++ main.c 24 Jan 2003 05:25:34 -0000 1.17
@@ -70,79 +70,78 @@
static void eb_cli_ver ()
{
- printf("Ayttm v%s%s\n", VERSION, RELEASE);
- printf("Copyright (C) 2003 The Ayttm team\n");
- printf("Ayttm comes with NO WARRANTY, to the extent permitted"
- " by law.\n");
- printf("You may redistribute copies of Ayttm under the terms of the\n");
- printf("GNU General Public License. For more information about these\n");
- printf("matters, see the file named COPYING.\n");
- printf("\nAyttm is brought to you by (in no order): Torrey Searle, \n");
- printf("Jared Peterson, Ben Rigas, Alex Wheeler, Robert Lazzurs, Meredydd
Luff,\n");
- printf("Vance Lankhaar, Erik Inge Bolsø, Colin Leroy, Philip Tellis, Jeff
Miller,\n");
- printf("and Troy Morrison.\n");
- printf("\nFor more information on Ayttm, visit the website at\n");
- printf(" http://www.nongnu.org/ayttm/\n");
- return;
+ printf("Ayttm v%s%s\n", VERSION, RELEASE);
+ printf("Copyright (C) 2003 The Ayttm team\n");
+ printf("Ayttm comes with NO WARRANTY, to the extent permitted"
+ " by law.\n");
+ printf("You may redistribute copies of Ayttm under the terms of the\n");
+ printf("GNU General Public License. For more information about
these\n");
+ printf("matters, see the file named COPYING.\n");
+ printf("\nAyttm is brought to you by (in no order): Torrey Searle, \n");
+ printf("Jared Peterson, Ben Rigas, Alex Wheeler, Robert Lazzurs,
Meredydd Luff,\n");
+ printf("Vance Lankhaar, Erik Inge Bolsø, Colin Leroy, Philip Tellis,
Jeff Miller,\n");
+ printf("and Troy Morrison.\n");
+ printf("\nFor more information on Ayttm, visit the website at\n");
+ printf(" http://www.nongnu.org/ayttm/\n");
+ return;
}
struct option_help
{
- const char s_opt;
- const char * l_opt;
- const char * help;
+ const char s_opt;
+ const char * l_opt;
+ const char * help;
};
static struct option_help options [] =
{
- {'h', "help", "Display this help and exit"},
- {'v', "version", "Output version information and exit"},
- {'g', "geometry", "Set position of main window"},
- {'d', "config-dir", "Specify configuration directory"},
- {'D', "disable-server", "Disable console message server"},
- {'c', "contact", "Specify contact to send a message to via console
server"},
- {'m', "message", "Specify the message to send via console server"},
- {' ', NULL, "-c and -m must be used toegether"},
- {'\0', NULL, NULL}
+ {'h', "help", "Display this help and exit"},
+ {'v', "version", "Output version information and exit"},
+ {'g', "geometry", "Set position of main window"},
+ {'d', "config-dir", "Specify configuration directory"},
+ {'D', "disable-server", "Disable console message server"},
+ {'c', "contact", "Specify contact to send a message to via console
server"},
+ {'m', "message", "Specify the message to send via console server"},
+ {' ', NULL, "-c and -m must be used toegether"},
+ {'\0', NULL, NULL}
};
static void eb_cli_help (const char * cmd)
{
- unsigned int i = 0;
+ unsigned int i = 0;
- printf("Usage: %s [OPTION]...\n", cmd);
- printf("An integrated instant messenger program.\n");
- printf("Supports AIM, ICQ, MSN, Yahoo!, Jabber, and IRC.\n\n");
+ printf("Usage: %s [OPTION]...\n", cmd);
+ printf("An integrated instant messenger program.\n");
+ printf("Supports AIM, ICQ, MSN, Yahoo!, Jabber, and IRC.\n\n");
#if defined (HAVE_GETOPT) || defined (HAVE_GETOPT_LONG)
-for (i = 0; options [i].help != NULL; i++)
-{
+ for (i = 0; options [i].help != NULL; i++) {
#ifdef HAVE_GETOPT_LONG
- printf (" %c%c %2s%15s %s\n",
- (options [i].s_opt == ' ' ? ' ' : '-'),
- options [i].s_opt,
- (options [i].l_opt == NULL ? " " : "--"),
- options [i].l_opt,
- options [i].help);
+ printf (" %c%c %2s%15s %s\n",
+ (options [i].s_opt == ' ' ? ' ' : '-'),
+ options [i].s_opt,
+ (options [i].l_opt == NULL ? " " : "--"),
+ options [i].l_opt,
+ options [i].help);
#else /* HAVE_GETOPT_LONG */
/* Leaves HAVE_GETOPT */
- printf (" %c%c %s\n",
- (options [i].s_opt == ' ' ? ' ' : '-'),
- options [i].s_opt,
- options [i].help);
+ printf (" %c%c %s\n",
+ (options [i].s_opt == ' ' ? ' ' : '-'),
+ options [i].s_opt,
+ options [i].help);
#endif /* HAVE_GETOPT_LONG */
-}
+ }
#endif /* defined (HAVE_GETOPT) || defined (HAVE_GETOPT_LONG) */
- return;
+ return;
}
@@ -154,13 +153,10 @@
static void start_login(gboolean new)
{
if (new)
- {
eb_new_user();
- }
- else
- {
+ else {
eb_status_window();
- if( iGetLocalPref("do_login_on_startup") )
+ if ( iGetLocalPref("do_login_on_startup") )
eb_sign_on_all() ;
}
}
@@ -202,8 +198,7 @@
#endif
#if defined ( HAVE_GETOPT ) || defined ( HAVE_GETOPT_LONG )
- while (1)
- {
+ while (1) {
#ifdef HAVE_GETOPT_LONG
static struct option long_options[] =
{
@@ -231,12 +226,9 @@
/* Detect the end of the options. */
if (c == -1)
- {
break;
- }
- switch (c)
- {
+ switch (c) {
case 'v': /* version information */
eb_cli_ver ();
exit(0);
@@ -252,7 +244,6 @@
strcpy(geometry, optarg);
break;
-
case ':':
printf("Try 'ayttm --help' for more information.\n");
exit(0);
@@ -284,44 +275,42 @@
strcpy(config_dir, optarg);
/*Make sure we have directory delimiter */
#if defined( _WIN32 )
- if(config_dir[strlen(config_dir)-1]!='\\')
+ if (config_dir[strlen(config_dir)-1]!='\\')
strcat(config_dir, "\\");
#else
- if(config_dir[strlen(config_dir)-1]!='/')
+ if (config_dir[strlen(config_dir)-1]!='/')
strcat(config_dir, "/");
#endif
- if(stat(config_dir, &stat_buf)==-1)
+ if (stat(config_dir, &stat_buf)==-1)
{
perror(config_dir);
exit(errno);
}
- if(!S_ISDIR(stat_buf.st_mode))
+ if (!S_ISDIR(stat_buf.st_mode))
{
printf("config-dir %s is not a directory!\n",
config_dir);
exit(1);
}
break;
-
}
- }
+ }
#ifdef CRASH_DIALOG
- startup_dir = g_get_current_dir();
- argv0 = g_strdup(argv[0]);
- if (crash) {
- gtk_set_locale();
- gtk_init(&argc, &argv);
- eb_read_prefs();
- crash_main(crash_param);
- return 0;
- }
- crash_install_handlers();
+ startup_dir = g_get_current_dir();
+ argv0 = g_strdup(argv[0]);
+ if (crash) {
+ gtk_set_locale();
+ gtk_init(&argc, &argv);
+ eb_read_prefs();
+ crash_main(crash_param);
+ return 0;
+ }
+ crash_install_handlers();
#endif
#endif
- if(strlen(message) > 0 && strlen(contact) > 0)
- {
+ if (strlen(message) > 0 && strlen(contact) > 0) {
#ifndef __MINGW32__
struct sockaddr_un remote;
#else
@@ -339,8 +328,7 @@
#else
sock = socket(AF_INET, SOCK_STREAM, 0);
#endif
- if(connect(sock, (struct sockaddr*)&remote, len) == -1 )
- {
+ if (connect(sock, (struct sockaddr*)&remote, len) == -1 ) {
perror("connect");
exit(1);
}
@@ -381,8 +369,7 @@
#else
sock = socket(AF_INET, SOCK_STREAM, 0);
#endif
- if(connect(sock, (struct sockaddr*)&remote, len) == -1 )
- {
+ if (connect(sock, (struct sockaddr*)&remote, len) == -1 ) {
perror("connect");
g_snprintf(buff, 1024, _("Ayttm already running,
pid=%d\n"), pid);
/* TODO make sure this one is modal */
@@ -404,7 +391,7 @@
g_snprintf(buff, 1024, "%slogs",config_dir);
mkdir(buff, 0700);
- if(!disable_console_server) {
+ if (!disable_console_server) {
#ifndef __MINGW32__
sock = socket(AF_UNIX, SOCK_STREAM, 0);
strcpy(local.sun_path, config_dir);
@@ -415,13 +402,11 @@
#else
sock = socket(AF_INET, SOCK_STREAM, 0);
#endif
- if(bind(sock, (struct sockaddr *)&local, len) == -1)
- {
+ if (bind(sock, (struct sockaddr *)&local, len) == -1) {
perror("Unable to handle console connections. bind");
exit(1);
}
- if(listen(sock, 5) == -1)
- {
+ if (listen(sock, 5) == -1) {
perror("Unable to handle console connections. listen");
exit(1);
}
@@ -437,10 +422,8 @@
load_modules();
accounts_success = load_accounts();
- if(accounts_success)
- {
+ if (accounts_success)
load_contacts();
- }
start_login(!accounts_success);
@@ -451,7 +434,7 @@
sound_shutdown();
g_snprintf(buff, 1024, "%s.lock", config_dir);
#ifndef __MINGW32__
- if(!disable_console_server)
+ if (!disable_console_server)
unlink(local.sun_path);
delete_lock_file(buff);
#endif
Index: service.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/service.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- service.c 17 Jan 2003 19:00:59 -0000 1.7
+++ service.c 24 Jan 2003 05:25:34 -0000 1.8
@@ -69,18 +69,16 @@
assert(Service_Info);
eb_debug(DBG_CORE, ">Entering\n");
- if(Service_Info->sc->read_prefs_config) {
+ if (Service_Info->sc->read_prefs_config) {
session_prefs=GetPref(Service_Info->name);
Service_Info->sc->read_prefs_config(session_prefs);
}
- for (i=0; i < NUM_SERVICES; i++ )
- {
+ for (i=0; i < NUM_SERVICES; i++ ) {
/* Check to see if another service exists for the same
protocol, if so, replace it */
- if(!strcasecmp(eb_services[i].name,Service_Info->name))
+ if (!strcasecmp(eb_services[i].name,Service_Info->name))
{
eb_debug(DBG_CORE, "Replacing %s service\n",
Service_Info->name);
-// free(eb_services[i].name);
free(eb_services[i].sc);
Service_Info->protocol_id=i;
memcpy(&eb_services[i], Service_Info,
sizeof(struct service));
@@ -105,9 +103,8 @@
int i;
char buf[1024];
- for (i=0; i < NUM_SERVICES; i++ )
- {
- if(strcasecmp(eb_services[i].name,servicename)==0)
+ for (i=0; i < NUM_SERVICES; i++ ) {
+ if (strcasecmp(eb_services[i].name,servicename)==0)
{
return i;
}
@@ -126,9 +123,7 @@
gchar *get_service_name( gint service_id )
{
if ((service_id >= 0) && (service_id < NUM_SERVICES))
- {
return (eb_services[service_id].name);
- }
fprintf(stderr, "warning: unknown service id: %d\n", service_id);
return "unknown";
@@ -138,32 +133,27 @@
{
GList * newlist = NULL;
int i;
- for( i = 0; i < NUM_SERVICES; i++ )
- {
+ for ( i = 0; i < NUM_SERVICES; i++ )
newlist = g_list_append( newlist, eb_services[i].name );
- }
+
return newlist;
}
void serv_touch_idle()
{
- /* Are we idle? If so, not anymore */
- if (is_idle > 0) {
+ /* Are we idle? If so, not anymore */
+ if (is_idle > 0) {
GList * node;
- is_idle = 0;
- for(node = accounts; node; node = node->next )
- {
- if(((eb_local_account *)(node->data))->connected)
- {
-
if(RUN_SERVICE(((eb_local_account*)(node->data)))->set_idle)
- {
-
RUN_SERVICE(((eb_local_account*)node->data))->set_idle(
-
(eb_local_account*)node->data, 0);
- }
+ is_idle = 0;
+ for (node = accounts; node; node = node->next ) {
+ if (((eb_local_account *)(node->data))->connected
+ &&
RUN_SERVICE(((eb_local_account*)(node->data)))->set_idle) {
+
RUN_SERVICE(((eb_local_account*)node->data))->set_idle(
+ (eb_local_account*)node->data, 0);
}
}
- }
- time(&lastsent);
+ }
+ time(&lastsent);
}
static guint idle_time = 0;
@@ -175,15 +165,11 @@
if (!is_idle)
return FALSE;
- for(node = accounts; node; node = node->next )
- {
- if(((eb_local_account *)node->data)->connected)
- {
-
if(RUN_SERVICE(((eb_local_account*)node->data))->set_idle)
- {
-
RUN_SERVICE(((eb_local_account*)node->data))->set_idle(
- (eb_local_account*)node->data,
idle_time);
- }
+ for (node = accounts; node; node = node->next ) {
+ if (((eb_local_account *)node->data)->connected
+ && RUN_SERVICE(((eb_local_account*)node->data))->set_idle) {
+ RUN_SERVICE(((eb_local_account*)node->data))->set_idle(
+ (eb_local_account*)node->data, idle_time);
}
}
return TRUE;
@@ -204,27 +190,23 @@
} else
#endif
{
- time_t t;
+ time_t t;
- if (is_idle)
- return TRUE;
- time(&t);
-
+ if (is_idle)
+ return TRUE;
+ time(&t);
idle_time = t - lastsent;
}
+
if ((idle_time >= 600) && sendIdleTime) {
if (is_idle == 0) {
GList * node;
idle_reporter = eb_timeout_add(60000, report_idle,
NULL);
- for(node = accounts; node; node = node->next )
- {
- if(((eb_local_account *)node->data)->connected)
- {
-
if(RUN_SERVICE(((eb_local_account*)node->data))->set_idle)
- {
-
RUN_SERVICE(((eb_local_account*)node->data))->set_idle(
-
(eb_local_account*)node->data, idle_time);
- }
+ for (node = accounts; node; node = node->next ) {
+ if (((eb_local_account *)node->data)->connected
+ &&
RUN_SERVICE(((eb_local_account*)node->data))->set_idle) {
+
RUN_SERVICE(((eb_local_account*)node->data))->set_idle(
+
(eb_local_account*)node->data, idle_time);
}
}
}
@@ -234,7 +216,7 @@
gtk_idle_remove(idle_reporter);
serv_touch_idle();
}
- return TRUE;
+ return TRUE;
}
void add_idle_check()
@@ -248,38 +230,3 @@
}
#endif
}
-
-void rename_nick_log(char *oldgroup, char *oldnick, char *newgroup, char
*newnick)
-{
- gchar oldnicklog[255], newnicklog[255], buff[255];
- FILE *test = NULL;
- make_safe_filename(buff, oldnick, oldgroup);
- strcpy(oldnicklog, buff);
-
- make_safe_filename(buff, newnick, newgroup);
- strcpy(newnicklog, buff);
-
- if ((test = fopen(newnicklog,"r")) != NULL &&
strcmp(oldnicklog,newnicklog)) {
- FILE *oldfile = fopen(oldnicklog,"r");
- gchar read_buffer[4096];
-
- fclose(test);
- test = fopen(newnicklog,"a");
-
- if (oldfile) {
- while (fgets(read_buffer, 4096, oldfile) != NULL)
- fputs(read_buffer,test);
-
- fclose(oldfile);
- }
- fclose(test);
- unlink(oldnicklog);
- eb_debug(DBG_CORE,"Copied log from %s to %s\n", oldnicklog,
newnicklog);
- }
-
- else if (strcmp(oldnicklog,newnicklog)) {
- rename(oldnicklog, newnicklog);
- eb_debug(DBG_CORE,"Renamed log from %s to %s\n", oldnicklog,
newnicklog);
- }
-}
-
Index: service.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/service.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- service.h 21 Jan 2003 13:22:22 -0000 1.9
+++ service.h 24 Jan 2003 05:25:34 -0000 1.10
@@ -239,7 +239,6 @@
void add_idle_check();
void serv_touch_idle();
-void rename_nick_log(char *oldgroup, char *oldnick, char *newgroup, char
*newnick);
GList * get_service_list();
#ifdef __cplusplus
Index: status.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/status.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- status.c 24 Jan 2003 00:29:13 -0000 1.31
+++ status.c 24 Jan 2003 05:25:34 -0000 1.32
@@ -59,8 +59,8 @@
struct acctStatus
{
- eb_local_account * ela;
- gint status;
+ eb_local_account * ela;
+ gint status;
};
@@ -98,10 +98,9 @@
[...1322 lines suppressed...]
- gtk_window_set_position(GTK_WINDOW(statuswindow),
GTK_WIN_POS_NONE);
- gtk_widget_set_uposition(statuswindow, win_x, win_y);
- gtk_widget_set_usize(statuswindow, win_w, win_h);
+ flags = XParseGeometry(geometry, &win_x, &win_y, &win_w,
&win_h);
+ gtk_window_set_position(GTK_WINDOW(statuswindow),
GTK_WIN_POS_NONE);
+ gtk_widget_set_uposition(statuswindow, win_x, win_y);
+ gtk_widget_set_usize(statuswindow, win_w, win_h);
}
#endif
statusbox = gtk_vbox_new(FALSE, 0);
@@ -1837,8 +1734,7 @@
vbox = gtk_vbox_new(FALSE, 0);
hbox = gtk_hbox_new(FALSE, 0);
- label = gtk_radio_button_new_with_label
- (NULL, _("Online"));
+ label = gtk_radio_button_new_with_label (NULL, _("Online"));
gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 1);
gtk_signal_connect(GTK_OBJECT(label), "clicked",
GTK_SIGNAL_FUNC(status_show_callback),
Index: util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- util.c 21 Jan 2003 13:22:22 -0000 1.23
+++ util.c 24 Jan 2003 05:25:34 -0000 1.24
@@ -1787,5 +1787,39 @@
fclose (queue);
rename (temp_name, queue_name);
return 0;
-
}
+
+void rename_nick_log(char *oldgroup, char *oldnick, char *newgroup, char
*newnick)
+{
+ gchar oldnicklog[255], newnicklog[255], buff[255];
+ FILE *test = NULL;
+ make_safe_filename(buff, oldnick, oldgroup);
+ strcpy(oldnicklog, buff);
+
+ make_safe_filename(buff, newnick, newgroup);
+ strcpy(newnicklog, buff);
+
+ if ((test = fopen(newnicklog,"r")) != NULL &&
strcmp(oldnicklog,newnicklog)) {
+ FILE *oldfile = fopen(oldnicklog,"r");
+ gchar read_buffer[4096];
+
+ fclose(test);
+ test = fopen(newnicklog,"a");
+
+ if (oldfile) {
+ while (fgets(read_buffer, 4096, oldfile) != NULL)
+ fputs(read_buffer,test);
+
+ fclose(oldfile);
+ }
+ fclose(test);
+ unlink(oldnicklog);
+ eb_debug(DBG_CORE,"Copied log from %s to %s\n", oldnicklog,
newnicklog);
+ }
+
+ else if (strcmp(oldnicklog,newnicklog)) {
+ rename(oldnicklog, newnicklog);
+ eb_debug(DBG_CORE,"Renamed log from %s to %s\n", oldnicklog,
newnicklog);
+ }
+}
+
Index: util.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- util.h 21 Jan 2003 13:22:22 -0000 1.12
+++ util.h 24 Jan 2003 05:25:34 -0000 1.13
@@ -127,6 +127,7 @@
GList * get_groups();
void contact_mgmt_queue_add(eb_account *ea, int action, char *group);
gint contact_mgmt_flush(eb_local_account *ela);
+void rename_nick_log(char *oldgroup, char *oldnick, char *newgroup, char
*newnick);
#ifdef __cplusplus
} /* extern "C" */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src edit_local_accounts.c,1.1,1.2 main.c,1.16,1.17 service.c,1.7,1.8 service.h,1.9,1.10 status.c,1.31,1.32 util.c,1.23,1.24 util.h,1.12,1.13,
Colin Leroy <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm/src edit_local_accounts.c,NONE,1.1 Makefile.am,1.16,1.17 editcontacts.c,1.16,NONE
- Next by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.188,1.189 configure.in,1.184,1.185
- Previous by thread:
[Ayttm-commits] CVS: ayttm/src edit_local_accounts.c,NONE,1.1 Makefile.am,1.16,1.17 editcontacts.c,1.16,NONE
- Next by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.188,1.189 configure.in,1.184,1.185
- Index(es):