This source file includes following definitions.
- BF_GUI_FtpPanel__Act_Connect_Thread
- BF_GUI_FtpPanel__Act_ChangeDir_Thread
- BF_GUI_FtpPanel__Act_ReloadDir_Thread
- BF_GUI_FtpPanel__Act_MakeDir_Thread
1 #include "Directory.h"
2
3 #include "BF_Dict.h"
4 #include "BF_Roster.h"
5 #include "BF_GUI_KeysMenu.h"
6 #include "BF_GUI_WinMain.h"
7
8 #include "BF_GUI_FtpPanel.h"
9 #include "BF_GUI_FtpPanel_Tasks.h"
10
11 int32
12 BF_GUI_FtpPanel__Act_Connect_Thread(void *data)
13 {
14 BF_GUI_FtpPanel *poPanel = (BF_GUI_FtpPanel*) data;
15
16 BF_GUI_FtpPanel_Bookmark oSite;
17 FtpClient *poClient=NULL;
18
19 {
20 BF_GUI_FtpPanel *poPanel;
21 poPanel = (BF_GUI_FtpPanel*) data;
22
23 BF_GUI_FtpPanel_NodeBookmark *poNode = (BF_GUI_FtpPanel_NodeBookmark*)poPanel->Nodes_Focus();
24 if(!poNode || !poNode->poBookmark) return -1;
25 poPanel->poBookmark = poNode->poBookmark;
26
27 oSite = *poNode->poBookmark;
28 poClient = poPanel->poClient;
29 }
30
31 if(poClient->connect(oSite.sHost.String(),oSite.sUserName.String()
32 ,oSite.sUserPassword.String()
33 )){
34 poClient->setPassive(oSite.bPassive);
35
36
37 string sPath;
38 if(!poClient->pwd(sPath)){
39 BMessage userPassMessage(BF_FTP_MSG_MESSAGE);
40 userPassMessage.AddString("message",BF_DictAt(BF_DICT_FTP_ERRGETNAME));
41 poWin->PostMessage(&userPassMessage,poPanel);
42 return -4;
43 }
44
45
46 BL_String sList;
47 poClient->ls(sList);
48
49 BMessage userPassMessage(BF_FTP_MSG_CONNECTED);
50 userPassMessage.AddString("list", sList.String());
51 userPassMessage.AddString("path", sPath.c_str());
52 poWin->PostMessage(&userPassMessage,poPanel);
53 }else{
54 BMessage userPassMessage(BF_FTP_MSG_MESSAGE);
55 userPassMessage.AddString("message", BF_DictAt(BF_DICT_FTP_ERRCONNECT));
56 poWin->PostMessage(&userPassMessage,poPanel);
57 return -4;
58 }
59
60
61 return 0;
62 }
63
64 int32
65 BF_GUI_FtpPanel__Act_ChangeDir_Thread(void *data)
66 {
67 ASSERT(data);
68 BF_GUI_FtpPanel *poPanel = (BF_GUI_FtpPanel*) data;
69 FtpClient *poClient = poPanel->poClient;
70 BF_Node *poNode = poPanel->Nodes_Focus();
71 if(!poNode) return -1;
72
73 if(poClient->cd(poNode->sName.String())){
74
75 BL_String sList;
76 poClient->ls(sList);
77
78
79 string sPath;
80 if(!poClient->pwd(sPath)){
81 BMessage userPassMessage(BF_FTP_MSG_MESSAGE);
82 userPassMessage.AddString("message", BF_DictAt(BF_DICT_FTP_ERRGETNAME));
83 poWin->PostMessage(&userPassMessage,poPanel);
84 return -4;
85 }
86
87 BMessage userPassMessage(BF_FTP_MSG_DIR_CHANGED);
88 userPassMessage.AddString("list", sList.String());
89 userPassMessage.AddString("path", sPath.c_str());
90 poWin->PostMessage(&userPassMessage,poPanel);
91 }else{
92 BMessage userPassMessage(BF_FTP_MSG_MESSAGE);
93 userPassMessage.AddString("message", "Can`t change dir");
94 poWin->PostMessage(&userPassMessage,poPanel);
95 }
96 return 0;
97 }
98
99 int32
100 BF_GUI_FtpPanel__Act_ReloadDir_Thread(void *data)
101 {
102 ASSERT(data);
103 BF_GUI_FtpPanel *poPanel = (BF_GUI_FtpPanel*) data;
104 FtpClient *poClient = poPanel->poClient;
105
106
107 BL_String sList;
108 poClient->ls(sList);
109
110 BMessage userPassMessage(BF_FTP_MSG_DIR_RELOAD);
111 userPassMessage.AddString("list", sList.String());
112 poWin->PostMessage(&userPassMessage,poPanel);
113 return 0;
114 }
115
116 int32
117 BF_GUI_FtpPanel__Act_MakeDir_Thread(void* data)
118 {
119 BF_GUI_FtpPanel *poPanel=NULL;
120 BL_String sName;
121 {
122 BMessage *poMessage = (BMessage*)data;
123 const char *pcName;
124 ASSERT(B_OK==poMessage->FindPointer("panel",(void**)&poPanel) && poPanel);
125 ASSERT(B_OK==poMessage->FindString("name",&pcName) && pcName);
126 sName = pcName;
127 }
128 FtpClient *poClient = poPanel->poClient;
129
130 if(poClient->makeDir(sName.String())){
131
132 }
133
134 BMessage userPassMessage(BF_FTP_MSG_DIR_RELOAD_START);
135 poWin->PostMessage(&userPassMessage,poPanel);
136
137 return 0;
138 }