<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>iclient.cpp</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,7 +1,7 @@
 CC = g++
 CFLAGS = -I /usr/local/include/boost-1_39/
 
-OBJECTS = main.o /lib/libboost_system-xgcc40-mt.a
+OBJECTS = iclient.o main.o /lib/libboost_system-xgcc40-mt.a
 
 main : $(OBJECTS)
 	$(CC) $(CFLAGS) $(OBJECTS)  -o main
@@ -12,4 +12,4 @@ main : $(OBJECTS)
 
 clean:
 	rm *.o
-	rm main
\ No newline at end of file
+	rm main</diff>
      <filename>Makefile</filename>
    </modified>
    <modified>
      <diff>@@ -0,0 +1,3 @@
+iclient is an IRC client class written in C++ with boost
+
+Currently utilizes asio, will soon use Spirit as well</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -4,140 +4,7 @@
  * Jeff Aigner 2009
  */
 
-#include &lt;iostream&gt;
-#include &lt;istream&gt;
-#include &lt;ostream&gt;
-#include &lt;string&gt;
-#include &lt;boost/asio.hpp&gt;
-#include &lt;boost/bind.hpp&gt;
-
-using boost::asio::ip::tcp;
-
-
-
-class iclient
-{
-public:
-
-  iclient(boost::asio::io_service &amp;io_service,
-	  const std::string &amp;server, const std::string &amp;port)
-    : resolver_(io_service),
-      socket_(io_service)
-  {
-
-    // build the initial auth request
-    std::ostream request_stream(&amp;request_);
-    request_stream &lt;&lt; &quot;USER enbot enbot enbot :enbot\r\n&quot;;
-    request_stream &lt;&lt; &quot;NICK enbot\r\n&quot;;
-
-    // initiate host resolution
-    tcp::resolver::query query(server, port);
-    resolver_.async_resolve(query,
-			    boost::bind(&amp;iclient::handle_resolve, this,
-					boost::asio::placeholders::error,
-					boost::asio::placeholders::iterator));
-  }
-
-private:
-
-  // handle host resolution
-  void handle_resolve(const boost::system::error_code &amp;err,
-		      tcp::resolver::iterator endpoint_iterator)
-  {
-    if(!err) {
-      // initiate connect host iteration
-      tcp::endpoint endpoint = *endpoint_iterator;
-      socket_.async_connect(endpoint,
-			    boost::bind(&amp;iclient::handle_connect, this,
-					boost::asio::placeholders::error, ++endpoint_iterator));
-    } else {
-      std::cout &lt;&lt; &quot;Error: &quot; &lt;&lt; err.message() &lt;&lt; &quot;\n&quot;;
-    }
-  }
-
-
-
-  // Handle connection to the server
-  void handle_connect(const boost::system::error_code &amp;err,
-		      tcp::resolver::iterator endpoint_iterator)
-  {
-    if(!err) {
-      // Write the Auth request
-      boost::asio::async_write(socket_, request_,
-			       boost::bind(&amp;iclient::handle_write_request, this,
-					   boost::asio::placeholders::error));
-
-    } else if(endpoint_iterator != tcp::resolver::iterator()) {
-      // continue host iteration
-      socket_.close();
-      tcp::endpoint endpoint = *endpoint_iterator;
-      socket_.async_connect(endpoint,
-			    boost::bind(&amp;iclient::handle_connect, this,
-					boost::asio::placeholders::error, ++endpoint_iterator));
-    } else {
-      std::cout &lt;&lt; &quot;Error: &quot; &lt;&lt; err.message() &lt;&lt; &quot;\n&quot;;
-    }
-  }
-
-  // Handle line from server
-  void handle_read(const boost::system::error_code &amp;err)
-  {
-    if(!err) {
-      std::istream response_stream(&amp;response_);
-      std::string line;
-      
-      // process line
-      while(std::getline(response_stream, line)) {
-	std::cout &lt;&lt; line &lt;&lt; &quot;\n&quot;;
-
-	//  respond to server ping
-	if(line.substr(0, 4) == &quot;PING&quot;) {
-	  std::ostream request_string(&amp;request_);
-
-	  request_string &lt;&lt; &quot;PONG :&quot; &lt;&lt; line.substr(6, line.size()) &lt;&lt; &quot;\r\n&quot;;
-	  std::cout &lt;&lt; &quot;PONG!&quot; &lt;&lt; &quot;\n&quot;;
-
-	  boost::asio::async_write(socket_, request_,
-				   boost::bind(&amp;iclient::handle_write, this,
-					       boost::asio::placeholders::error));
-	}
-      }
-
-
-      // continue read cycle
-      boost::asio::async_read_until(socket_, response_, &quot;\r\n&quot;,
-			      boost::bind(&amp;iclient::handle_read, this,
-					  boost::asio::placeholders::error));
-    } else {
-      std::cout &lt;&lt; &quot;Error: &quot; &lt;&lt; err.message() &lt;&lt; &quot;\n&quot;;
-    }
-  }
-
-  // handle a write by simply checking for errors
-  void handle_write(const boost::system::error_code &amp;err) {
-    if(err) {
-      std::cout &lt;&lt; &quot;Error: &quot; &lt;&lt; err.message() &lt;&lt; &quot;\n&quot;;
-    }
-  }
-
-  // handle initial write request and start reading cycle
-  void handle_write_request(const boost::system::error_code &amp;err)
-  {
-    if(!err) {
-      boost::asio::async_read_until(socket_, response_, &quot;\r\n&quot;,
-				    boost::bind(&amp;iclient::handle_read, this,
-						boost::asio::placeholders::error));
-    } else {
-      std::cout &lt;&lt; &quot;Error: &quot; &lt;&lt; err.message() &lt;&lt; &quot;\n&quot;;
-    }
-  }
-
-  tcp::resolver resolver_;
-  tcp::socket socket_;
-  boost::asio::streambuf request_;
-  boost::asio::streambuf response_;
-
-};
+#include &quot;iclient.cpp&quot;
 
 int main(int argc, char *argv[]) {
   try {
@@ -154,3 +21,4 @@ int main(int argc, char *argv[]) {
   }
   return 0;
 }
+</diff>
      <filename>main.cpp</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>82053b4c9b3d854c2217114422aa3b5612f9a0db</id>
    </parent>
  </parents>
  <author>
    <name>Jeff Aigner</name>
    <email>enumeration@gmail.com</email>
  </author>
  <url>http://github.com/sheik/iclient/commit/09eaeb3e6d0c7c64dacf682a4caac4eea3a56990</url>
  <id>09eaeb3e6d0c7c64dacf682a4caac4eea3a56990</id>
  <committed-date>2009-06-29T00:40:42-07:00</committed-date>
  <authored-date>2009-06-29T00:40:42-07:00</authored-date>
  <message>Separated files into iclient.cpp and main.cpp, updated README</message>
  <tree>857baa7a2057b3cb896006325e21323ce9dc0aa8</tree>
  <committer>
    <name>Jeff Aigner</name>
    <email>enumeration@gmail.com</email>
  </committer>
</commit>
