comparison src/deliver.c @ 344:0410c8aabac2

improved comments and debug messages
author markus schnalke <meillo@marmaro.de>
date Sat, 03 Sep 2011 18:32:37 +0200
parents 9149d893eb52
children 332999b1303f
comparison
equal deleted inserted replaced
343:9149d893eb52 344:0410c8aabac2
690 GList *route_node; 690 GList *route_node;
691 GList *route_list; 691 GList *route_list;
692 692
693 connect_name = online_query(); 693 connect_name = online_query();
694 if (!connect_name) { 694 if (!connect_name) {
695 DEBUG(5) debugf("online query returned false\n");
695 return FALSE; 696 return FALSE;
696 } 697 }
697 698
698 /* we are online! */ 699 /* we are online! */
699 logwrite(LOG_NOTICE, "detected online configuration %s\n", connect_name); 700 DEBUG(5) debugf("processing query_routes\n");
701 logwrite(LOG_NOTICE, "detected online configuration `%s'\n", connect_name);
700 702
701 rf_list = (GList *) table_find(conf.connect_routes, connect_name); 703 rf_list = (GList *) table_find(conf.connect_routes, connect_name);
702 if (!rf_list) { 704 if (!rf_list) {
703 logwrite(LOG_ALERT, "route list with name '%s' not found.\n", connect_name); 705 logwrite(LOG_ALERT, "route list with name '%s' not found.\n", connect_name);
704 return FALSE; 706 return FALSE;
708 if (!route_list) { 710 if (!route_list) {
709 logwrite(LOG_ALERT, "could not read route list '%s'\n", connect_name); 711 logwrite(LOG_ALERT, "could not read route list '%s'\n", connect_name);
710 return FALSE; 712 return FALSE;
711 } 713 }
712 714
713 /* TODO: Should we stop if the mail was delivered? Dig deeper! */
714 foreach(route_list, route_node) { 715 foreach(route_list, route_node) {
715 connect_route *route = (connect_route *) (route_node->data); 716 connect_route *route = (connect_route *) (route_node->data);
716 /* TODO: ok gets overwritten */ 717 /* TODO: ok gets overwritten */
717 ok = deliver_route_msg_list(route, msgout_list); 718 ok = deliver_route_msg_list(route, msgout_list);
718 } 719 }
719 destroy_route_list(route_list); 720 destroy_route_list(route_list);
721
720 return ok; 722 return ok;
721 } 723 }
722 724
723 /* 725 /*
724 This function searches in the list of rcpt addresses 726 This function searches in the list of rcpt addresses
848 ok = FALSE; 850 ok = FALSE;
849 } 851 }
850 destroy_msg_out_list(other_msgout_list); 852 destroy_msg_out_list(other_msgout_list);
851 } 853 }
852 854
855 /* unlock spool files */
853 foreach(msgout_list, msgout_node) { 856 foreach(msgout_list, msgout_node) {
854 msg_out *msgout = (msg_out *) (msgout_node->data); 857 msg_out *msgout = (msg_out *) (msgout_node->data);
855 if (spool_unlock(msgout->msg->uid)) { 858 if (spool_unlock(msgout->msg->uid)) {
856 DEBUG(5) debugf("spool_unlock(%s)\n", msgout->msg->uid); 859 DEBUG(5) debugf("spool_unlock(%s)\n", msgout->msg->uid);
857 } else { 860 } else {
858 DEBUG(5) debugf("spool_unlock(%s) failed.\n", msgout->msg->uid); 861 DEBUG(5) debugf("spool_unlock(%s) failed.\n", msgout->msg->uid);
859 } 862 }
860 863 }
861 }
862
863 destroy_msg_out_list(msgout_list); 864 destroy_msg_out_list(msgout_list);
864 865
865 return ok; 866 return ok;
866 } 867 }
867 868
868 /* 869 /*
869 deliver() is called when a message has just been received and should 870 deliver() is called when a message has just been received
870 be delivered immediately. 871 (mode_accept and smtp_in) and should be delivered immediately
872 (neither -odq nor do_queue). Only this one message will be tried to
873 deliver then.
871 */ 874 */
872 gboolean 875 gboolean
873 deliver(message * msg) 876 deliver(message * msg)
874 { 877 {
875 gboolean ok; 878 gboolean ok;