- int status;
- int new_messages = -1;
- char *argv[10];
-
- status = ConnectionEstablish( wmnotify_infos.server_name, wmnotify_infos.port );
- if( status != EXIT_SUCCESS ) {
- return -1;
- }
-
- /* Sending username. */
- argv[0] = POP3_CMD_USERNAME;
- argv[1] = wmnotify_infos.username;
- status = POP3_SendCommand( 2, argv );
- if( status != EXIT_SUCCESS ) {
- goto pop3_close_connection;
- }
-
- /* Sending password. */
- argv[0] = POP3_CMD_PASSWORD;
- argv[1] = wmnotify_infos.password;
- status = POP3_SendCommand( 2, argv );
- if( status != EXIT_SUCCESS ) {
- goto pop3_close_connection;
- }
-
- /* Sending STAT command to inquiry about new messages. */
- argv[0] = POP3_CMD_STAT;
- status = POP3_SendCommand( 1, argv );
- if( status != EXIT_SUCCESS ) {
- goto pop3_close_connection;
- }
-
- /* Parsing STAT command. */
- new_messages = POP3_ParseStatCommand();
- if( new_messages < 0 ) {
- goto pop3_close_connection;
- }
-
- /* Sending QUIT command. */
- argv[0] = POP3_CMD_QUIT;
- status = POP3_SendCommand( 1, argv );
- if( status != EXIT_SUCCESS ) {
- new_messages = -1;
- goto pop3_close_connection;
- }
-
- pop3_close_connection:
- status = ConnectionTerminate();
- if( status != EXIT_SUCCESS ) {
- new_messages = -1;
- }
-
- return new_messages;
+ int status;
+ int new_messages = -1;
+ char *argv[10];
+
+ status =
+ ConnectionEstablish(wmnotify_infos.server_name,
+ wmnotify_infos.port);
+ if (status != EXIT_SUCCESS)
+ return -1;
+
+ /* Sending username. */
+ argv[0] = POP3_CMD_USERNAME;
+ argv[1] = wmnotify_infos.username;
+ status = POP3_SendCommand(2, argv);
+ if (status != EXIT_SUCCESS)
+ goto pop3_close_connection;
+
+ /* Sending password. */
+ argv[0] = POP3_CMD_PASSWORD;
+ argv[1] = wmnotify_infos.password;
+ status = POP3_SendCommand(2, argv);
+ if (status != EXIT_SUCCESS)
+ goto pop3_close_connection;
+
+ /* Sending STAT command to inquiry about new messages. */
+ argv[0] = POP3_CMD_STAT;
+ status = POP3_SendCommand(1, argv);
+ if (status != EXIT_SUCCESS)
+ goto pop3_close_connection;
+
+ /* Parsing STAT command. */
+ new_messages = POP3_ParseStatCommand();
+ if (new_messages < 0)
+ goto pop3_close_connection;
+
+ /* Sending QUIT command. */
+ argv[0] = POP3_CMD_QUIT;
+ status = POP3_SendCommand(1, argv);
+ if (status != EXIT_SUCCESS) {
+ new_messages = -1;
+ goto pop3_close_connection;
+ }
+
+pop3_close_connection:
+ status = ConnectionTerminate();
+ if (status != EXIT_SUCCESS)
+ new_messages = -1;
+
+ return new_messages;