Permalink
Browse files

Don't repeat yourself, part 1

  • Loading branch information...
1 parent 1177afe commit adbaf486fda968f07df645e1a96c64844552654f @tadzik committed Mar 11, 2010
Showing with 21 additions and 51 deletions.
  1. +2 −10 src/config.c
  2. +2 −11 src/ui.c
  3. +2 −7 src/ui_roster.c
  4. +11 −18 src/xmpp.c
  5. +4 −5 src/xmpp.h
View
@@ -1,4 +1,5 @@
-#include "types.h"
+#include "config.h"
+
#include "xmpp.h"
#include "ui.h"
#include <glib.h>
@@ -16,25 +17,16 @@
* as various things of which user can decide */
/* functions */
-void action_call(int);
-const char *action_get(int);
-void config_cleanup(void);
-void config_init(void);
-void config_reload(void);
static int fun_print(lua_State *);
static int fun_sendmsg(lua_State *);
static int fun_sendstatus(lua_State *);
static int getbool(const gchar *);
static int getint(const gchar *);
static gchar *getstr(const gchar *);
-Option get_settings(Settings);
static void init_settings(void);
static void loadactions(void);
static void loadfile(void);
static void loadlib(void);
-void lua_msg_callback(const gchar *, const gchar *);
-void lua_post_connect(void);
-void lua_pres_callback(const gchar *, const gchar *, const gchar *);
/*************/
/* vars */
View
@@ -1,11 +1,12 @@
+#include "ui.h"
+
#include <gtk/gtk.h>
#include <stdarg.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include "xmpp.h"
#include "xmpp_roster.h"
-#include "types.h"
#include "ui_roster.h"
#include "config.h"
@@ -35,16 +36,6 @@ static void tab_entry_handler(GtkWidget *, gpointer);
static void tab_notify(Chattab *);
static void tab_switch_cb(GtkNotebook *, GtkNotebookPage *, guint, gpointer);
static void toggle_options(void);
-Chattab *ui_create_tab(const gchar *, const gchar *, gint);
-XmppStatus ui_get_status(void);
-const gchar *ui_get_status_msg(void);
-void ui_setup(int *, char ***);
-void ui_set_status(XmppStatus);
-void ui_set_status_msg(const gchar *);
-void ui_show_presence_query(const gchar *);
-void ui_show_subscribe_query(void);
-void ui_print(const gchar *msg, ...);
-void ui_tab_print_message(const gchar *, const gchar *);
/*************/
/* global variables */
View
@@ -1,8 +1,9 @@
+#include "ui_roster.h"
+
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
-#include "types.h"
#include "ui.h"
#include "xmpp.h"
#include "xmpp_roster.h"
@@ -47,12 +48,6 @@ static void row_clicked_cb(GtkTreeView *, GtkTreePath *,
GtkTreeViewColumn *, gpointer);
static gboolean tooltip_cb(GtkWidget *, gint, gint,
gboolean, GtkTooltip *, gpointer);
-void ui_roster_add(const gchar *, const gchar *, const gchar *);
-void ui_roster_cleanup(void);
-void ui_roster_offline(void);
-GtkWidget *ui_roster_setup(void);
-void ui_roster_toggle_offline(void);
-void ui_roster_update(const gchar *);
/************/
static gint
View
@@ -1,11 +1,12 @@
+#include "xmpp.h"
+
#include <loudmouth/loudmouth.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "ui.h"
#include "ui_roster.h"
#include "xmpp_roster.h"
-#include "types.h"
/* functions */
static void connect(void);
@@ -14,26 +15,18 @@ static void connection_disconnect_cb(LmConnection *, LmDisconnectReason,
gpointer);
static void connection_open_cb(LmConnection *, gboolean, gpointer);
static void disconnect(void);
-LmHandlerResult iq_handler(LmMessageHandler *, LmConnection *,
- LmMessage *, gpointer);
-LmHandlerResult mesg_handler(LmMessageHandler *, LmConnection *,
- LmMessage *, gpointer);
+static LmHandlerResult iq_handler(LmMessageHandler *, LmConnection *,
+ LmMessage *, gpointer);
+static LmHandlerResult mesg_handler(LmMessageHandler *, LmConnection *,
+ LmMessage *, gpointer);
static void parse_err_presence(LmMessage *);
static void parse_status_presence(LmMessage *);
static void parse_subscr_presence(LmMessage *);
-LmHandlerResult pres_handler(LmMessageHandler *, LmConnection *,
- LmMessage *, gpointer);
+static LmHandlerResult pres_handler(LmMessageHandler *, LmConnection *,
+ LmMessage *, gpointer);
static gboolean reconnect(void);
static LmSSLResponse ssl_cb(LmSSL *, LmSSLStatus, gpointer);
-void xmpp_cleanup(void);
-void xmpp_init(void);
-void xmpp_send_message(const char *, const char *);
-void xmpp_send_status(const gchar *, XmppStatus, const gchar *);
-void xmpp_subscribe(const gchar *, const gchar *, const gchar *);
-void xmpp_subscr_response(gchar *, gint);
static gchar *xmpp_status_to_str(XmppStatus);
-gchar *xmpp_status_readable(XmppStatus);
-void xmpp_roster_parsed_cb(void);
/*************/
/* global variables */
@@ -172,7 +165,7 @@ disconnect() {
}
} /* disconnect */
-LmHandlerResult
+static LmHandlerResult
iq_handler(LmMessageHandler *h, LmConnection *c, LmMessage *m,
gpointer userdata) {
LmMessageNode *query;
@@ -186,7 +179,7 @@ iq_handler(LmMessageHandler *h, LmConnection *c, LmMessage *m,
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
-LmHandlerResult
+static LmHandlerResult
mesg_handler(LmMessageHandler *h, LmConnection *c, LmMessage *m,
gpointer udata)
{
@@ -299,7 +292,7 @@ parse_subscr_presence(LmMessage *m)
ui_show_presence_query(jid);
} /* parse_subscr_presence */
-LmHandlerResult
+static LmHandlerResult
pres_handler(LmMessageHandler *h, LmConnection *c, LmMessage *m,
gpointer udata)
{
View
@@ -1,13 +1,12 @@
#ifndef XMPP_H
#define XMPP_H
-#include <gtk/gtk.h>
#include "types.h"
void xmpp_cleanup(void);
void xmpp_init(void);
-void xmpp_send_message(const gchar *, const gchar *);
-void xmpp_send_status(const gchar *, XmppStatus, const gchar *);
+void xmpp_send_message(const char *, const char *);
+void xmpp_send_status(const char *, XmppStatus, const char *);
gchar *xmpp_status_readable(XmppStatus);
-void xmpp_subscribe(const gchar *, const gchar *, const gchar *);
-void xmpp_subscr_response(gchar *, gint);
+void xmpp_subscribe(const char *, const char *, const char *);
+void xmpp_subscr_response(char *, int);
void xmpp_roster_parsed_cb(void);
#endif

0 comments on commit adbaf48

Please sign in to comment.