summaryrefslogtreecommitdiff
authorandyq <andyq>2002-11-20 21:20:13 (UTC)
committer andyq <andyq>2002-11-20 21:20:13 (UTC)
commit726a5ade50098f208f9169176ff1ca099d8f0852 (patch) (unidiff)
treed97fc08e447dd156b2db5c8ee4a7b6f8a87acecb
parent19cec7475afb19b9a3096a5e01a87ae80690ce21 (diff)
downloadopie-726a5ade50098f208f9169176ff1ca099d8f0852.zip
opie-726a5ade50098f208f9169176ff1ca099d8f0852.tar.gz
opie-726a5ade50098f208f9169176ff1ca099d8f0852.tar.bz2
Now keeps proxy settings if set
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp51
-rw-r--r--noncore/settings/aqpkg/datamgr.h4
2 files changed, 51 insertions, 4 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index 1420242..e7fb75a 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -102,7 +102,6 @@ void DataManager :: loadServers()
102 char alias[20]; 102 char alias[20];
103 char url[100]; 103 char url[100];
104 104
105
106 // Looks a little wierd but read up to the r of src (throwing it away), 105 // Looks a little wierd but read up to the r of src (throwing it away),
107 // then read up to the next space and throw that away, the alias 106 // then read up to the next space and throw that away, the alias
108 // is next. 107 // is next.
@@ -110,9 +109,9 @@ void DataManager :: loadServers()
110 sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); 109 sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url );
111 Server s( alias, url ); 110 Server s( alias, url );
112 if ( lineStr.startsWith( "src" ) ) 111 if ( lineStr.startsWith( "src" ) )
113 s.setActive( true ); 112 s.setActive( true );
114 else 113 else
115 s.setActive( false ); 114 s.setActive( false );
116 115
117 serverList.push_back( s ); 116 serverList.push_back( s );
118 117
@@ -133,10 +132,29 @@ void DataManager :: loadServers()
133 132
134 destList.push_back( d ); 133 destList.push_back( d );
135 } 134 }
135 else if ( lineStr.startsWith( "option" ) )
136 {
137 char type[20];
138 char val[100];
139 sscanf( lineStr, "%*[^ ] %s %s", type, val );
140 if ( stricmp( type, "http_proxy" ) == 0 )
141 httpProxy = val;
142 if ( stricmp( type, "ftp_proxy" ) == 0 )
143 ftpProxy = val;
144 if ( stricmp( type, "proxy_username" ) == 0 )
145 proxyUsername = val;
146 if ( stricmp( type, "proxy_password" ) == 0 )
147 proxyPassword = val;
148 }
136 } 149 }
137 } 150 }
138 fclose( fp ); 151 fclose( fp );
139 152
153 cout << "httpProxy = " << httpProxy << endl;
154 cout << "ftpProxy = " << ftpProxy << endl;
155 cout << "proxyUsername = " << proxyUsername << endl;
156 cout << "proxyPassword = " << proxyPassword << endl;
157
140 reloadServerData( ); 158 reloadServerData( );
141} 159}
142 160
@@ -178,7 +196,7 @@ void DataManager :: writeOutIpkgConf()
178 out << "# URL that points to a directory containing a Familiar" << endl; 196 out << "# URL that points to a directory containing a Familiar" << endl;
179 out << "# Packages file, and <target-path> should be a directory" << endl; 197 out << "# Packages file, and <target-path> should be a directory" << endl;
180 out << "# that exists on the target system." << endl << endl; 198 out << "# that exists on the target system." << endl << endl;
181 199
182 // Write out servers 200 // Write out servers
183 vector<Server>::iterator it = serverList.begin(); 201 vector<Server>::iterator it = serverList.begin();
184 while ( it != serverList.end() ) 202 while ( it != serverList.end() )
@@ -207,6 +225,31 @@ void DataManager :: writeOutIpkgConf()
207 it2++; 225 it2++;
208 } 226 }
209 227
228 out << "# Proxy Support" << endl;
229 out << "#" << endl;
230
231 if ( httpProxy == "" )
232 out << "#option http_proxy http://proxy.tld:3128" << endl;
233 else
234 out << "option http_proxy " << httpProxy << endl;
235
236 if ( ftpProxy == "" )
237 out << "#option ftp_proxy http://proxy.tld:3128" << endl;
238 else
239 out << "option ftp_proxy " << ftpProxy << endl;
240 if ( proxyUsername == "" )
241 out << "#option proxy_username <username>" << endl;
242 else
243 out << "option proxy_username " << proxyUsername << endl;
244 if ( proxyPassword == "" )
245 out << "#option proxy_password <password>" << endl << endl;
246 else
247 out << "option proxy_password " << proxyPassword << endl<< endl;
248
249 out << "# Offline mode (for use in constructing flash images offline)" << endl;
250 out << "#option offline_root target" << endl;
251
252
210 out.close(); 253 out.close();
211} 254}
212 255
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h
index 3a64d92..14b0b2f 100644
--- a/noncore/settings/aqpkg/datamgr.h
+++ b/noncore/settings/aqpkg/datamgr.h
@@ -61,6 +61,10 @@ public:
61private: 61private:
62 static QString availableCategories; 62 static QString availableCategories;
63 QString activeServer; 63 QString activeServer;
64 QString httpProxy;
65 QString ftpProxy;
66 QString proxyUsername;
67 QString proxyPassword;
64 68
65 vector<Server> serverList; 69 vector<Server> serverList;
66 vector<Destination> destList; 70 vector<Destination> destList;