| 822 |
822 |
| 823 /** Return the data of an element of a given name, as an integer. |
823 /** Return the data of an element of a given name, as an integer. |
| 824 * |
824 * |
| 825 * @param name Name of element. |
825 * @param name Name of element. |
| 826 * |
826 * |
| 827 * @return guint Numeric representation of data, or 0 if could not be converted. |
827 * @return guint Numeric representation of data, or 0 if could not be converted / not found. |
| 828 * |
828 * |
| 829 * Useful to obtain an element's data if you know it should be an integer, |
829 * Useful to obtain an element's data if you know it should be an integer, |
| 830 * even if it is not stored as an MSIM_TYPE_INTEGER. MSIM_TYPE_STRING will |
830 * even if it is not stored as an MSIM_TYPE_INTEGER. MSIM_TYPE_STRING will |
| 831 * be converted handled correctly, for example. |
831 * be converted handled correctly, for example. |
| 832 */ |
832 */ |
| 833 guint msim_msg_get_integer(MsimMessage *msg, const gchar *name) |
833 guint msim_msg_get_integer(MsimMessage *msg, const gchar *name) |
| 834 { |
834 { |
| 835 MsimMessageElement *elem; |
835 MsimMessageElement *elem; |
| 836 |
836 |
| 837 elem = msim_msg_get(msg, name); |
837 elem = msim_msg_get(msg, name); |
| |
838 |
| |
839 if (!elem) |
| |
840 return 0; |
| 838 |
841 |
| 839 switch (elem->type) |
842 switch (elem->type) |
| 840 { |
843 { |
| 841 case MSIM_TYPE_INTEGER: |
844 case MSIM_TYPE_INTEGER: |
| 842 return GPOINTER_TO_UINT(elem->data); |
845 return GPOINTER_TO_UINT(elem->data); |