aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/nogaim.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/nogaim.c')
-rw-r--r--protocols/nogaim.c89
1 files changed, 58 insertions, 31 deletions
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 474b91b2..4966a76f 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -54,6 +54,7 @@ static int remove_chat_buddy_silent( struct conversation *b, char *handle );
GSList *connections;
+#ifdef WITH_PLUGINS
gboolean load_plugin(char *path)
{
void (*init_function) (void);
@@ -75,6 +76,34 @@ gboolean load_plugin(char *path)
return TRUE;
}
+void load_plugins(void)
+{
+ GDir *dir;
+ GError *error = NULL;
+
+ dir = g_dir_open(PLUGINDIR, 0, &error);
+
+ if (dir) {
+ const gchar *entry;
+ char *path;
+
+ while ((entry = g_dir_read_name(dir))) {
+ path = g_build_filename(PLUGINDIR, entry, NULL);
+ if(!path) {
+ log_message(LOGLVL_WARNING, "Can't build path for %s\n", entry);
+ continue;
+ }
+
+ load_plugin(path);
+
+ g_free(path);
+ }
+
+ g_dir_close(dir);
+ }
+}
+#endif
+
/* nogaim.c */
GList *protocols = NULL;
@@ -100,49 +129,30 @@ struct prpl *find_protocol(const char *name)
/* nogaim.c */
void nogaim_init()
{
- GDir *dir;
- GError *error = NULL;
+ extern void msn_init();
+ extern void oscar_init();
+ extern void byahoo_init();
+ extern void jabber_init();
#ifdef WITH_MSN
- extern void msn_init();
msn_init();
#endif
#ifdef WITH_OSCAR
- extern void oscar_init();
oscar_init();
#endif
#ifdef WITH_YAHOO
- extern void byahoo_init();
byahoo_init();
#endif
#ifdef WITH_JABBER
- extern void jabber_init();
jabber_init();
#endif
- dir = g_dir_open(PLUGINDIR, 0, &error);
-
- if (dir) {
- const gchar *entry;
- char *path;
-
- while ((entry = g_dir_read_name(dir))) {
- path = g_build_filename(PLUGINDIR, entry, NULL);
- if(!path) {
- log_message(LOGLVL_WARNING, "Can't build path for %s\n", entry);
- continue;
- }
-
- load_plugin(path);
-
- g_free(path);
- }
-
- g_dir_close(dir);
- }
+#ifdef WITH_PLUGINS
+ load_plugins();
+#endif
}
GSList *get_connections() { return connections; }
@@ -441,7 +451,14 @@ void signoff( struct gaim_connection *gc )
void do_error_dialog( struct gaim_connection *gc, char *msg, char *title )
{
- serv_got_crap( gc, "Error: %s", msg );
+ if( msg && title )
+ serv_got_crap( gc, "Error: %s: %s", title, msg );
+ else if( msg )
+ serv_got_crap( gc, "Error: %s", msg );
+ else if( title )
+ serv_got_crap( gc, "Error: %s", title );
+ else
+ serv_got_crap( gc, "Error" );
}
void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont )
@@ -726,7 +743,7 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f
/* If there's a newline/space in this string, split up there,
looks a bit prettier. */
- if( ( nl = strrchr( msg, '\n' ) ) || ( nl = strchr( msg, ' ' ) ) )
+ if( ( nl = strrchr( msg, '\n' ) ) || ( nl = strrchr( msg, ' ' ) ) )
{
msg[425] = tmp;
tmp = *nl;
@@ -750,15 +767,25 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f
irc_msgfrom( irc, u->nick, msg );
}
-void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout )
+void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type )
{
user_t *u;
if( !set_getint( gc->irc, "typing_notice" ) )
return;
- if( ( u = user_findhandle( gc, handle ) ) )
- irc_msgfrom( gc->irc, u->nick, "\1TYPING 1\1" );
+ if( ( u = user_findhandle( gc, handle ) ) ) {
+ /* If type is:
+ * 0: user has stopped typing
+ * 1: user is actively typing
+ * 2: user has entered text, but is not actively typing
+ */
+ if (type == 0 || type == 1 || type == 2) {
+ char buf[256];
+ g_snprintf(buf, 256, "\1TYPING %d\1", type);
+ irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, buf );
+ }
+ }
}
void serv_got_chat_left( struct gaim_connection *gc, int id )