summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostyantyn Ovechko <fastinetserver@gmail.com>2010-07-14 05:59:00 +0300
committerKostyantyn Ovechko <fastinetserver@gmail.com>2010-07-14 05:59:00 +0300
commitff1e371e2342379a2377789b1cda82a21c0eee1f (patch)
tree893558eda33611b927b03a8c476f4d0398f3b851 /tuiclient
parentAdd section [ui_server] to segget.conf file (diff)
downloadidfetch-ff1e371e2342379a2377789b1cda82a21c0eee1f.tar.gz
idfetch-ff1e371e2342379a2377789b1cda82a21c0eee1f.tar.bz2
idfetch-ff1e371e2342379a2377789b1cda82a21c0eee1f.zip
Add to segget.conf file section [provide_proxy_fetcher_to_others].
NOTE: Proxy-fetcher downloads distfiles requested by other segget daemons. File will be ignored if it's already downloaded. TO-DO: Proxy-fetcher needs to check if distfile is already in the download list. [provide_proxy_fetcher_to_others] PROVIDE_PROXY_FETCHER_IP Define an ip address segget will use to provide access for tuiclients. The parameter should be a string holding your host dotted IP address. Default: provide_proxy_fetcher_ip=127.0.0.1 PROVIDE_PROXY_FETCHER_PORT Define a port segget will use to provide access for tuiclients. The parameter should be an integer. Minimum value: 1 Maximum value: 65535 Default: provide_proxy_fetcher_port=9777
Diffstat (limited to 'tuiclient')
-rw-r--r--tuiclient/colors.cpp39
-rw-r--r--tuiclient/colors.h2
-rw-r--r--tuiclient/mainwindow.cpp9
-rw-r--r--tuiclient/mainwindow.h8
-rw-r--r--tuiclient/tuiclient.cpp9
5 files changed, 59 insertions, 8 deletions
diff --git a/tuiclient/colors.cpp b/tuiclient/colors.cpp
index 53871e5..3b5906e 100644
--- a/tuiclient/colors.cpp
+++ b/tuiclient/colors.cpp
@@ -29,7 +29,6 @@
void color_downloads(){
if(has_colors()){
start_color(); /* Start color */
- init_pair(1, COLOR_WHITE, COLOR_BLUE);
attron(COLOR_PAIR(1));
}
}
@@ -37,7 +36,6 @@ void color_downloads(){
void color_info(){
if(has_colors()){
start_color(); /* Start color */
- init_pair(2, COLOR_BLACK, COLOR_CYAN);
attron(COLOR_PAIR(2));
}
}
@@ -45,7 +43,42 @@ void color_info(){
void color_status(){
if(has_colors()){
start_color(); /* Start color */
- init_pair(3, COLOR_RED, COLOR_BLUE);
attron(COLOR_PAIR(3));
}
}
+
+void color_disconnected(){
+ if(has_colors()){
+ start_color(); /* Start color */
+ init_pair(1, COLOR_WHITE, COLOR_MAGENTA);
+ attron(COLOR_PAIR(1));
+ }
+}
+void color_init(){
+ if(has_colors()){
+ init_color(COLOR_MAGENTA, 300, 300, 300);
+ }
+}
+void colors_connected(){
+ if(has_colors()){
+ start_color(); /* Start color */
+ init_color(COLOR_BLUE, 300, 300, 300);
+ init_pair(1, COLOR_WHITE, COLOR_BLUE);
+ init_pair(2, COLOR_BLACK, COLOR_CYAN);
+ init_pair(3, COLOR_GREEN, COLOR_BLUE);
+// attrset(A_REVERSE);
+ attrset(A_DIM);
+ }
+}
+
+void colors_disconnected(){
+ if(has_colors()){
+ start_color(); /* Start color */
+ init_color(COLOR_BLUE, 400, 400, 400);
+ init_pair(1, COLOR_BLACK, COLOR_WHITE);
+ init_pair(2, COLOR_WHITE, COLOR_BLACK);
+ init_pair(3, COLOR_BLACK, COLOR_RED);
+// attrset(A_BOLD);
+// attrset(A_REVERSE);
+ }
+} \ No newline at end of file
diff --git a/tuiclient/colors.h b/tuiclient/colors.h
index 904c150..ba3c591 100644
--- a/tuiclient/colors.h
+++ b/tuiclient/colors.h
@@ -32,4 +32,6 @@
void color_downloads();
void color_info();
void color_status();
+void colors_connected();
+void colors_disconnected();
#endif \ No newline at end of file
diff --git a/tuiclient/mainwindow.cpp b/tuiclient/mainwindow.cpp
index b649832..5c2d205 100644
--- a/tuiclient/mainwindow.cpp
+++ b/tuiclient/mainwindow.cpp
@@ -26,6 +26,15 @@
#include "mainwindow.h"
+void Tmainwindow::connected(){
+ colors_connected();
+ set_status("[Connected]");
+}
+
+void Tmainwindow::disconnected(){
+ colors_disconnected();
+ set_status("[Connecting... Attempt:"+toString(attempt_num)+". Waiting for 1 sec, before next reconnect.]");
+}
void Tmainwindow::msg_status(){
msg_short(0,width/2-13,"tuiclient to segget daemon");
msg_short(0,width-20,"[Lines:"+toString(top_position+1)+"-"+toString(top_position+1+bottom_screenline_num)+"/"+toString(max_received_screenline_num+1)+"]");
diff --git a/tuiclient/mainwindow.h b/tuiclient/mainwindow.h
index 64184ca..5a81e2f 100644
--- a/tuiclient/mainwindow.h
+++ b/tuiclient/mainwindow.h
@@ -43,11 +43,15 @@ class Tmainwindow: public Twindow{
Thelp_window help_win;
bool exit_flag;
+ bool connected_status;
string screenlines[200];
string screen_info_lines[4];
+ ulong attempt_num;
Tmainwindow():
help_win(),
- exit_flag(FALSE)
+ exit_flag(FALSE),
+ connected_status(FALSE),
+ attempt_num(0)
{};
~Tmainwindow(){};
Tmainwindow(const Twindow &L); // copy constructor
@@ -57,5 +61,7 @@ class Tmainwindow: public Twindow{
void set_status(string str);
void set_line(int y, string msg_text);
void init();
+ void connected();
+ void disconnected();
};
#endif \ No newline at end of file
diff --git a/tuiclient/tuiclient.cpp b/tuiclient/tuiclient.cpp
index 6214964..6d74983 100644
--- a/tuiclient/tuiclient.cpp
+++ b/tuiclient/tuiclient.cpp
@@ -97,6 +97,8 @@ int main()
try{
//init curses
mainwindow.init();
+// init_color(COLOR_BLUE, 0, 0, 0);
+
}catch(...)
{
//error while init curses
@@ -127,8 +129,8 @@ int main()
//Create a socket for the client:
int result=-1;
- ulong attempt_num=1;
while (result==-1){
+ mainwindow.attempt_num++;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
//Name the socket, as agreed with the server:
@@ -139,14 +141,13 @@ int main()
//Connect your socket to the server’s socket:
result = connect(sockfd, (struct sockaddr *)&address, len);
if(result == -1) {
- mainwindow.set_status("[Connecting... Attempt:"+toString(attempt_num)+". Waiting for 1 sec, before next reconnect.]");
+ mainwindow.disconnected();
close(sockfd);
- attempt_num++;
sleep(1);
}
}
- mainwindow.set_status("[Connected]");
+ mainwindow.connected();
fd_set readfds, testfds;
FD_ZERO(&readfds);