• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/sambaclient/

Lines Matching refs:index

281                 g_pSyncList[i]->index = i;
424 int deal_dragfolder_to_socketlist(char *dir, int index)
451 add_socket_item(info, index);
453 status = deal_dragfolder_to_socketlist(fullname, index);
459 add_socket_item(info, index);
469 int socket_check(char *dir, char *name, int index)
492 Node *pTemp = g_pSyncList[index]->SocketActionList->next;
606 int moveFolder(char *old_dir, char *new_dir, int index)
608 SMB_rm(old_dir, index);
617 status = SMB_mkdir(new_dir, index);
636 if(socket_check(new_dir, ent->d_name, index) == 1)
641 status = moveFolder(old_fullname, new_fullname, index);
645 status = SMB_upload(new_fullname,index);
648 char *serverpath = localpath_to_serverpath(new_fullname, index);
649 time_t modtime = Getmodtime(serverpath, index);
651 if(ChangeFile_modtime(new_fullname, modtime, index))
672 int cmd_parser(char *cmd, int index)
687 g_pSyncList[index]->no_local_root = 1;
826 del_action_item("copyfile", cmp_name, g_pSyncList[index]->copy_file_list);
835 del_action_item("copyfile", cmp_name, g_pSyncList[index]->copy_file_list);
839 del_action_item("copyfile", cmp_name, g_pSyncList[index]->copy_file_list);
850 if(g_pSyncList[index]->server_action_list->next != NULL)
854 item = get_action_item(action, cmp_name, g_pSyncList[index]->server_action_list, index);
860 del_action_item(action, cmp_name, g_pSyncList[index]->server_action_list);
868 if(g_pSyncList[index]->dragfolder_action_list->next != NULL)
872 item = get_action_item(action, cmp_name, g_pSyncList[index]->dragfolder_action_list, index);
877 del_action_item(action, cmp_name, g_pSyncList[index]->dragfolder_action_list);
889 g_pSyncList[index]->have_local_socket = 1;
896 int exist = is_server_exist(fullname, index);
899 char *temp = change_same_name(fullname, index, 0);
902 SMB_remo(fullname, temp, index);
910 status = SMB_upload(fullname, index);
912 char *serverpath = localpath_to_serverpath(fullname, index);
914 time_t modtime = Getmodtime(serverpath, index);
916 if(ChangeFile_modtime(fullname, modtime, index))
926 add_action_item("copyfile", fullname, g_pSyncList[index]->copy_file_list);
932 char *serverpath = localpath_to_serverpath(fullname,index);
934 exist = is_server_exist(fullname, index);
937 status = SMB_upload(fullname, index);
947 time_t modtime = Getmodtime(serverpath, index);
948 if(ChangeFile_modtime(fullname, modtime, index))
959 //printf("init_completed=%d\n",g_pSyncList[index]->init_completed);
960 if(g_pSyncList[index]->init_completed)
961 cloud_file = get_CloudFile_node(g_pSyncList[index]->OldServerRootNode, serverpath, 0x2,index);
963 cloud_file = get_CloudFile_node(g_pSyncList[index]->ServerRootNode, serverpath, 0x2,index);
965 //printf("rule=%d\n",smb_config.multrule[index]->rule);
966 if(smb_config.multrule[index]->rule == 2)
970 char *temp = change_same_name(fullname, index, 0);
973 SMB_remo(fullname, temp, index);
975 status = SMB_upload(fullname, index);
987 time_t modtime = Getmodtime(serverpath, index);
988 if(ChangeFile_modtime(fullname, modtime, index))
1001 char *temp = change_same_name(fullname, index, 0);
1004 SMB_remo(fullname,temp,index);
1006 status = SMB_upload(fullname, index);
1020 time_t modtime = Getmodtime(serverpath,index);
1021 if(ChangeFile_modtime(fullname, modtime, index))
1033 modtime1 = Getmodtime(serverpath, index);
1037 char *temp = change_same_name(fullname, index, 0);
1040 SMB_remo(fullname, temp, index);
1042 status = SMB_upload(fullname, index);
1055 time_t modtime = Getmodtime(serverpath, index);
1056 if(ChangeFile_modtime(fullname, modtime, index))
1066 status = SMB_upload(fullname, index);
1076 time_t modtime = Getmodtime(serverpath, index);
1077 if(ChangeFile_modtime(fullname, modtime, index))
1092 modtime1 = Getmodtime(serverpath,index);
1103 status = SMB_upload(fullname,index);
1113 time_t modtime = Getmodtime(serverpath, index);
1114 if(ChangeFile_modtime(fullname, modtime, index))
1124 char *temp = change_same_name(fullname, index, 0);
1127 SMB_remo(fullname, temp, index);
1129 status = SMB_upload(fullname, index);
1142 time_t modtime = Getmodtime(serverpath, index);
1143 if(ChangeFile_modtime(fullname, modtime, index))
1157 status = SMB_rm(fullname, index);
1191 int exist = is_server_exist(mv_newpath, index);
1194 status = SMB_remo(mv_oldpath, mv_newpath, index);
1198 char *temp = change_same_name(mv_newpath, index, 0);
1201 SMB_remo(mv_newpath, temp, index);
1206 status = SMB_remo(mv_oldpath, mv_newpath, index);
1214 if(index == old_index)
1216 exist = is_server_exist(mv_newpath, index);
1219 status = SMB_remo(mv_oldpath, mv_newpath, index);
1223 char *temp = change_same_name(mv_newpath, index, 0);
1226 SMB_remo(mv_newpath, temp, index);
1231 status = SMB_remo(mv_oldpath, mv_newpath, index);
1251 status = moveFolder(mv_oldpath, mv_newpath, index);
1256 status = SMB_upload(mv_newpath, index);
1260 char *serverpath = localpath_to_serverpath(mv_newpath, index);
1261 time_t modtime = Getmodtime(serverpath, index);
1263 if(ChangeFile_modtime(mv_newpath, modtime, index))
1283 add_socket_item(info, index);
1285 status = deal_dragfolder_to_socketlist(fullname,index);
1291 int exist = is_server_exist(fullname, index);
1293 status = SMB_mkdir(fullname, index);
1301 int add_all_download_only_socket_list(char *cmd, const char *dir, int index)
1316 add_action_item(cmd, dir, g_pSyncList[index]->download_only_socket_head);
1335 add_all_download_only_socket_list("createfolder", fullname, index);
1339 add_action_item("createfile", fullname, g_pSyncList[index]->download_only_socket_head);
1349 int download_only_add_socket_item(char *cmd, int index)
1364 g_pSyncList[index]->no_local_root = 1;
1499 add_action_item("copyfile", fullname, g_pSyncList[index]->copy_file_list);
1506 del_action_item("copyfile", fullname, g_pSyncList[index]->copy_file_list);
1514 del_action_item("copyfile", fullname, g_pSyncList[index]->copy_file_list);
1519 del_download_only_action_item(action, fullname, g_pSyncList[index]->download_only_socket_head);
1528 del_download_only_action_item(action, old_fullname, g_pSyncList[index]->download_only_socket_head);
1534 del_download_only_action_item(action,old_fullname,g_pSyncList[index]->download_only_socket_head);
1538 if(g_pSyncList[index]->server_action_list->next != NULL)
1542 item = get_action_item(action, fullname, g_pSyncList[index]->server_action_list, index);
1548 del_action_item(action, fullname, g_pSyncList[index]->server_action_list);
1554 if(g_pSyncList[index]->dragfolder_action_list->next != NULL)
1558 item = get_action_item(action, fullname, g_pSyncList[index]->dragfolder_action_list, index);
1563 del_action_item(action, fullname, g_pSyncList[index]->dragfolder_action_list);
1571 g_pSyncList[index]->have_local_socket = 1;
1578 add_all_download_only_socket_list(cmd_name, fullname, index);
1582 add_action_item(cmd_name, fullname, g_pSyncList[index]->download_only_socket_head);
1588 if(old_index == index)
1592 add_all_download_only_socket_list(cmd_name, fullname, index);
1596 add_action_item(cmd_name, fullname, g_pSyncList[index]->download_only_socket_head);
1615 add_all_download_only_socket_list(cmd_name, fullname, index);
1619 add_action_item(cmd_name, fullname, g_pSyncList[index]->download_only_socket_head);
1627 add_action_item(cmd_name, fullname, g_pSyncList[index]->download_only_socket_head);
1628 add_all_download_only_dragfolder_socket_list(fullname, index);
1632 add_action_item(cmd_name, fullname, g_pSyncList[index]->download_only_socket_head);
2047 //int check_smb_auth(Config config, int index)
2049 // SMB_init(index);
2051 // if((dh = smbc_opendir(config.multrule[index]->server_root_path)) < 0)
2288 int sync_server_to_local_perform(Browse *perform_br,Local *perform_lo,int index)
2318 if(smb_config.multrule[index]->rule == 1)
2322 g_pSyncList[index]->download_only_socket_head, index);
2329 if(wait_handle_socket(index))
2333 add_action_item("remove", localfiletmp->path, g_pSyncList[index]->server_action_list);
2337 g_pSyncList[index]->up_space_not_enough_list, index);
2351 if(wait_handle_socket(index))
2356 filelongurl = reduce_memory(filetmp->href, index, 1);
2358 char *localpath = serverpath_to_localpath(filelongurl, index);
2365 item = get_action_item("download", filelongurl, g_pSyncList[index]->unfinished_list, index);
2374 cp = is_smb_file_copying(filelongurl, index);
2378 if(is_local_space_enough(filetmp,index))
2380 add_action_item("createfile",localpath,g_pSyncList[index]->server_action_list);
2382 int status = SMB_download(filelongurl, index);
2389 time_t modtime = Getmodtime(filelongurl, index);
2390 if(ChangeFile_modtime(localpath, modtime, index))
2396 del_action_item("download", filelongurl, g_pSyncList[index]->unfinished_list);
2402 write_log(S_ERROR, "local space is not enough!", "", index);
2405 add_action_item("download", filelongurl, g_pSyncList[index]->unfinished_list);
2420 char *localpathtmp = strstr(localfiletmp->path, smb_config.multrule[index]->client_root_path)
2421 + strlen(smb_config.multrule[index]->client_root_path);
2425 //serverpathtmp = serverpathtmp + strlen(smb_config.multrule[index]->server_root_path);
2441 if(wait_handle_socket(index))
2445 if(smb_config.multrule[index]->rule == 1)
2449 g_pSyncList[index]->download_only_socket_head, index);
2460 g_pSyncList[index]->up_space_not_enough_list, index);
2464 add_action_item("remove", localfiletmp->path, g_pSyncList[index]->server_action_list);
2469 if((ret = the_same_name_compare(localfiletmp, filetmp, index)) != 0)
2485 //serverpathtmp = serverpathtmp + strlen(smb_config.multrule[index]->server_root_path);
2489 char *localpathtmp = strstr(localfiletmp->path, smb_config.multrule[index]->client_root_path)
2490 + strlen(smb_config.multrule[index]->client_root_path);
2506 if(wait_handle_socket(index))
2511 filelongurl = reduce_memory(filetmp->href, index, 1);
2513 char *localpath = serverpath_to_localpath(filelongurl, index);
2520 item = get_action_item("download", filelongurl, g_pSyncList[index]->unfinished_list, index);
2529 cp = is_smb_file_copying(filelongurl, index);
2532 if(is_local_space_enough(filetmp,index))
2534 add_action_item("createfile",localpath,g_pSyncList[index]->server_action_list);
2536 int status = SMB_download(filelongurl, index);
2540 time_t modtime = Getmodtime(filelongurl, index);
2541 if(ChangeFile_modtime(localpath, modtime, index))
2547 del_action_item("download", filelongurl, g_pSyncList[index]->unfinished_list);
2553 write_log(S_ERROR, "local space is not enough!", "", index);
2556 add_action_item("download", filelongurl, g_pSyncList[index]->unfinished_list);
2573 if(smb_config.multrule[index]->rule == 1)
2577 localfoldertmp->path,g_pSyncList[index]->download_only_socket_head,index);
2584 if(wait_handle_socket(index))
2588 del_all_items(localfoldertmp->path, index);
2597 if(wait_handle_socket(index))
2602 folderlongurl = reduce_memory(foldertmp->href, index, 1);
2604 char *localpath = my_malloc(strlen(smb_config.multrule[index]->client_root_path) + strlen(folderlongurl) + 1);
2609 p = p + strlen(smb_config.multrule[index]->server_root_path);
2610 sprintf(localpath,"%s%s",smb_config.multrule[index]->client_root_path, p);
2613 int exist = is_server_exist(localpath, index);
2618 add_action_item("createfolder", localpath, g_pSyncList[index]->server_action_list);
2633 char *localpathtmp = strstr(localfoldertmp->path, smb_config.multrule[index]->client_root_path)
2634 + strlen(smb_config.multrule[index]->client_root_path);
2638 //serverpathtmp = serverpathtmp + strlen(smb_config.multrule[index]->server_root_path);
2650 if(smb_config.multrule[index]->rule == 1)
2654 localfoldertmp->path, g_pSyncList[index]->download_only_socket_head, index);
2662 if(wait_handle_socket(index))
2666 del_all_items(localfoldertmp->path,index);
2678 //serverpathtmp = serverpathtmp + strlen(smb_config.multrule[index]->server_root_path);
2681 char *localpathtmp = strstr(localfoldertmp->path, smb_config.multrule[index]->client_root_path)
2682 +strlen(smb_config.multrule[index]->client_root_path);
2694 if(wait_handle_socket(index))
2699 folderlongurl = reduce_memory(foldertmp->href, index, 1);
2700 char *localpath = serverpath_to_localpath(folderlongurl, index);
2708 int exist = is_server_exist(localpath, index);
2713 add_action_item("createfolder", localpath, g_pSyncList[index]->server_action_list);
2727 int compareLocalList(int index){
2731 if(g_pSyncList[index]->ServerRootNode->Child != NULL)
2734 ret = sync_server_to_local(g_pSyncList[index]->ServerRootNode->Child, sync_server_to_local_perform, index);
2857 int compareServerList(int index)
2862 if(g_pSyncList[index]->ServerRootNode->Child != NULL && g_pSyncList[index]->OldServerRootNode->Child != NULL)
2864 ret = isServerChanged(g_pSyncList[index]->ServerRootNode->Child,g_pSyncList[index]->OldServerRootNode->Child);
2867 else if(g_pSyncList[index]->ServerRootNode->Child == NULL && g_pSyncList[index]->OldServerRootNode->Child == NULL)
2879 int do_unfinished(int index)
2887 p = g_pSyncList[index]->unfinished_list->next;
2895 filetmp = get_CloudFile_node(g_pSyncList[index]->ServerRootNode,p->path,0x2,index);
2901 del_action_item("download", p->path, g_pSyncList[index]->unfinished_list);
2905 char *longurl = reduce_memory(filetmp->href, index, 1);
2906 char *localpath = serverpath_to_localpath(longurl, index);
2913 if(is_local_space_enough(filetmp, index))
2915 add_action_item("createfile",localpath,g_pSyncList[index]->server_action_list);
2916 ret = SMB_download(longurl, index);
2919 ChangeFile_modtime(localpath,filetmp->modtime,index);
2921 del_action_item("download", longurl, g_pSyncList[index]->unfinished_list);
2933 write_log(S_ERROR,"local space is not enough!","",index);
2943 serverpath = localpath_to_serverpath(p->path, index);
2950 ret = SMB_upload(p->path, index);
2955 time_t modtime = Getmodtime(serverpath, index);
2956 if(ChangeFile_modtime(path_temp, modtime, index) < 0)
2964 del_action_item("upload",p->path,g_pSyncList[index]->unfinished_list);
3136 char *reduce_memory(char *URL, int index, int flag)
3141 ret = my_malloc(strlen(URL) + strlen(smb_config.multrule[index]->server_root_path) + 1);
3145 sprintf(ret, "%s%s", smb_config.multrule[index]->server_root_path, URL);
3151 // p = p + strlen(smb_config.multrule[index]->server_root_path);
3156 if(!strcmp(p,smb_config.multrule[index]->server_root_path))
3162 p = p + strlen(smb_config.multrule[index]->server_root_path);
3174 int getCloudInfo(char *URL, int index)
3179 SMB_init(index);
3202 char *shorturl = reduce_memory(URL, index, 0);
3234 char *longurl = reduce_memory(FolderTmp->href, index, 1);
3254 Browse *browseFolder(char *URL, int index)
3281 status = getCloudInfo(URL, index);
3316 int browse_to_tree(char *parenthref, Server_TreeNode *node, int index)
3339 br = browseFolder(parenthref, index);
3377 char *longurl = reduce_memory(de_foldercurrent->href, index, 1);
3378 if(browse_to_tree(longurl, tempnode, index) == -1)
3391 int write_log(int status, char *message, char *filename, int index)
3415 //fprintf(fp,"STATUS:%d\nMESSAGE:%s\nTOTAL_SPACE:%lld\nUSED_SPACE:%lld\nRULENUM:%d\n",status,message,0,0,index);
3419 DEBUG("Status:%d\tERR_MSG:%s\tRule:%d\n",status,message,index);
3424 fprintf(fp,"STATUS:%d\nMOUNT_PATH:%s\nFILENAME:%s\nTOTAL_SPACE:0\nUSED_SPACE:0\nRULENUM:%d\n", status, filename, filename, index);
3425 printf("Status:%d\tDownloading:%s\tRule:%d\n", status, filename, index);
3430 fprintf(fp,"STATUS:%d\nMOUNT_PATH:%s\nFILENAME:%s\nTOTAL_SPACE:0\nUSED_SPACE:0\nRULENUM:%d\n", status, filename, filename, index);
3431 printf("Status:%d\tUploading:%s\tRule:%d\n", status, filename, index);
3439 fprintf(fp,"STATUS:%d\nTOTAL_SPACE:0\nUSED_SPACE:0\nRULENUM:%d\n", status, index);
3540 time_t Getmodtime(char *url, int index)
3542 SMB_init(index);
3548 int ChangeFile_modtime(char *localfilepath, time_t modtime, int index)
3551 char *newpath_re = search_newpath(localfilepath, index);
3582 int wait_handle_socket(int index){
3585 if(g_pSyncList[index]->receve_socket)
3589 while(g_pSyncList[index]->receve_socket || local_sync)
3595 if(g_pSyncList[index]->have_local_socket)
3597 g_pSyncList[index]->have_local_socket = 0;
3598 g_pSyncList[index]->first_sync = 1;
3610 int initMyLocalFolder(Server_TreeNode *servertreenode,int index)
3629 folderlongurl = reduce_memory(init_foldercurrent->href, index, 1);
3631 filelongurl = reduce_memory(init_filecurrent->href, index, 1);
3634 char *createpath = serverpath_to_localpath(folderlongurl, index);
3641 if(wait_handle_socket(index))
3652 add_action_item("createfolder", createpath, g_pSyncList[index]->server_action_list);
3661 if(is_local_space_enough(init_filecurrent, index))
3663 char *createpath = serverpath_to_localpath(filelongurl, index);
3669 if(wait_handle_socket(index))
3676 add_action_item("createfile", createpath, g_pSyncList[index]->server_action_list);
3678 res = SMB_download(filelongurl, index);
3682 time_t modtime = Getmodtime(filelongurl, index);
3683 if(ChangeFile_modtime(createpath, modtime, index))
3697 write_log(S_ERROR,"local space is not enough!","",index);
3698 add_action_item("download", filelongurl, g_pSyncList[index]->unfinished_list);
3707 res = initMyLocalFolder(servertreenode->Child, index);
3715 res = initMyLocalFolder(servertreenode->NextBrother, index);
3725 int sync_local_to_server_init(Local *perform_lo,int index)
3738 if(smb_config.multrule[index]->rule != 1)
3741 if(wait_handle_socket(index))
3745 add_action_item("createfile", localfiletmp->path, g_pSyncList[index]->server_action_list);
3746 ret = SMB_upload(localfiletmp->path, index);
3750 char *serverpath = localpath_to_serverpath(localfiletmp->path, index);
3751 time_t modtime = Getmodtime(serverpath, index);
3752 if(ChangeFile_modtime(localfiletmp->path, modtime, index))
3765 if(wait_handle_socket(index))
3769 add_action_item("createfile", localfiletmp->path, g_pSyncList[index]->download_only_socket_head);
3778 if(smb_config.multrule[index]->rule != 1)
3781 if(wait_handle_socket(index))
3785 add_action_item("createfolder", localfoldertmp->path, g_pSyncList[index]->server_action_list);
3786 ret = SMB_mkdir(localfoldertmp->path, index);
3796 if(wait_handle_socket(index))
3800 add_action_item("createfolder", localfoldertmp->path, g_pSyncList[index]->download_only_socket_head);
3809 int sync_local_to_server(char *path,int index)
3830 ret = is_server_have_localpath(path, g_pSyncList[index]->ServerRootNode->Child, index);
3835 res = sync_local_to_server_init(localnode, index);
3847 res = sync_local_to_server(localfoldertmp->path, index);
3867 int is_server_exist(char *localpath, int index)
3897 char *serverpath = localpath_to_serverpath(temp, index);
3900 SMB_init(index);
3931 int init_newer_file(char *localpath, int index){
3934 serverpath = localpath_to_serverpath(localpath, index);
3945 smb_modtime = Getmodtime(serverpath, index);
3956 ChangeFile_modtime(localpath, smb_modtime, index);
3971 int sync_newer_file(char *localpath, int index, CloudFile *reloldfiletmp)
3975 serverpath = localpath_to_serverpath(localpath, index);
3979 modtime1 = Getmodtime(serverpath, index);
4018 int the_same_name_compare(LocalFile *localfiletmp, CloudFile *filetmp, int index)
4025 char *longurl = reduce_memory(filetmp->href, index, 1);
4027 if(g_pSyncList[index]->init_completed == 1)//for server
4031 oldfiletmp = get_CloudFile_node(g_pSyncList[index]->OrigServerRootNode, longurl, 0x2,index);
4033 ret = sync_newer_file(localfiletmp->path, index, oldfiletmp);
4036 if(smb_config.multrule[index]->rule == 0)
4038 if(wait_handle_socket(index))
4044 add_action_item("createfile", localfiletmp->path, g_pSyncList[index]->server_action_list); //??
4045 ret = SMB_upload(localfiletmp->path,index);
4048 time_t modtime = Getmodtime(longurl, index);
4049 ChangeFile_modtime(localfiletmp->path, modtime, index);
4057 char *newname = change_same_name(localfiletmp->path, index, 1);
4067 item = get_action_item("download", longurl, g_pSyncList[index]->unfinished_list,index);
4069 if(is_local_space_enough(filetmp,index))
4071 if(wait_handle_socket(index))
4077 add_action_item("createfile", localfiletmp->path, g_pSyncList[index]->server_action_list);
4078 ret = SMB_download(longurl, index);
4081 time_t modtime = Getmodtime(longurl, index);
4082 ChangeFile_modtime(localfiletmp->path,modtime, index);
4087 del_action_item("download", longurl, g_pSyncList[index]->unfinished_list);
4093 write_log(S_ERROR, "local space is not enough!", "", index);
4095 add_action_item("download", longurl, g_pSyncList[index]->unfinished_list);
4102 item = get_action_item("download", longurl, g_pSyncList[index]->unfinished_list,index);
4104 if(is_local_space_enough(filetmp, index))
4106 if(wait_handle_socket(index))
4112 add_action_item("createfile",localfiletmp->path,g_pSyncList[index]->server_action_list);
4113 ret = SMB_download(longurl, index);
4116 time_t modtime = Getmodtime(longurl, index);
4117 ChangeFile_modtime(localfiletmp->path,modtime, index);
4119 del_action_item("download", longurl, g_pSyncList[index]->unfinished_list);
4125 write_log(S_ERROR, "local space is not enough!", "", index);
4127 add_action_item("download", longurl, g_pSyncList[index]->unfinished_list);
4132 char *newname = change_same_name(localfiletmp->path, index, 1);
4141 item = get_action_item("download", longurl, g_pSyncList[index]->unfinished_list, index);
4143 if(is_local_space_enough(filetmp, index))
4145 if(wait_handle_socket(index))
4151 add_action_item("createfile", localfiletmp->path, g_pSyncList[index]->server_action_list);
4152 ret = SMB_download(longurl, index);
4155 time_t modtime = Getmodtime(longurl, index);
4156 ChangeFile_modtime(localfiletmp->path,modtime, index);
4160 del_action_item("download", longurl, g_pSyncList[index]->unfinished_list);
4166 write_log(S_ERROR,"local space is not enough!","",index);
4168 add_action_item("download", longurl, g_pSyncList[index]->unfinished_list);
4175 ret = init_newer_file(localfiletmp->path, index);
4179 if(smb_config.multrule[index]->rule != 1)
4181 char *newlocalpath = change_same_name(localfiletmp->path, index, 0);
4184 SMB_remo(localfiletmp->path, newlocalpath, index);
4189 ret = SMB_upload(localfiletmp->path, index);
4193 time_t modtime = Getmodtime(longurl, index);
4194 if(ChangeFile_modtime(localfiletmp->path, modtime, index))
4203 char *newlocalpath = change_same_name(localfiletmp->path, index, 1);
4212 item = get_action_item("download", longurl, g_pSyncList[index]->unfinished_list, index);
4214 if(is_local_space_enough(filetmp, index))
4216 if(wait_handle_socket(index))
4222 add_action_item("createfile", localfiletmp->path, g_pSyncList[index]->server_action_list);
4223 ret = SMB_download(longurl, index);
4226 time_t modtime = Getmodtime(longurl, index);
4227 if(ChangeFile_modtime(localfiletmp->path, modtime, index))
4233 del_action_item("download", longurl, g_pSyncList[index]->unfinished_list);
4240 write_log(S_ERROR, "local space is not enough!", "", index);
4242 add_action_item("download", longurl, g_pSyncList[index]->unfinished_list);
4251 int is_smb_file_copying(char *serverpath, int index)
4255 SMB_init(index);
4267 int sync_server_to_local_init(Browse *perform_br, Local *perform_lo, int index)
4296 if(smb_config.multrule[index]->rule != 1)
4298 if(wait_handle_socket(index))
4303 add_action_item("createfile", localfiletmp->path, g_pSyncList[index]->server_action_list);
4304 ret = SMB_upload(localfiletmp->path, index);
4308 char *serverpath = localpath_to_serverpath(localfiletmp->path, index);
4309 time_t modtime = Getmodtime(serverpath, index);
4310 if(ChangeFile_modtime(localfiletmp->path, modtime,index))
4324 if(wait_handle_socket(index))
4328 add_action_item("createfile", localfiletmp->path, g_pSyncList[index]->download_only_socket_head);
4336 if(smb_config.multrule[index]->rule != 2)
4340 if(wait_handle_socket(index))
4345 filelongurl = reduce_memory(filetmp->href, index, 1);
4354 cp = is_smb_file_copying(filelongurl, index);
4357 if(is_local_space_enough(filetmp, index))
4359 char *localpath = serverpath_to_localpath(filelongurl, index);
4365 add_action_item("createfile", localpath, g_pSyncList[index]->server_action_list);
4367 ret = SMB_download(filelongurl, index);
4371 time_t modtime = Getmodtime(filelongurl, index);
4372 if(ChangeFile_modtime(localpath, modtime, index))
4386 write_log(S_ERROR, "local space is not enough!", "", index);
4387 add_action_item("download", filelongurl, g_pSyncList[index]->unfinished_list);
4401 char *localpathtmp = strstr(localfiletmp->path, smb_config.multrule[index]->client_root_path)
4402 + strlen(smb_config.multrule[index]->client_root_path);
4406 //serverpathtmp = strstr(filetmp->href, smb_config.multrule[index]->server_root_path)
4407 //+ strlen(smb_config.multrule[index]->server_root_path);
4420 if(smb_config.multrule[index]->rule != 1)
4422 if(wait_handle_socket(index))
4427 add_action_item("createfile", localfiletmp->path, g_pSyncList[index]->server_action_list);
4428 ret = SMB_upload(localfiletmp->path,index);
4431 char *serverpath = localpath_to_serverpath(localfiletmp->path, index);
4432 time_t modtime = Getmodtime(serverpath, index);
4433 if(ChangeFile_modtime(localfiletmp->path, modtime, index))
4446 if(wait_handle_socket(index))
4450 add_action_item("createfile", localfiletmp->path, g_pSyncList[index]->download_only_socket_head);
4455 if((ret = the_same_name_compare(localfiletmp, filetmp, index)) != 0)
4472 //serverpathtmp = strstr(filetmp->href, smb_config.multrule[index]->server_root_path)
4473 //+ strlen(smb_config.multrule[index]->server_root_path);
4478 localpathtmp = strstr(localfiletmp->path, smb_config.multrule[index]->client_root_path)
4479 + strlen(smb_config.multrule[index]->client_root_path);
4491 filelongurl = reduce_memory(filetmp->href, index, 1);
4493 if(smb_config.multrule[index]->rule != 2)
4502 cp = is_smb_file_copying(filelongurl, index);
4505 if(is_local_space_enough(filetmp, index))
4507 char *localpath = serverpath_to_localpath(filelongurl, index);
4514 if(wait_handle_socket(index))
4520 add_action_item("createfile", localpath, g_pSyncList[index]->server_action_list);
4521 ret = SMB_download(filelongurl, index);
4525 time_t modtime = Getmodtime(filelongurl, index);
4526 if(ChangeFile_modtime(localpath, modtime, index))
4541 write_log(S_ERROR, "local space is not enough!", "", index);
4542 add_action_item("download", filelongurl, g_pSyncList[index]->unfinished_list);
4557 if(wait_handle_socket(index))
4561 if(smb_config.multrule[index]->rule != 1)
4563 add_action_item("createfolder", localfoldertmp->path, g_pSyncList[index]->server_action_list);
4565 //SMB_mkdir(localfoldertmp->path, index);
4567 ret=SMB_mkdir(localfoldertmp->path, index);
4573 if(wait_handle_socket(index))
4577 add_action_item("createfolder", localfoldertmp->path, g_pSyncList[index]->download_only_socket_head);
4585 if(smb_config.multrule[index]->rule != 2)
4589 if(wait_handle_socket(index))
4594 folderlongurl = reduce_memory(foldertmp->href, index, 1);
4596 char *localpath = serverpath_to_localpath(folderlongurl, index);
4602 int exist = is_server_exist(localpath, index);
4607 add_action_item("createfolder", localpath, g_pSyncList[index]->server_action_list);
4624 localpathtmp = strstr(localfoldertmp->path, smb_config.multrule[index]->client_root_path)
4625 + strlen(smb_config.multrule[index]->client_root_path);
4629 //serverpathtmp = strstr(foldertmp->href, smb_config.multrule[index]->server_root_path)
4630 //+ strlen(smb_config.multrule[index]->server_root_path);
4645 if(smb_config.multrule[index]->rule != 1)
4647 if(wait_handle_socket(index))
4651 add_action_item("createfolder",localfoldertmp->path,g_pSyncList[index]->server_action_list);
4652 SMB_mkdir(localfoldertmp->path, index);
4656 if(wait_handle_socket(index))
4660 add_action_item("createfolder", localfoldertmp->path, g_pSyncList[index]->download_only_socket_head);
4673 //serverpathtmp = strstr(foldertmp->href, smb_config.multrule[index]->server_root_path)
4674 //+ strlen(smb_config.multrule[index]->server_root_path);
4678 localpathtmp = strstr(localfoldertmp->path, smb_config.multrule[index]->client_root_path)
4679 + strlen(smb_config.multrule[index]->client_root_path);
4691 if(smb_config.multrule[index]->rule != 2)
4693 if(wait_handle_socket(index))
4698 folderlongurl = reduce_memory(foldertmp->href, index, 1);
4700 char *localpath = serverpath_to_localpath(folderlongurl, index);
4704 int exist = is_server_exist(localpath, index);
4709 add_action_item("createfolder", localpath, g_pSyncList[index]->server_action_list);
4871 int sync_server_to_local(Server_TreeNode *treenode, int (*sync_fuc)(Browse*, Local*, int), int index)
4886 char *localpath = serverpath_to_localpath(treenode->parenthref, index);
4900 ret = sync_fuc(treenode->browse, localnode, index);
4913 ret = sync_server_to_local(treenode->Child, sync_fuc, index);
4923 ret = sync_server_to_local(treenode->NextBrother, sync_fuc, index);