@@ -54,6 +54,7 @@ char pop_user[USERNAMELENGTH];
5454char pop_pass[PASSWORDLENGTH]; // maybe need the path here too?
5555char pop_path[MAXPATHLENGTH];
5656bool pop_logged_in;
57+ POPListing popList;
5758
5859// ----------------Mail Events Processing
5960
@@ -90,15 +91,14 @@ void pop_respond(int client_sockfd, char* request, UserDictionary users) {
9091 char param[10 ];
9192 get_args;
9293 copy_args (pa,pb,param);
93- POPListing popList;
9494 int success = getList (pop_path, popList);
9595 if (success == FUNCTION_SUCCESS) {
9696 if ((atoi (param)>0 ) && (atoi (param)-1 <popList.POPEntry .size ())) {
9797 if (popList.POPEntry [atoi (param)-1 ].deleted ) {
9898 send_data (client_sockfd, format (" %s\r\n " ,format (responses[ERR],
9999 format (popmessages[4 ],atoi (param)).c_str ()).c_str ()).c_str ());
100100 } else {
101- popList.POPEntry [atoi (param)-1 ].deleted = true ; // mark as deleted
101+ popList.POPEntry [atoi (param)-1 ].deleted = YES ; // mark as deleted
102102 send_data (client_sockfd, format (" %s\r\n " ,format (responses[OK],
103103 format (popmessages[5 ],atoi (param)).c_str ()).c_str ()).c_str ());
104104 }
@@ -112,7 +112,6 @@ void pop_respond(int client_sockfd, char* request, UserDictionary users) {
112112 char param[10 ];
113113 get_args;
114114 copy_args (pa,pb,param);
115- POPListing popList;
116115 int success = getList (pop_path, popList);
117116 if (success == FUNCTION_SUCCESS) {
118117 if (atoi (param)>0 ) {
@@ -136,12 +135,15 @@ void pop_respond(int client_sockfd, char* request, UserDictionary users) {
136135 } else if ((strncmp (request, " NOOP" , 4 ) == 0 ) && pop_logged_in) {
137136 send_empty_ok;
138137 } else if (strncmp (request, " QUIT" , 4 ) == 0 ) {
139- POPListing popList;
140138 int success = getList (pop_path, popList);
141139 if (success == FUNCTION_SUCCESS) {
142140 for (int i=0 ; i<popList.POPEntry .size (); i++) {
143- if (popList.POPEntry [i].deleted ) {
144- remove (popList.POPEntry [i].messagePath ); // delete all messages tagged for deletion
141+ cout << " checking " << i << endl;
142+ if (popList.POPEntry [i].deleted == YES) {
143+ create_log_entry (APPNAME, format (" POP Deleting: %s" , popList.POPEntry [i].messagePath ));
144+ if (remove (popList.POPEntry [i].messagePath ) != FUNCTION_SUCCESS) { // delete all messages tagged for deletion
145+ create_log_entry (APPNAME, format (" POP **Error** Deleting: %s" , popList.POPEntry [i].messagePath ));
146+ }
145147 }
146148 }
147149 }
@@ -153,7 +155,6 @@ void pop_respond(int client_sockfd, char* request, UserDictionary users) {
153155 char param[10 ];
154156 get_args;
155157 copy_args (pa,pb,param);
156- POPListing popList;
157158 int success = getList (pop_path, popList);
158159 if (success == FUNCTION_SUCCESS) {
159160 if ((atoi (param)>0 ) && (atoi (param)-1 <popList.POPEntry .size ())) {
@@ -173,7 +174,6 @@ void pop_respond(int client_sockfd, char* request, UserDictionary users) {
173174 send_err_message;
174175 }
175176 } else if ((strncmp (request, " RSET" , 4 ) == 0 ) && pop_logged_in) {
176- POPListing popList;
177177 int success = getList (pop_path, popList);
178178 if (success == FUNCTION_SUCCESS) {
179179 for (int i=0 ; i<popList.POPEntry .size (); i++) {
@@ -186,7 +186,6 @@ void pop_respond(int client_sockfd, char* request, UserDictionary users) {
186186 send_err_message;
187187 }
188188 } else if ((strncmp (request, " STAT" , 4 ) == 0 ) && pop_logged_in) { // don't include deleted messages
189- POPListing popList;
190189 int success = getList (pop_path, popList);
191190 if (success == FUNCTION_SUCCESS) {
192191 sprintf (result," %s %lu %lu\r\n " ,format (responses[OK]," " ).c_str (),popList.POPEntry .size (),popList.totalSize );
@@ -210,7 +209,6 @@ void pop_respond(int client_sockfd, char* request, UserDictionary users) {
210209 } else {
211210 send_err_message;
212211 }
213- POPListing popList;
214212 int success = getList (pop_path, popList);
215213 if ((success == FUNCTION_SUCCESS) && ((atoi (lines_co)>0 ) && (atoi (lines_co)<200 ))) {
216214 if ((atoi (message_no)>0 ) && (atoi (message_no)-1 <popList.POPEntry .size ())) {
@@ -254,7 +252,6 @@ void pop_respond(int client_sockfd, char* request, UserDictionary users) {
254252 char param[10 ];
255253 get_args;
256254 copy_args (pa,pb,param);
257- POPListing popList;
258255 int success = getList (pop_path, popList);
259256 if (success == FUNCTION_SUCCESS) { // don't show deleted messages
260257 if (atoi (param)>0 ) {
0 commit comments