Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/xmpp_iq.c @ 2347:db8de1b464d3
Reordered some lines of code for clarity
author | franky |
---|---|
date | Sat, 18 May 2019 20:41:52 +0200 |
parents | def5f64c253d |
children | fef9f1a7d2aa |
comparison
equal
deleted
inserted
replaced
2346:7921c8d671c8 | 2347:db8de1b464d3 |
---|---|
737 send_iq_error(c, m, XMPP_ERROR_SERVICE_UNAVAILABLE); | 737 send_iq_error(c, m, XMPP_ERROR_SERVICE_UNAVAILABLE); |
738 return LM_HANDLER_RESULT_REMOVE_MESSAGE; | 738 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
739 } | 739 } |
740 | 740 |
741 r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_RESULT); | 741 r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_RESULT); |
742 | |
743 query = lm_message_node_add_child(r->node, "query", NULL); | 742 query = lm_message_node_add_child(r->node, "query", NULL); |
744 lm_message_node_set_attribute(query, "xmlns", NS_VERSION); | 743 lm_message_node_set_attribute(query, "xmlns", NS_VERSION); |
745 | 744 |
746 lm_message_node_add_child(query, "name", PACKAGE_NAME); | 745 lm_message_node_add_child(query, "name", PACKAGE_NAME); |
747 | 746 |
776 LmMessageNode *query; | 775 LmMessageNode *query; |
777 char *buf, *utf8_buf; | 776 char *buf, *utf8_buf; |
778 time_t now_t; | 777 time_t now_t; |
779 struct tm *now; | 778 struct tm *now; |
780 | 779 |
781 time(&now_t); | |
782 | |
783 if (!settings_opt_get_int("iq_hide_requests")) { | 780 if (!settings_opt_get_int("iq_hide_requests")) { |
784 scr_LogPrint(LPRINT_LOGNORM, "Received an IQ time request from <%s>", | 781 scr_LogPrint(LPRINT_LOGNORM, "Received an IQ time request from <%s>", |
785 lm_message_get_from(m)); | 782 lm_message_get_from(m)); |
786 } | 783 } |
787 | 784 |
794 | 791 |
795 r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_RESULT); | 792 r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_RESULT); |
796 query = lm_message_node_add_child(r->node, "query", NULL); | 793 query = lm_message_node_add_child(r->node, "query", NULL); |
797 lm_message_node_set_attribute(query, "xmlns", NS_TIME); | 794 lm_message_node_set_attribute(query, "xmlns", NS_TIME); |
798 | 795 |
796 time(&now_t); | |
799 now = gmtime(&now_t); | 797 now = gmtime(&now_t); |
800 | 798 |
801 strftime(buf, 512, "%Y%m%dT%T", now); | 799 strftime(buf, 512, "%Y%m%dT%T", now); |
802 lm_message_node_add_child(query, "utc", buf); | 800 lm_message_node_add_child(query, "utc", buf); |
803 | 801 |
831 time_t now_t; | 829 time_t now_t; |
832 struct tm *now; | 830 struct tm *now; |
833 char const *sign; | 831 char const *sign; |
834 int diff = 0; | 832 int diff = 0; |
835 | 833 |
836 time(&now_t); | |
837 | |
838 if (!settings_opt_get_int("iq_hide_requests")) { | 834 if (!settings_opt_get_int("iq_hide_requests")) { |
839 scr_LogPrint(LPRINT_LOGNORM, "Received an IQ time request from <%s>", | 835 scr_LogPrint(LPRINT_LOGNORM, "Received an IQ time request from <%s>", |
840 lm_message_get_from(m)); | 836 lm_message_get_from(m)); |
841 } | 837 } |
842 | 838 |
849 | 845 |
850 r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_RESULT); | 846 r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_RESULT); |
851 query = lm_message_node_add_child(r->node, "time", NULL); | 847 query = lm_message_node_add_child(r->node, "time", NULL); |
852 lm_message_node_set_attribute(query, "xmlns", NS_XMPP_TIME); | 848 lm_message_node_set_attribute(query, "xmlns", NS_XMPP_TIME); |
853 | 849 |
850 time(&now_t); | |
854 now = localtime(&now_t); | 851 now = localtime(&now_t); |
855 | 852 |
856 if (now->tm_isdst >= 0) { | 853 if (now->tm_isdst >= 0) { |
857 #if defined HAVE_TM_GMTOFF | 854 #if defined HAVE_TM_GMTOFF |
858 diff = now->tm_gmtoff; | 855 diff = now->tm_gmtoff; |