/* diversity-xmpp.h - DiversityXmpp * * Copyright 2008 OpenMoko, Inc. * Authored by Daniel Willmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _DIVERSITY_XMPP_H_ #define _DIVERSITY_XMPP_H_ #define G_DISABLE_CAST_CHECKS #include #include #include G_BEGIN_DECLS struct DiversityXmppUserInfo { gchar *jid; gchar *username; gchar *password; gchar *resource; }; struct DiversityXmppServerInfo { gchar *server; gint port; }; enum { XMPP_STATE_DISCONNCETED, XMPP_STATE_CONNECTION_FAILED, XMPP_STATE_AUTHENTICATION_FAILED, XMPP_STATE_CONNECTED }; enum { XMPP_PRESENCE_ONLINE, XMPP_PRESENCE_CHAT, XMPP_PRESENCE_AWAY, XMPP_PRESENCE_NA, XMPP_PRESENCE_DND, XMPP_PRESENCE_INVISIBLE, XMPP_PRESENCE_OFFLINE }; #define DIVERSITY_TYPE_XMPP (diversity_xmpp_get_type()) #define DIVERSITY_XMPP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), DIVERSITY_TYPE_XMPP, DiversityXmpp)) #define DIVERSITY_XMPP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), DIVERSITY_TYPE_XMPP, DiversityXmppClass)) #define DIVERSITY_IS_XMPP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), DIVERSITY_TYPE_XMPP)) #define DIVERSITY_IS_XMPP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), DIVERSITY_TYPE_XMPP)) #define DIVERSITY_XMPP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), DIVERSITY_TYPE_XMPP, DiversityXmppClass)) typedef struct _DiversityXmpp DiversityXmpp; typedef struct _DiversityXmppClass DiversityXmppClass; struct _DiversityXmpp { DiversityEquipment parent_object; }; struct _DiversityXmppClass { DiversityEquipmentClass parent_class; void (*state_changed)(DiversityXmpp *xmpp, gint state); void (*userinfo_needed)(DiversityXmpp *xmpp); void (*serverinfo_needed)(DiversityXmpp *xmpp); void (*geoloc_message_received)(DiversityXmpp *xmpp, gchar *jid, double lat, double lon, double alt, double err); }; GType diversity_xmpp_get_type(void) G_GNUC_CONST; DiversityXmpp *diversity_xmpp_new(const gchar *name, GError **error); void diversity_xmpp_userinfo_set(DiversityXmpp *xmpp, struct DiversityXmppUserInfo *userinfo); void diversity_xmpp_serverinfo_set(DiversityXmpp *xmpp, struct DiversityXmppServerInfo *serverinfo); void diversity_xmpp_presence_set(DiversityXmpp *xmpp, guint presence, gchar *statusmsg); int diversity_xmpp_connect(DiversityXmpp *xmpp); LmConnection *diversity_xmpp_get_connection(DiversityXmpp *xmpp); G_END_DECLS #endif /* _DIVERSITY_XMPP_H_ */