ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/WinXPFAQPoll/IMAPHandler.cpp
(Generate patch)

Comparing trunk/WinXPFAQPoll/IMAPHandler.cpp (file contents):
Revision 116 by douglas, 2003-04-01T00:43:13-08:00 vs.
Revision 125 by douglas, 2003-04-02T23:25:29-08:00

# Line 1 | Line 1
1 < /* ============================================================================
2 < * Douglas Thrift's Web Contact License
3 < *
4 < * Copyright (C) 2002, Douglas Thrift. All Rights Reserved.
5 < *
6 < * Redistribution and use in source and binary forms, with or without
7 < * modification, are permitted provided that the following conditions are met:
8 < *
9 < * 1. Redistributions of source code must retain the above copyright notice,
10 < *    this list of conditions and the following disclaimer.
11 < *
12 < * 2. Redistributions in binary form must reproduce the above copyright notice,
13 < *    this list of conditions and the following disclaimer in the documentation
14 < *    and/or other materials provided with the distribution.
15 < *
16 < * 3. The end-user documentation included with the redistribution, if any, must
17 < *    include the following acknowledgment:
18 < *
19 < *       "This product includes software developed by Douglas Thrift
20 < *       (http://computers.douglasthrift.net/webcontact.html)."
21 < *
22 < *    Alternately, this acknowledgment may appear in the software itself, if
23 < *    and wherever such third-party acknowledgments normally appear.
24 < *
25 < * 4. The names "Douglas Thrift" and "Douglas Thrift's Web Contact" must not be
26 < *    used to endorse or promote products derived from this software without
27 < *    specific prior written permission. For written permission, please visit
28 < *    http://www.douglasthrift.net/contact.html for contact information.
29 < *
30 < * 5. Products derived from this software may not be called "Douglas Thrift's
31 < *    Web Contact", nor may "Douglas Thrift's Web Contact" appear in their
32 < *    name, without prior written permission.
33 < *
34 < * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
35 < * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
36 < * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
37 < * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
38 < * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
39 < * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
40 < * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
41 < * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
42 < * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
43 < * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 < * ============================================================================
45 < */
46 < // Windows XP FAQ Poll
1 > // IMAP Handler
2   //
3   // Douglas Thrift
4   //
# Line 243 | Line 198 | string IMAPHandler::imap(const string& i
198                  }
199                  else
200                  {
201 <                        result += input + "\r\n";
201 >                        result += input + "\n";
202                  }
203          }
204  
# Line 274 | Line 229 | string IMAPHandler::imap(const string& i
229                  }
230                  else
231                  {
232 <                        result += input + "\r\n";
232 >                        result += input + "\n";
233                  }
234          }
235  
# Line 307 | Line 262 | string IMAPHandler::imap(const string& i
262                  }
263                  else
264                  {
265 <                        result += input + "\r\n";
265 >                        result += input + "\n";
266                  }
267          }
268  
# Line 316 | Line 271 | string IMAPHandler::imap(const string& i
271  
272   void IMAPHandler::putline(const string line)
273   {
274 <        if (debug) cerr << line << "\n";
274 >        istringstream lines(line);
275  
276 <        sprintf(buffer, "%s\r\n", line.c_str());
322 <
323 <        if (tls)
276 >        while (lines.good())
277          {
278 <                if (int code = SSL_write(ssl, buffer, strlen(buffer)) <= 0)
278 >                string line;
279 >
280 >                std::getline(lines, line);
281 >                if (debug) cerr << line << "\n";
282 >
283 >                sprintf(buffer, "%s\r\n", line.c_str());
284 >
285 > //              for (unsigned index = 0; index < strlen(buffer); index++)
286 > //              {
287 > //                      cout << "\"" << buffer[index] << "\" = " << int(buffer[index])
288 > //                              << "\n";
289 > //              }
290 >
291 >                if (tls)
292                  {
293 <                        error(program + ": SSL Write", code);
294 <                        exit(1);
293 >                        if (int code = SSL_write(ssl, buffer, strlen(buffer)) <= 0)
294 >                        {
295 >                                error(program + ": SSL Write", code);
296 >                                exit(1);
297 >                        }
298                  }
299 <        }
331 <        else
332 <        {
333 <                if (send(sock, buffer, strlen(buffer), 0) == SOCKET_ERROR)
299 >                else
300                  {
301 <                        error(program + ": Send");
302 <                        exit(1);
301 >                        if (send(sock, buffer, strlen(buffer), 0) == SOCKET_ERROR)
302 >                        {
303 >                                error(program + ": Send");
304 >                                exit(1);
305 >                        }
306                  }
307 +
308 +                lines.peek();
309          }
310   }
311  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines