From: <cv...@li...> - 2003-04-16 15:33:26
|
Changes in directory wzdftpd/src: wzd_site.c updated: 1.18 -> 1.19 wzd_site_user.c updated: 1.11 -> 1.12 wzd_site_user.h updated: 1.5 -> 1.6 --- Log message: Added 'site color' command --- Diffs of the changes: Index: wzdftpd/src/wzd_site.c diff -u wzdftpd/src/wzd_site.c:1.18 wzdftpd/src/wzd_site.c:1.19 --- wzdftpd/src/wzd_site.c:1.18 Tue Apr 15 15:27:40 2003 +++ wzdftpd/src/wzd_site.c Wed Apr 16 17:33:14 2003 @@ -942,6 +942,7 @@ if (site_command_add(&config->site_list,"CHPASS",&do_site_chpass)) return 1; if (site_command_add(&config->site_list,"CHRATIO",&do_site_chratio)) return 1; /* do_site_close ? */ + if (site_command_add(&config->site_list,"COLOR",&do_site_color)) return 1; if (site_command_add(&config->site_list,"DELIP",&do_site_delip)) return 1; if (site_command_add(&config->site_list,"DELUSER",&do_site_deluser)) return 1; if (site_command_add(&config->site_list,"FLAGS",&do_site_flags)) return 1; Index: wzdftpd/src/wzd_site_user.c diff -u wzdftpd/src/wzd_site_user.c:1.11 wzdftpd/src/wzd_site_user.c:1.12 --- wzdftpd/src/wzd_site_user.c:1.11 Tue Apr 15 15:27:40 2003 +++ wzdftpd/src/wzd_site_user.c Wed Apr 16 17:33:14 2003 @@ -569,6 +569,44 @@ return 0; } + +/** site color: toggle color user (for self only) + * + * change color + */ +int do_site_color(char *command_line, wzd_context_t * context) +{ + wzd_user_t * me; + char * src_ptr, *dst_ptr; + char new_flags[MAX_FLAGS_NUM]; + int i, found, ret; + + me = GetUserByID(context->userid); + + found=0; + src_ptr = me->flags; + dst_ptr = new_flags; + for (i=0; *src_ptr && i<MAX_FLAGS_NUM; i++,src_ptr++,dst_ptr++) + { + if ( *src_ptr==FLAG_COLOR) { found=1; continue; } + *dst_ptr = *src_ptr; + } + if (!found) { + *dst_ptr++ = FLAG_COLOR; + *dst_ptr='\0'; + memcpy(me->flags,new_flags,MAX_FLAGS_NUM); + ret = backend_mod_user("plaintext",me->username,me,_USER_FLAGS); + ret = send_message_with_args(200,context,"color mode ON"); + } else { + *dst_ptr='\0'; + memcpy(me->flags,new_flags,MAX_FLAGS_NUM); + ret = backend_mod_user("plaintext",me->username,me,_USER_FLAGS); + ret = send_message_with_args(200,context,"color mode OFF"); + } + return 0; +} + + void do_site_help_change(wzd_context_t * context) { send_message_raw("501-site change <user> <field> <value>\r\n",context); Index: wzdftpd/src/wzd_site_user.h diff -u wzdftpd/src/wzd_site_user.h:1.5 wzdftpd/src/wzd_site_user.h:1.6 --- wzdftpd/src/wzd_site_user.h:1.5 Mon Apr 7 15:20:39 2003 +++ wzdftpd/src/wzd_site_user.h Wed Apr 16 17:33:14 2003 @@ -35,6 +35,8 @@ int do_site_addip(char *command_line, wzd_context_t * context); int do_site_delip(char *command_line, wzd_context_t * context); +int do_site_color(char *command_line, wzd_context_t * context); + int do_site_chgrp(char *command_line, wzd_context_t * context); int do_site_chratio(char *command_line, wzd_context_t * context); int do_site_give(char *command_line, wzd_context_t * context); |