@@ -712,13 +712,7 @@ int xmpp_stanza_set_text_with_size(xmpp_stanza_t *stanza,
712
712
*/
713
713
char * xmpp_stanza_get_id (xmpp_stanza_t * const stanza )
714
714
{
715
- if (stanza -> type != XMPP_STANZA_TAG )
716
- return NULL ;
717
-
718
- if (!stanza -> attributes )
719
- return NULL ;
720
-
721
- return (char * )hash_get (stanza -> attributes , "id" );
715
+ return xmpp_stanza_get_attribute (stanza , "id" );
722
716
}
723
717
724
718
/** Get the namespace attribute of the stanza object.
@@ -733,13 +727,7 @@ char *xmpp_stanza_get_id(xmpp_stanza_t * const stanza)
733
727
*/
734
728
char * xmpp_stanza_get_ns (xmpp_stanza_t * const stanza )
735
729
{
736
- if (stanza -> type != XMPP_STANZA_TAG )
737
- return NULL ;
738
-
739
- if (!stanza -> attributes )
740
- return NULL ;
741
-
742
- return (char * )hash_get (stanza -> attributes , "xmlns" );
730
+ return xmpp_stanza_get_attribute (stanza , "xmlns" );
743
731
}
744
732
745
733
/** Get the 'type' attribute of the stanza object.
@@ -754,13 +742,7 @@ char *xmpp_stanza_get_ns(xmpp_stanza_t * const stanza)
754
742
*/
755
743
char * xmpp_stanza_get_type (xmpp_stanza_t * const stanza )
756
744
{
757
- if (stanza -> type != XMPP_STANZA_TAG )
758
- return NULL ;
759
-
760
- if (!stanza -> attributes )
761
- return NULL ;
762
-
763
- return (char * )hash_get (stanza -> attributes , "type" );
745
+ return xmpp_stanza_get_attribute (stanza , "type" );
764
746
}
765
747
766
748
/** Get the 'to' attribute of the stanza object.
@@ -775,13 +757,7 @@ char *xmpp_stanza_get_type(xmpp_stanza_t * const stanza)
775
757
*/
776
758
char * xmpp_stanza_get_to (xmpp_stanza_t * const stanza )
777
759
{
778
- if (stanza -> type != XMPP_STANZA_TAG )
779
- return NULL ;
780
-
781
- if (!stanza -> attributes )
782
- return NULL ;
783
-
784
- return (char * )hash_get (stanza -> attributes , "to" );
760
+ return xmpp_stanza_get_attribute (stanza , "to" );
785
761
}
786
762
787
763
/** Get the 'from' attribute of the stanza object.
@@ -796,13 +772,7 @@ char *xmpp_stanza_get_to(xmpp_stanza_t * const stanza)
796
772
*/
797
773
char * xmpp_stanza_get_from (xmpp_stanza_t * const stanza )
798
774
{
799
- if (stanza -> type != XMPP_STANZA_TAG )
800
- return NULL ;
801
-
802
- if (!stanza -> attributes )
803
- return NULL ;
804
-
805
- return (char * )hash_get (stanza -> attributes , "from" );
775
+ return xmpp_stanza_get_attribute (stanza , "from" );
806
776
}
807
777
808
778
/** Get the first child of stanza with name.
0 commit comments