changeset 1780:e4378fbab5d7

Major API cleanup - bump API to 4 Get rid of old CamelCase names in screen.h
author Mikael Berthe <mikael@lilotux.net>
date Sun, 14 Mar 2010 12:09:08 +0100
parents 2911c950dcd1
children 13e11d039f59
files mcabber/mcabber/api.h mcabber/mcabber/commands.c mcabber/mcabber/histolog.c mcabber/mcabber/hooks.c mcabber/mcabber/logprint.h mcabber/mcabber/main.c mcabber/mcabber/otr.c mcabber/mcabber/screen.c mcabber/mcabber/screen.h mcabber/mcabber/utils.c mcabber/mcabber/utils.h mcabber/mcabber/xmpp.c mcabber/mcabber/xmpp_iq.c mcabber/mcabber/xmpp_muc.c mcabber/modules/beep/beep.c
diffstat 15 files changed, 356 insertions(+), 342 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/api.h	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/api.h	Sun Mar 14 12:09:08 2010 +0100
@@ -3,8 +3,8 @@
 
 #include <mcabber/config.h> // For MCABBER_BRANCH
 
-#define MCABBER_API_VERSION 3
-#define MCABBER_API_MIN     3
+#define MCABBER_API_VERSION 4
+#define MCABBER_API_MIN     4
 
 extern const gchar *mcabber_branch;
 extern const guint mcabber_api_version;
--- a/mcabber/mcabber/commands.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/commands.c	Sun Mar 14 12:09:08 2010 +0100
@@ -498,7 +498,7 @@
       else {
         // Enter chat mode
         scr_set_chatmode(TRUE);
-        scr_ShowBuddyWindow();
+        scr_show_buddy_window();
       }
     }
     return 0;
@@ -686,7 +686,7 @@
     nbitems = strtol(nitems, NULL, 10);
 
   if (nbitems > 0)
-    scr_RosterUpDown(updown, nbitems);
+    scr_roster_up_down(updown, nbitems);
 }
 
 /* Commands callback functions */
@@ -709,17 +709,17 @@
   }
 
   if (!strcasecmp(subcmd, "top")) {
-    scr_RosterTop();
+    scr_roster_top();
     update_roster = TRUE;
   } else if (!strcasecmp(subcmd, "bottom")) {
-    scr_RosterBottom();
+    scr_roster_bottom();
     update_roster = TRUE;
   } else if (!strcasecmp(subcmd, "hide")) {
-    scr_RosterVisibility(0);
+    scr_roster_visibility(0);
   } else if (!strcasecmp(subcmd, "show")) {
-    scr_RosterVisibility(1);
+    scr_roster_visibility(1);
   } else if (!strcasecmp(subcmd, "toggle")) {
-    scr_RosterVisibility(-1);
+    scr_roster_visibility(-1);
   } else if (!strcasecmp(subcmd, "hide_offline")) {
     buddylist_set_hide_offline_buddies(TRUE);
     if (current_buddy)
@@ -734,7 +734,7 @@
     buddylist_build();
     update_roster = TRUE;
   } else if (!strcasecmp(subcmd, "display")) {
-    scr_RosterDisplay(arg);
+    scr_roster_display(arg);
   } else if (!strcasecmp(subcmd, "item_lock")) {
     roster_buddylock(arg, 1);
   } else if (!strcasecmp(subcmd, "item_unlock")) {
@@ -742,11 +742,11 @@
   } else if (!strcasecmp(subcmd, "item_toggle_lock")) {
     roster_buddylock(arg, -1);
   } else if (!strcasecmp(subcmd, "unread_first")) {
-    scr_RosterUnreadMessage(0);
+    scr_roster_unread_message(0);
   } else if (!strcasecmp(subcmd, "unread_next")) {
-    scr_RosterUnreadMessage(1);
+    scr_roster_unread_message(1);
   } else if (!strcasecmp(subcmd, "alternate")) {
-    scr_RosterJumpAlternate();
+    scr_roster_jump_alternate();
   } else if (!strncasecmp(subcmd, "search", 6)) {
     strip_arg_special_chars(arg);
     if (!arg || !*arg) {
@@ -754,16 +754,16 @@
       free_arg_lst(paramlst);
       return;
     }
-    scr_RosterSearch(arg);
+    scr_roster_search(arg);
     update_roster = TRUE;
   } else if (!strcasecmp(subcmd, "up")) {
     roster_updown(-1, arg);
   } else if (!strcasecmp(subcmd, "down")) {
     roster_updown(1, arg);
   } else if (!strcasecmp(subcmd, "group_prev")) {
-    scr_RosterPrevGroup();
+    scr_roster_prev_group();
   } else if (!strcasecmp(subcmd, "group_next")) {
-    scr_RosterNextGroup();
+    scr_roster_next_group();
   } else if (!strcasecmp(subcmd, "note")) {
     roster_note(arg);
   } else
@@ -795,14 +795,14 @@
     color = arglist[2];
 
     if (status && !strcmp(status, "clear")) { // Not a color command, clear all
-      scr_RosterClearColor();
+      scr_roster_clear_color();
       update_roster = TRUE;
     } else {
       if (!status || !*status || !wildcard || !*wildcard || !color || !*color) {
         scr_LogPrint(LPRINT_NORMAL, "Missing argument");
       } else {
-        update_roster = scr_RosterColor(status, wildcard, color)
-                        || update_roster;
+        update_roster = scr_roster_color(status, wildcard, color) ||
+                        update_roster;
       }
     }
     free_arg_lst(arglist);
@@ -822,13 +822,13 @@
           scr_LogPrint(LPRINT_NORMAL, "Not a JID");
         else {
           if (!mode || !*mode || !strcasecmp(mode, "on"))
-            scr_MucColor(muc, MC_ALL);
+            scr_muc_color(muc, MC_ALL);
           else if (!strcasecmp(mode, "preset"))
-            scr_MucColor(muc, MC_PRESET);
+            scr_muc_color(muc, MC_PRESET);
           else if (!strcasecmp(mode, "off"))
-            scr_MucColor(muc, MC_OFF);
+            scr_muc_color(muc, MC_OFF);
           else if (!strcmp(mode, "-"))
-            scr_MucColor(muc, MC_REMOVE);
+            scr_muc_color(muc, MC_REMOVE);
           else
             scr_LogPrint(LPRINT_NORMAL, "Unknown coloring mode");
         }
@@ -842,7 +842,7 @@
     if (!nick || !*nick || !color || !*color)
       scr_LogPrint(LPRINT_NORMAL, "Missing argument");
     else
-      scr_MucNickColor(nick, color);
+      scr_muc_nick_color(nick, color);
     free_arg_lst(arglist);
   } else
     scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!");
@@ -868,7 +868,7 @@
   // (esp. for FIFO or remote commands) or the behaviour could be
   // unexpected...
   if (!recipient)
-    scr_CheckAutoAway(TRUE);
+    scr_check_auto_away(TRUE);
 
   paramlst = split_arg(arg, 2, 1); // status, message
   status = *paramlst;
@@ -1067,11 +1067,11 @@
   }
 
   // Close the buffer
-  scr_BufferPurge(1, NULL);
+  scr_buffer_purge(1, NULL);
 
   scr_LogPrint(LPRINT_LOGNORM, "Removing <%s>...", bjid);
   xmpp_delbuddy(bjid);
-  scr_UpdateBuddyWindow();
+  scr_update_buddy_window();
 }
 
 static void do_group(char *arg)
@@ -1134,7 +1134,7 @@
   }
 
   if (group_state != group_unfold && leave_buddywindow)
-    scr_RosterPrevGroup();
+    scr_roster_prev_group();
 
   buddy_hide_group(group, group_state);
 
@@ -1182,7 +1182,7 @@
 
   if (!quiet) {
     // Jump to window, create one if needed
-    scr_RosterJumpJid(bare_jid);
+    scr_roster_jump_jid(bare_jid);
   }
 
   // Check if we're sending a message to a conference room
@@ -1268,7 +1268,7 @@
   LmMessageSubType msgtype = LM_MESSAGE_SUB_TYPE_NOT_SET;
 
   scr_set_chatmode(TRUE);
-  scr_ShowBuddyWindow();
+  scr_show_buddy_window();
 
   if (!current_buddy) {
     scr_LogPrint(LPRINT_NORMAL,
@@ -1366,7 +1366,7 @@
   }
 
   scr_set_chatmode(TRUE);
-  scr_ShowBuddyWindow();
+  scr_show_buddy_window();
 
   if (!strcasecmp(subcmd, "send_to")) {
     int err = FALSE;
@@ -1593,7 +1593,7 @@
     nblines = strtol(nlines, NULL, 10);
 
   if (nblines >= 0)
-    scr_BufferScrollUpDown(updown, nblines);
+    scr_buffer_scroll_up_down(updown, nblines);
 }
 
 static void buffer_search(int direction, char *arg)
@@ -1603,7 +1603,7 @@
     return;
   }
 
-  scr_BufferSearch(direction, arg);
+  scr_buffer_search(direction, arg);
 }
 
 static void buffer_date(char *date)
@@ -1619,7 +1619,7 @@
 
   t = from_iso8601(date, 0);
   if (t)
-    scr_BufferDate(t);
+    scr_buffer_date(t);
   else
     scr_LogPrint(LPRINT_NORMAL, "The date you specified is "
                  "not correctly formatted or invalid.");
@@ -1641,7 +1641,7 @@
     return;
   }
 
-  scr_BufferPercent(atoi((*arg1 ? arg1 : arg2)));
+  scr_buffer_percent(atoi((*arg1 ? arg1 : arg2)));
 }
 
 static void do_buffer(char *arg)
@@ -1670,23 +1670,23 @@
   }
 
   if (!strcasecmp(subcmd, "top")) {
-    scr_BufferTopBottom(-1);
+    scr_buffer_top_bottom(-1);
   } else if (!strcasecmp(subcmd, "bottom")) {
-    scr_BufferTopBottom(1);
+    scr_buffer_top_bottom(1);
   } else if (!strcasecmp(subcmd, "clear")) {
-    scr_BufferClear();
+    scr_buffer_clear();
   } else if (!strcasecmp(subcmd, "close")) {
-    scr_BufferPurge(1, arg);
+    scr_buffer_purge(1, arg);
   } else if (!strcasecmp(subcmd, "close_all")) {
-    scr_BufferPurgeAll(1);
+    scr_buffer_purge_all(1);
   } else if (!strcasecmp(subcmd, "purge")) {
-    scr_BufferPurge(0, arg);
+    scr_buffer_purge(0, arg);
   } else if (!strcasecmp(subcmd, "scroll_lock")) {
-    scr_BufferScrollLock(1);
+    scr_buffer_scroll_lock(1);
   } else if (!strcasecmp(subcmd, "scroll_unlock")) {
-    scr_BufferScrollLock(0);
+    scr_buffer_scroll_lock(0);
   } else if (!strcasecmp(subcmd, "scroll_toggle")) {
-    scr_BufferScrollLock(-1);
+    scr_buffer_scroll_lock(-1);
   } else if (!strcasecmp(subcmd, "up")) {
     buffer_updown(-1, arg);
   } else if (!strcasecmp(subcmd, "down")) {
@@ -1702,9 +1702,9 @@
   } else if (*subcmd == '%') {
     buffer_percent(subcmd+1, arg);
   } else if (!strcasecmp(subcmd, "save")) {
-    scr_BufferDump(arg);
+    scr_buffer_dump(arg);
   } else if (!strcasecmp(subcmd, "list")) {
-    scr_BufferList();
+    scr_buffer_list();
   } else {
     scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!");
   }
@@ -1743,7 +1743,7 @@
 
     // Enter chat mode
     scr_set_chatmode(TRUE);
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
 
     snprintf(buffer, 4095, "jid:  <%s>", bjid);
     scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0);
@@ -1878,7 +1878,7 @@
 
   // Enter chat mode
   scr_set_chatmode(TRUE);
-  scr_ShowBuddyWindow();
+  scr_show_buddy_window();
 
   bjid = buddy_getjid(bud);
 
@@ -2004,7 +2004,7 @@
     foreach_group_member(bud, &move_group_member, name_utf8);
     // Let's jump to the previous buddy, because this group name should
     // disappear when we receive the server answer.
-    scr_RosterUpDown(-1, 1);
+    scr_roster_up_down(-1, 1);
   } else {
     // Rename a single buddy
     guint del_name = 0;
@@ -2061,7 +2061,7 @@
     /* guint msgflag; */
 
     xmpp_updatebuddy(bjid, name, *group_utf8 ? group_utf8 : NULL);
-    scr_RosterUpDown(-1, 1);
+    scr_roster_up_down(-1, 1);
 
     /* We do not move the buddy right now because the server could reject
      * the request.  Let's wait for the server answer.
@@ -2687,7 +2687,7 @@
   }
   // Delete the room
   roster_del_user(buddy_getjid(bud));
-  scr_UpdateBuddyWindow();
+  scr_update_buddy_window();
   buddylist_build();
   update_roster = TRUE;
 }
@@ -2840,7 +2840,7 @@
   if (interactive) {
     // Enter chat mode
     scr_set_chatmode(TRUE);
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
   } else
     msg_flag |= HBB_PREFIX_NOFLAG;
 
--- a/mcabber/mcabber/histolog.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/histolog.c	Sun Mar 14 12:09:08 2010 +0100
@@ -198,7 +198,7 @@
   if (!fstat(fileno(fp), &bufstat)) {
     if (bufstat.st_size > 3145728) {
       scr_LogPrint(LPRINT_NORMAL, "Reading <%s> history file...", bjid);
-      scr_DoUpdate();
+      scr_do_update();
     }
   }
 
--- a/mcabber/mcabber/hooks.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/hooks.c	Sun Mar 14 12:09:08 2010 +0100
@@ -291,7 +291,7 @@
   if (settings_opt_get_int("beep_on_message")) {
     if ((!is_groupchat && !(message_flags & HBB_PREFIX_ERR)) ||
         (is_groupchat  && (message_flags & HBB_PREFIX_HLIGHT)))
-      scr_Beep();
+      scr_beep();
   }
 
   // We need to update the roster if the sender is unknown or
@@ -423,7 +423,7 @@
   if (st_in_buf == 2 ||
       (st_in_buf == 1 && (status == offline || oldstat == offline))) {
     // Write the status change in the buddy's buffer, only if it already exists
-    if (scr_BuddyBufferExists(bjid)) {
+    if (scr_buddy_buffer_exists(bjid)) {
       bn = g_strdup_printf("Buddy status has changed: [%c>%c] %s",
                            imstatus2char[oldstat], imstatus2char[status],
                            ((status_msg) ? status_msg : ""));
@@ -436,7 +436,7 @@
   roster_setstatus(bjid, rn, prio, status, status_msg, timestamp,
                    role_none, affil_none, NULL);
   buddylist_build();
-  scr_DrawRoster();
+  scr_draw_roster();
   hlog_write_status(bjid, timestamp, status, status_msg);
 
 #ifdef MODULES_ENABLE
--- a/mcabber/mcabber/logprint.h	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/logprint.h	Sun Mar 14 12:09:08 2010 +0100
@@ -15,7 +15,7 @@
 void scr_print_logwindow(const char *string);
 void scr_LogPrint(unsigned int flag, const char *fmt, ...) G_GNUC_PRINTF (2, 3);
 
-void scr_DoUpdate(void);
+void scr_do_update(void);
 
 #endif /* __MCABBER_LOGPRINT_H__ */
 
--- a/mcabber/mcabber/main.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/main.c	Sun Mar 14 12:09:08 2010 +0100
@@ -79,7 +79,7 @@
 {
   fifo_deinit();
   xmpp_disconnect();
-  scr_TerminateCurses();
+  scr_terminate_curses();
 
   // Restore term settings, if needed.
   if (backup_termios)
@@ -103,7 +103,7 @@
         if (pid > 0) {
           // exit status 2 -> beep
           if (WIFEXITED(status) && WEXITSTATUS(status) == 2) {
-            scr_Beep();
+            scr_beep();
           }
         }
       }
@@ -289,14 +289,14 @@
   if (terminate_ui) {
     return FALSE;
   }
-  scr_DoUpdate();
-  scr_Getch(&kcode);
+  scr_do_update();
+  scr_getch(&kcode);
 
   while (kcode.value != ERR) {
-    process_key(kcode);
-    scr_Getch(&kcode);
+    scr_process_key(kcode);
+    scr_getch(&kcode);
   }
-  scr_CheckAutoAway(FALSE);
+  scr_check_auto_away(FALSE);
 
   return TRUE;
 }
@@ -367,8 +367,8 @@
   modules_init();
 #endif
   /* Initialize charset */
-  scr_InitLocaleCharSet();
-  ut_InitDebug();
+  scr_init_locale_charset();
+  ut_init_debug();
   help_init();
 
   /* Parsing config file... */
@@ -404,8 +404,8 @@
 
   /* Initialize N-Curses */
   scr_LogPrint(LPRINT_DEBUG, "Initializing N-Curses...");
-  scr_InitCurses();
-  scr_DrawMainWindow(TRUE);
+  scr_init_curses();
+  scr_draw_main_window(TRUE);
 
   optval   = (settings_opt_get_int("logging") > 0);
   optval2  = (settings_opt_get_int("load_logs") > 0);
@@ -425,10 +425,10 @@
 
   optstring = settings_opt_get("roster_display_filter");
   if (optstring)
-    scr_RosterDisplay(optstring);
+    scr_roster_display(optstring);
   // Empty filter isn't allowed...
   if (!buddylist_get_filter())
-    scr_RosterDisplay("*");
+    scr_roster_display("*");
 
   chatstates_disabled = settings_opt_get_int("disable_chatstates");
 
@@ -442,7 +442,7 @@
 
   if (ret < 0) {
     scr_LogPrint(LPRINT_NORMAL, "No configuration file has been found.");
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
   } else {
     /* Connection */
     xmpp_connect();
@@ -464,8 +464,8 @@
       if (g_main_context_iteration(main_context, TRUE) == FALSE)
         keyboard_activity();
       if (update_roster)
-        scr_DrawRoster();
-      scr_DoUpdate();
+        scr_draw_roster();
+      scr_do_update();
     }
 
     g_source_destroy(mc_source);
@@ -473,7 +473,7 @@
   }
 
   evs_deinit();
-  scr_TerminateCurses();
+  scr_terminate_curses();
 #ifdef MODULES_ENABLE
   modules_deinit();
 #endif
--- a/mcabber/mcabber/otr.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/otr.c	Sun Mar 14 12:09:08 2010 +0100
@@ -611,7 +611,7 @@
   scr_LogPrint(LPRINT_LOGNORM,
                "Generating new OTR key for %s. This may take a while...",
                accountname);
-  scr_DoUpdate();
+  scr_do_update();
 
   e = otrl_privkey_generate(userstate, keyfile, accountname, protocol);
 
--- a/mcabber/mcabber/screen.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/screen.c	Sun Mar 14 12:09:08 2010 +0100
@@ -79,6 +79,10 @@
 static void scr_insert_text(const char*);
 static void scr_handle_tab(void);
 
+#if defined XEP0022 || defined XEP0085
+static gboolean scr_chatstates_timeout();
+#endif
+
 #if defined(WITH_ENCHANT) || defined(WITH_ASPELL)
 static void spellcheck(char *, char *);
 #endif
@@ -118,8 +122,7 @@
 static int chatmode;
 static int multimode;
 static char *multiline, *multimode_subj;
-int update_roster;
-int utf8_mode = 0;
+
 static bool Curses;
 static bool log_win_on_top;
 static bool roster_win_on_right;
@@ -141,7 +144,11 @@
 static bool   lock_chatstate;
 static time_t chatstate_timestamp;
 static guint  chatstate_timeout_id = 0;
-int chatstates_disabled;
+
+int update_roster;
+int utf8_mode;
+gboolean chatstates_disabled;
+gboolean Autoaway;
 
 #define MAX_KEYSEQ_LENGTH 8
 
@@ -158,15 +165,16 @@
 GSList *keyseqlist;
 static void add_keyseq(char *seqstr, guint mkeycode, gint value);
 
-void scr_WriteInWindow(const char *winId, const char *text, time_t timestamp,
-                       unsigned int prefix_flags, int force_show,
-                       unsigned mucnicklen, gpointer xep184);
-
-void scr_WriteMessage(const char *bjid, const char *text,
-                      time_t timestamp, guint prefix_flags,
-                      unsigned mucnicklen, gpointer xep184);
-
-inline void scr_UpdateBuddyWindow(void);
+static void scr_write_in_window(const char *winId, const char *text,
+                                time_t timestamp, unsigned int prefix_flags,
+                                int force_show, unsigned mucnicklen,
+                                gpointer xep184);
+
+static void scr_write_message(const char *bjid, const char *text,
+                              time_t timestamp, guint prefix_flags,
+                              unsigned mucnicklen, gpointer xep184);
+
+inline void scr_update_buddy_window(void);
 inline void scr_set_chatmode(int enable);
 
 #define SPELLBADCHAR 5
@@ -207,7 +215,7 @@
 
 /* Functions */
 
-static int FindColor(const char *name)
+static int find_color(const char *name)
 {
   int result;
 
@@ -248,7 +256,7 @@
     isbright = TRUE;
     color += 6;
   }
-  cl = FindColor(color);
+  cl = find_color(color);
   if (cl < 0)
     return NULL;
   ccol = g_new0(ccolor, 1);
@@ -258,7 +266,7 @@
 }
 
 static void ensure_string_htable(GHashTable **table,
-    GDestroyNotify value_destroy_func)
+                                 GDestroyNotify value_destroy_func)
 {
   if (*table) // Have it already
     return;
@@ -270,7 +278,7 @@
 // The MUC room does not need to be in the roster at that time
 // muc - the JID of room
 // type - the new type
-void scr_MucColor(const char *muc, muccoltype type)
+void scr_muc_color(const char *muc, muccoltype type)
 {
   gchar *muclow = g_utf8_strdown(muc, -1);
   if (type == MC_REMOVE) { // Remove it
@@ -295,13 +303,13 @@
   // Need to redraw?
   if (chatmode &&
       ((buddy_search_jid(muc) == current_buddy) || !strcmp(muc, "*")))
-    scr_UpdateBuddyWindow();
+    scr_update_buddy_window();
 }
 
 // Sets the color for nick in MUC
 // If color is "-", the color is marked as automaticly assigned and is
 // not used if the room is in the "preset" mode
-void scr_MucNickColor(const char *nick, const char *color)
+void scr_muc_nick_color(const char *nick, const char *color)
 {
   char *snick, *mnick;
   bool need_update = FALSE;
@@ -341,7 +349,7 @@
   }
   if (need_update && chatmode &&
       (buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_ROOM))
-    scr_UpdateBuddyWindow();
+    scr_update_buddy_window();
 }
 
 static void free_rostercolrule(rostercolor *col)
@@ -354,7 +362,7 @@
 }
 
 // Removes all roster coloring rules
-void scr_RosterClearColor(void)
+void scr_roster_clear_color(void)
 {
   GSList *head;
   for (head = rostercolrules; head; head = g_slist_next(head)) {
@@ -371,8 +379,8 @@
 // Returns weather it was successfull (therefore the roster should be
 // redrawed) or not. If it failed, for example because of invalid color
 // name, it also prints the error.
-bool scr_RosterColor(const char *status, const char *wildcard,
-                     const char *color)
+bool scr_roster_color(const char *status, const char *wildcard,
+                      const char *color)
 {
   GSList *head;
   GSList *found = NULL;
@@ -414,7 +422,7 @@
   }
 }
 
-static void ParseColors(void)
+static void parse_colors(void)
 {
   const char *colors[] = {
     "", "",
@@ -466,49 +474,49 @@
           init_pair(2, COLOR_WHITE, COLOR_BLACK);
           break;
       case COLOR_GENERAL:
-          init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE),
-                    FindColor(background));
+          init_pair(i+1, ((color) ? find_color(color) : COLOR_WHITE),
+                    find_color(background));
           break;
       case COLOR_MSGOUT:
-          init_pair(i+1, ((color) ? FindColor(color) : COLOR_CYAN),
-                    FindColor(background));
+          init_pair(i+1, ((color) ? find_color(color) : COLOR_CYAN),
+                    find_color(background));
           break;
       case COLOR_MSGHL:
-          init_pair(i+1, ((color) ? FindColor(color) : COLOR_YELLOW),
-                    FindColor(background));
+          init_pair(i+1, ((color) ? find_color(color) : COLOR_YELLOW),
+                    find_color(background));
           break;
       case COLOR_STATUS:
-          init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE),
-                    FindColor(backstatus));
+          init_pair(i+1, ((color) ? find_color(color) : COLOR_WHITE),
+                    find_color(backstatus));
           break;
       case COLOR_ROSTER:
-          init_pair(i+1, ((color) ? FindColor(color) : COLOR_GREEN),
-                    FindColor(background));
+          init_pair(i+1, ((color) ? find_color(color) : COLOR_GREEN),
+                    find_color(background));
           break;
       case COLOR_ROSTERSEL:
-          init_pair(i+1, ((color) ? FindColor(color) : COLOR_BLUE),
-                    FindColor(backselected));
+          init_pair(i+1, ((color) ? find_color(color) : COLOR_BLUE),
+                    find_color(backselected));
           break;
       case COLOR_ROSTERSELNMSG:
-          init_pair(i+1, ((color) ? FindColor(color) : COLOR_RED),
-                    FindColor(backselected));
+          init_pair(i+1, ((color) ? find_color(color) : COLOR_RED),
+                    find_color(backselected));
           break;
       case COLOR_ROSTERNMSG:
-          init_pair(i+1, ((color) ? FindColor(color) : COLOR_RED),
-                    FindColor(background));
+          init_pair(i+1, ((color) ? find_color(color) : COLOR_RED),
+                    find_color(background));
           break;
       case COLOR_INFO:
-          init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE),
-                    FindColor(background));
+          init_pair(i+1, ((color) ? find_color(color) : COLOR_WHITE),
+                    find_color(background));
           break;
       case COLOR_MSGIN:
-          init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE),
-                    FindColor(background));
+          init_pair(i+1, ((color) ? find_color(color) : COLOR_WHITE),
+                    find_color(background));
           break;
     }
   }
   for (i = COLOR_max; i < (COLOR_max + COLORS); i++)
-    init_pair(i, i-COLOR_max, FindColor(background));
+    init_pair(i, i-COLOR_max, find_color(background));
 
   if (!nickcols) {
     char *ncolors = g_strdup(settings_opt_get("nick_colors"));
@@ -724,7 +732,7 @@
   return FALSE;
 }
 
-void scr_InitLocaleCharSet(void)
+void scr_init_locale_charset(void)
 {
   setlocale(LC_ALL, "");
 #ifdef HAVE_LOCALCHARSET_H
@@ -735,12 +743,12 @@
   utf8_mode = (strcmp(LocaleCharSet, "UTF-8") == 0);
 }
 
-gboolean scr_CursesStatus(void)
+gboolean scr_curses_status(void)
 {
   return Curses;
 }
 
-void scr_InitCurses(void)
+void scr_init_curses(void)
 {
   /* Key sequences initialization */
   init_keycodes();
@@ -765,11 +773,11 @@
 #endif
   }
 
-  ParseColors();
+  parse_colors();
 
   getmaxyx(stdscr, maxY, maxX);
   Log_Win_Height = DEFAULT_LOG_WIN_HEIGHT;
-  // Note scr_DrawMainWindow() should be called early after scr_InitCurses()
+  // Note scr_draw_main_window() should be called early after scr_init_curses()
   // to update Log_Win_Height and set max{X,Y}
 
   inputLine[0] = 0;
@@ -789,7 +797,7 @@
   return;
 }
 
-void scr_TerminateCurses(void)
+void scr_terminate_curses(void)
 {
   if (!Curses) return;
   clear();
@@ -803,7 +811,7 @@
   return;
 }
 
-void scr_Beep(void)
+void scr_beep(void)
 {
   beep();
 }
@@ -919,8 +927,8 @@
     if (Curses) {
       wprintw(logWnd, "\n%s", buffer_locale);
       update_panels();
-      scr_WriteInWindow(NULL, buf_specialwindow, timestamp,
-                        HBB_PREFIX_SPECIAL, FALSE, 0, NULL);
+      scr_write_in_window(NULL, buf_specialwindow, timestamp,
+                          HBB_PREFIX_SPECIAL, FALSE, 0, NULL);
     } else {
       printf("%s\n", buffer_locale);
       // ncurses are not initialized yet, so we call directly hbuf routine
@@ -936,13 +944,13 @@
   if (flag & (LPRINT_LOG|LPRINT_DEBUG)) {
     strftime(strtimestamp, 23, "[%Y-%m-%d %H:%M:%S]", localtime(&timestamp));
     buffer = g_strdup_printf("%s %s\n", strtimestamp, btext);
-    ut_WriteLog(flag, buffer);
+    ut_write_log(flag, buffer);
     g_free(buffer);
   }
   g_free(btext);
 }
 
-static winbuf *scr_SearchWindow(const char *winId, int special)
+static winbuf *scr_search_window(const char *winId, int special)
 {
   char *id;
   winbuf *wbp;
@@ -960,9 +968,9 @@
   return wbp;
 }
 
-int scr_BuddyBufferExists(const char *bjid)
+int scr_buddy_buffer_exists(const char *bjid)
 {
-  return (scr_SearchWindow(bjid, FALSE) != NULL);
+  return (scr_search_window(bjid, FALSE) != NULL);
 }
 
 //  scr_new_buddy(title, dontshow)
@@ -991,7 +999,7 @@
     char *id;
     id = hlog_get_log_jid(title);
     if (id) {
-      winbuf *wb = scr_SearchWindow(id, FALSE);
+      winbuf *wb = scr_search_window(id, FALSE);
       if (!wb)
         wb = scr_new_buddy(id, TRUE);
       tmp->bd=wb->bd;
@@ -1072,9 +1080,9 @@
   }
 }
 
-//  scr_UpdateWindow()
+//  scr_update_window()
 // (Re-)Display the given chat window.
-static void scr_UpdateWindow(winbuf *win_entry)
+static void scr_update_window(winbuf *win_entry)
 {
   int n;
   guint prefixwidth;
@@ -1216,7 +1224,7 @@
   g_free(lines);
 }
 
-static winbuf *scr_CreateWindow(const char *winId, int special, int dont_show)
+static winbuf *scr_create_window(const char *winId, int special, int dont_show)
 {
   if (special) {
     if (!statusWindow) {
@@ -1229,17 +1237,17 @@
   }
 }
 
-//  scr_ShowWindow()
+//  scr_show_window()
 // Display the chat window with the given identifier.
 // "special" must be true if this is a special buffer window.
-static void scr_ShowWindow(const char *winId, int special)
+static void scr_show_window(const char *winId, int special)
 {
   winbuf *win_entry;
 
-  win_entry = scr_SearchWindow(winId, special);
+  win_entry = scr_search_window(winId, special);
 
   if (!win_entry) {
-    win_entry = scr_CreateWindow(winId, special, FALSE);
+    win_entry = scr_create_window(winId, special, FALSE);
   }
 
   top_panel(win_entry->panel);
@@ -1252,7 +1260,7 @@
   update_roster = TRUE;
 
   // Refresh the window
-  scr_UpdateWindow(win_entry);
+  scr_update_window(win_entry);
 
   // Finished :)
   update_panels();
@@ -1260,9 +1268,9 @@
   top_panel(inputPanel);
 }
 
-//  scr_ShowBuddyWindow()
+//  scr_show_buddy_window()
 // Display the chat window buffer for the current buddy.
-void scr_ShowBuddyWindow(void)
+void scr_show_buddy_window(void)
 {
   const gchar *bjid;
 
@@ -1271,7 +1279,7 @@
   } else {
     bjid = CURRENT_JID;
     if (buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL) {
-      scr_ShowWindow(buddy_getname(BUDDATA(current_buddy)), TRUE);
+      scr_show_window(buddy_getname(BUDDATA(current_buddy)), TRUE);
       return;
     }
   }
@@ -1283,17 +1291,17 @@
     return;
   }
 
-  scr_ShowWindow(bjid, FALSE);
+  scr_show_window(bjid, FALSE);
 }
 
-//  scr_UpdateBuddyWindow()
+//  scr_update_buddy_window()
 // (Re)Display the current window.
-// If chatmode is enabled, call scr_ShowBuddyWindow(),
+// If chatmode is enabled, call scr_show_buddy_window(),
 // else display the chat window.
-inline void scr_UpdateBuddyWindow(void)
+inline void scr_update_buddy_window(void)
 {
   if (chatmode) {
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
     return;
   }
 
@@ -1301,14 +1309,15 @@
   top_panel(inputPanel);
 }
 
-//  scr_WriteInWindow()
+//  scr_write_in_window()
 // Write some text in the winId window (this usually is a jid).
 // Use winId == NULL for the special status buffer.
 // Lines are splitted when they are too long to fit in the chat window.
 // If this window doesn't exist, it is created.
-void scr_WriteInWindow(const char *winId, const char *text, time_t timestamp,
-                       unsigned int prefix_flags, int force_show,
-                       unsigned mucnicklen, gpointer xep184)
+static void scr_write_in_window(const char *winId, const char *text,
+                                time_t timestamp, unsigned int prefix_flags,
+                                int force_show, unsigned mucnicklen,
+                                gpointer xep184)
 {
   winbuf *win_entry;
   char *text_locale;
@@ -1320,7 +1329,7 @@
 
   // Look for the window entry.
   special = (winId == NULL);
-  win_entry = scr_SearchWindow(winId, special);
+  win_entry = scr_search_window(winId, special);
 
   // Do we have to really show the window?
   if (!chatmode)
@@ -1330,7 +1339,7 @@
 
   // If the window entry doesn't exist yet, let's create it.
   if (!win_entry) {
-    win_entry = scr_CreateWindow(winId, special, dont_show);
+    win_entry = scr_create_window(winId, special, dont_show);
   }
 
   // The message must be displayed -> update top pointer
@@ -1379,7 +1388,7 @@
       setmsgflg = TRUE;
     // Show and refresh the window
     top_panel(win_entry->panel);
-    scr_UpdateWindow(win_entry);
+    scr_update_window(win_entry);
     top_panel(inputPanel);
     update_panels();
   } else if (!(prefix_flags & HBB_PREFIX_NOFLAG)) {
@@ -1393,9 +1402,11 @@
   }
 }
 
-//  scr_UpdateMainStatus()
+//  scr_update_main_status(forceupdate)
 // Redraw the main (bottom) status line.
-void scr_UpdateMainStatus(int forceupdate)
+// You can set forceupdate to FALSE in order to optimize screen refresh
+// if you call top_panel()/update_panels() later.
+void scr_update_main_status(int forceupdate)
 {
   char *sm = from_utf8(xmpp_getstatusmsg());
   const char *info = settings_opt_get("info");
@@ -1419,13 +1430,13 @@
   g_free(sm);
 }
 
-//  scr_DrawMainWindow()
+//  scr_draw_main_window()
 // Set fullinit to TRUE to also create panels.  Set it to FALSE for a resize.
 //
 // I think it could be improved a _lot_ but I'm really not an ncurses
 // expert... :-\   Mikael.
 //
-void scr_DrawMainWindow(unsigned int fullinit)
+void scr_draw_main_window(unsigned int fullinit)
 {
   int requested_size;
   gchar *ver, *message;
@@ -1499,7 +1510,7 @@
     mainstatusWnd = newwin(1, maxX, maxY-2, 0);
     inputWnd  = newwin(1, maxX, maxY-1, 0);
     if (!rosterWnd || !chatWnd || !logWnd || !inputWnd) {
-      scr_TerminateCurses();
+      scr_terminate_curses();
       fprintf(stderr, "Cannot create windows!\n");
       exit(EXIT_FAILURE);
     }
@@ -1638,13 +1649,13 @@
 
   // First, update the global variables
   getmaxyx(stdscr, maxY, maxX);
-  // scr_DrawMainWindow() will take care of maxY and Log_Win_Height
+  // scr_draw_main_window() will take care of maxY and Log_Win_Height
 
   // Make sure the cursor stays inside the window
   check_offset(0);
 
   // Resize windows and update panels
-  scr_DrawMainWindow(FALSE);
+  scr_draw_main_window(FALSE);
 
   // Resize all buddy windows
   dim.l = CHAT_WIN_HEIGHT;
@@ -1664,13 +1675,13 @@
 
   // Refresh current buddy window
   if (chatmode)
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
 }
 
-//  scr_UpdateChatStatus(forceupdate)
+//  scr_update_chat_status(forceupdate)
 // Redraw the buddy status bar.
 // Set forceupdate to TRUE if update_panels() must be called.
-void scr_UpdateChatStatus(int forceupdate)
+void scr_update_chat_status(int forceupdate)
 {
   unsigned short btype, isgrp, ismuc, isspe;
   const char *btypetext = "Unknown";
@@ -1681,7 +1692,7 @@
 
   // Usually we need to update the bottom status line too,
   // at least to refresh the pending message flag.
-  scr_UpdateMainStatus(FALSE);
+  scr_update_main_status(FALSE);
 
   // Clear the line
   werase(chatstatusWnd);
@@ -1724,7 +1735,7 @@
 
   if (chatmode && !isgrp) {
     winbuf *win_entry;
-    win_entry = scr_SearchWindow(buddy_getjid(BUDDATA(current_buddy)), isspe);
+    win_entry = scr_search_window(buddy_getjid(BUDDATA(current_buddy)), isspe);
     if (win_entry && win_entry->bd->lock)
       mvwprintw(chatstatusWnd, 0, 0, "*");
   }
@@ -1817,9 +1828,9 @@
     *p=*p+1;
 }
 
-//  scr_DrawRoster()
+//  scr_draw_roster()
 // Display the buddylist (not really the roster) on the screen
-void scr_DrawRoster(void)
+void scr_draw_roster(void)
 {
   static int offset = 0;
   char *name, *rline;
@@ -1843,7 +1854,7 @@
   if (!buddylist)
     offset = 0;
   else
-    scr_UpdateChatStatus(FALSE);
+    scr_update_chat_status(FALSE);
 
   // Cleanup of roster window
   werase(rosterWnd);
@@ -2024,12 +2035,12 @@
   curs_set(cursor_backup);
 }
 
-//  scr_RosterVisibility(status)
+//  scr_roster_visibility(status)
 // Set the roster visibility:
 // status=1   Show roster
 // status=0   Hide roster
 // status=-1  Toggle roster status
-void scr_RosterVisibility(int status)
+void scr_roster_visibility(int status)
 {
   int old_roster_status = roster_hidden;
 
@@ -2048,7 +2059,7 @@
 }
 
 #ifdef HAVE_GLIB_REGEX
-static inline void scr_LogUrls(const gchar *string)
+static inline void scr_log_urls(const gchar *string)
 {
   GMatchInfo *match_info;
 
@@ -2063,9 +2074,9 @@
 }
 #endif
 
-void scr_WriteMessage(const char *bjid, const char *text,
-                      time_t timestamp, guint prefix_flags,
-                      unsigned mucnicklen, gpointer xep184)
+static void scr_write_message(const char *bjid, const char *text,
+                              time_t timestamp, guint prefix_flags,
+                              unsigned mucnicklen, gpointer xep184)
 {
   char *xtext;
 
@@ -2073,8 +2084,8 @@
 
   xtext = ut_expand_tabs(text); // Expand tabs and filter out some chars
 
-  scr_WriteInWindow(bjid, xtext, timestamp, prefix_flags, FALSE, mucnicklen,
-                    xep184);
+  scr_write_in_window(bjid, xtext, timestamp, prefix_flags, FALSE, mucnicklen,
+                      xep184);
 
   if (xtext != (char*)text)
     g_free(xtext);
@@ -2091,9 +2102,9 @@
 
 #ifdef HAVE_GLIB_REGEX
   if (url_regex)
-    scr_LogUrls(text);
+    scr_log_urls(text);
 #endif
-  scr_WriteMessage(jidfrom, text, timestamp, prefix, mucnicklen, NULL);
+  scr_write_message(jidfrom, text, timestamp, prefix, mucnicklen, NULL);
 }
 
 void scr_WriteOutgoingMessage(const char *jidto, const char *text, guint prefix,
@@ -2103,21 +2114,21 @@
   roster_elt = roster_find(jidto, jidsearch,
                            ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_ROOM);
 
-  scr_WriteMessage(jidto, text,
-                   0, prefix|HBB_PREFIX_OUT|HBB_PREFIX_HLIGHT_OUT, 0, xep184);
+  scr_write_message(jidto, text,
+                    0, prefix|HBB_PREFIX_OUT|HBB_PREFIX_HLIGHT_OUT, 0, xep184);
 
   // Show jidto's buffer unless the buddy is not in the buddylist
   if (roster_elt && g_list_position(buddylist, roster_elt->data) != -1)
-    scr_ShowWindow(jidto, FALSE);
+    scr_show_window(jidto, FALSE);
 }
 
-void scr_RemoveReceiptFlag(const char *bjid, gpointer xep184)
+void scr_remove_receipt_flag(const char *bjid, gpointer xep184)
 {
-  winbuf *win_entry = scr_SearchWindow(bjid, FALSE);
+  winbuf *win_entry = scr_search_window(bjid, FALSE);
   if (win_entry) {
     hbuf_remove_receipt(win_entry->bd->hbuf, xep184);
     if (chatmode && (buddy_search_jid(bjid) == current_buddy))
-      scr_UpdateBuddyWindow();
+      scr_update_buddy_window();
   }
 }
 
@@ -2154,7 +2165,7 @@
 //  set_chatstate(state)
 // Set the current chat state (0=active, 1=composing, 2=paused)
 // If the chat state has changed, call xmpp_send_chatstate()
-static inline void set_chatstate(int state)
+static void set_chatstate(int state)
 {
 #if defined XEP0022 || defined XEP0085
   if (chatstates_disabled)
@@ -2169,7 +2180,7 @@
       if (chatstate == 1) {
         if (chatstate_timeout_id == 0)
           chatstate_timeout_id = g_timeout_add_seconds(1,
-                                                       scr_ChatStatesTimeout,
+                                                       scr_chatstates_timeout,
                                                        NULL);
         jep_state = ROSTER_EVENT_COMPOSING;
       }
@@ -2186,7 +2197,7 @@
 }
 
 #if defined XEP0022 || defined XEP0085
-gboolean scr_ChatStatesTimeout(void)
+static gboolean scr_chatstates_timeout(void)
 {
   time_t now;
   time(&now);
@@ -2223,7 +2234,7 @@
   return FALSE;
 }
 
-static void scr_ReinstallAutoAwayTimeout(void)
+static void scr_reinstall_autoaway_timeout(void)
 {
   unsigned int autoaway_timeout = settings_opt_get_int("autoaway");
   enum imstatus cur_st = xmpp_getstatus();
@@ -2238,13 +2249,13 @@
 }
 
 // Check if we should reset autoaway timeout source
-void scr_CheckAutoAway(int activity)
+void scr_check_auto_away(int activity)
 {
   if (Autoaway && activity) {
-    scr_ReinstallAutoAwayTimeout();
+    scr_reinstall_autoaway_timeout();
     set_autoaway(FALSE);
   } else if (activity || !autoaway_source)
-    scr_ReinstallAutoAwayTimeout();
+    scr_reinstall_autoaway_timeout();
 }
 
 //  set_current_buddy(newbuddy)
@@ -2280,28 +2291,28 @@
   update_roster = TRUE;
 }
 
-//  scr_RosterTop()
+//  scr_roster_top()
 // Go to the first buddy in the buddylist
-void scr_RosterTop(void)
+void scr_roster_top(void)
 {
   set_current_buddy(buddylist);
   if (chatmode)
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
 }
 
-//  scr_RosterBottom()
+//  scr_roster_bottom()
 // Go to the last buddy in the buddylist
-void scr_RosterBottom(void)
+void scr_roster_bottom(void)
 {
   set_current_buddy(g_list_last(buddylist));
   if (chatmode)
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
 }
 
-//  scr_RosterUpDown(updown, n)
+//  scr_roster_up_down(updown, n)
 // Go to the nth next buddy in the buddylist
 // (up if updown == -1, down if updown == 1)
-void scr_RosterUpDown(int updown, unsigned int n)
+void scr_roster_up_down(int updown, unsigned int n)
 {
   unsigned int i;
 
@@ -2313,12 +2324,12 @@
       set_current_buddy(g_list_next(current_buddy));
   }
   if (chatmode)
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
 }
 
-//  scr_RosterPrevGroup()
+//  scr_roster_prev_group()
 // Go to the previous group in the buddylist
-void scr_RosterPrevGroup(void)
+void scr_roster_prev_group(void)
 {
   GList *bud;
 
@@ -2329,15 +2340,15 @@
     if (buddy_gettype(BUDDATA(bud)) & ROSTER_TYPE_GROUP) {
       set_current_buddy(bud);
       if (chatmode)
-        scr_ShowBuddyWindow();
+        scr_show_buddy_window();
       break;
     }
   }
 }
 
-//  scr_RosterNextGroup()
+//  scr_roster_next_group()
 // Go to the next group in the buddylist
-void scr_RosterNextGroup(void)
+void scr_roster_next_group(void)
 {
   GList *bud;
 
@@ -2348,25 +2359,25 @@
     if (buddy_gettype(BUDDATA(bud)) & ROSTER_TYPE_GROUP) {
       set_current_buddy(bud);
       if (chatmode)
-        scr_ShowBuddyWindow();
+        scr_show_buddy_window();
       break;
     }
   }
 }
 
-//  scr_RosterSearch(str)
+//  scr_roster_search(str)
 // Look forward for a buddy with jid/name containing str.
-void scr_RosterSearch(char *str)
+void scr_roster_search(char *str)
 {
   set_current_buddy(buddy_search(str));
   if (chatmode)
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
 }
 
-//  scr_RosterJumpJid(bjid)
+//  scr_roster_jump_jid(bjid)
 // Jump to buddy bjid.
 // NOTE: With this function, the buddy is added to the roster if doesn't exist.
-void scr_RosterJumpJid(char *barejid)
+void scr_roster_jump_jid(char *barejid)
 {
   GSList *roster_elt;
   // Look for an existing buddy
@@ -2382,14 +2393,14 @@
   // Jump to the buddy
   set_current_buddy(buddy_search_jid(barejid));
   if (chatmode)
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
 }
 
-//  scr_RosterUnreadMessage(next)
+//  scr_roster_unread_message(next)
 // Go to a new message.  If next is not null, try to go to the next new
 // message.  If it is not possible or if next is NULL, go to the first new
 // message from unread_list.
-void scr_RosterUnreadMessage(int next)
+void scr_roster_unread_message(int next)
 {
   gpointer unread_ptr;
   gpointer refbuddata;
@@ -2416,26 +2427,26 @@
   nbuddy = g_list_find(buddylist, unread_ptr);
   if (nbuddy) {
     set_current_buddy(nbuddy);
-    if (chatmode) scr_ShowBuddyWindow();
+    if (chatmode) scr_show_buddy_window();
   } else
     scr_LogPrint(LPRINT_LOGNORM, "Error: nbuddy == NULL"); // should not happen
 }
 
-//  scr_RosterJumpAlternate()
+//  scr_roster_jump_alternate()
 // Try to jump to alternate (== previous) buddy
-void scr_RosterJumpAlternate(void)
+void scr_roster_jump_alternate(void)
 {
   if (!alternate_buddy || g_list_position(buddylist, alternate_buddy) == -1)
     return;
   set_current_buddy(alternate_buddy);
   if (chatmode)
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
 }
 
-//  scr_RosterDisplay(filter)
+//  scr_roster_display(filter)
 // Set the roster filter mask.  If filter is null/empty, the current
 // mask is displayed.
-void scr_RosterDisplay(const char *filter)
+void scr_roster_display(const char *filter)
 {
   guchar status;
   enum imstatus budstate;
@@ -2464,11 +2475,11 @@
   scr_LogPrint(LPRINT_NORMAL, "Roster status filter: %s", strfilter);
 }
 
-//  scr_BufferScrollUpDown()
+//  scr_buffer_scroll_up_down()
 // Scroll up/down the current buddy window,
 // - half a screen if nblines is 0,
 // - up if updown == -1, down if updown == 1
-void scr_BufferScrollUpDown(int updown, unsigned int nblines)
+void scr_buffer_scroll_up_down(int updown, unsigned int nblines)
 {
   winbuf *win_entry;
   int n, nbl;
@@ -2479,7 +2490,7 @@
   if (!current_buddy) return;
 
   isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL;
-  win_entry  = scr_SearchWindow(CURRENT_JID, isspe);
+  win_entry  = scr_search_window(CURRENT_JID, isspe);
   if (!win_entry) return;
 
   if (!nblines) {
@@ -2515,15 +2526,15 @@
   }
 
   // Refresh the window
-  scr_UpdateWindow(win_entry);
+  scr_update_window(win_entry);
 
   // Finished :)
   update_panels();
 }
 
-//  scr_BufferClear()
+//  scr_buffer_clear()
 // Clear the current buddy window (used for the /clear command)
-void scr_BufferClear(void)
+void scr_buffer_clear(void)
 {
   winbuf *win_entry;
   guint isspe;
@@ -2531,14 +2542,14 @@
   // Get win_entry
   if (!current_buddy) return;
   isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL;
-  win_entry = scr_SearchWindow(CURRENT_JID, isspe);
+  win_entry = scr_search_window(CURRENT_JID, isspe);
   if (!win_entry) return;
 
   win_entry->bd->cleared = TRUE;
   win_entry->bd->top = NULL;
 
   // Refresh the window
-  scr_UpdateWindow(win_entry);
+  scr_update_window(win_entry);
 
   // Finished :)
   update_panels();
@@ -2565,10 +2576,10 @@
   }
 }
 
-//  scr_BufferPurge(closebuf, jid)
+//  scr_buffer_purge(closebuf, jid)
 // Purge/Drop the current buddy buffer or jid's buffer if jid != NULL.
 // If closebuf is 1, close the buffer.
-void scr_BufferPurge(int closebuf, const char *jid)
+void scr_buffer_purge(int closebuf, const char *jid)
 {
   winbuf *win_entry;
   guint isspe;
@@ -2592,7 +2603,7 @@
     cjid = CURRENT_JID;
     isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL;
   }
-  win_entry = scr_SearchWindow(cjid, isspe);
+  win_entry = scr_search_window(cjid, isspe);
   if (!win_entry) return;
 
   if (!isspe) {
@@ -2620,13 +2631,16 @@
   update_roster = TRUE;
 
   // Refresh the window
-  scr_UpdateBuddyWindow();
+  scr_update_buddy_window();
 
   // Finished :)
   update_panels();
 }
 
-void scr_BufferPurgeAll(int closebuf)
+//  scr_buffer_purge_all(closebuf)
+// Purge all existing buffers.
+// If closebuf is 1, the buffers are closed.
+void scr_buffer_purge_all(int closebuf)
 {
   guint *p_closebuf;
   p_closebuf = g_new(guint, 1);
@@ -2641,18 +2655,18 @@
   }
 
   // Refresh the window
-  scr_UpdateBuddyWindow();
+  scr_update_buddy_window();
 
   // Finished :)
   update_panels();
 }
 
-//  scr_BufferScrollLock(lock)
+//  scr_buffer_scroll_lock(lock)
 // Lock/unlock the current buddy buffer
 // lock = 1 : lock
 // lock = 0 : unlock
 // lock = -1: toggle lock status
-void scr_BufferScrollLock(int lock)
+void scr_buffer_scroll_lock(int lock)
 {
   winbuf *win_entry;
   guint isspe;
@@ -2660,7 +2674,7 @@
   // Get win_entry
   if (!current_buddy) return;
   isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL;
-  win_entry = scr_SearchWindow(CURRENT_JID, isspe);
+  win_entry = scr_search_window(CURRENT_JID, isspe);
   if (!win_entry) return;
 
   if (lock == -1)
@@ -2675,25 +2689,25 @@
   }
 
   // If chatmode is disabled and we're at the bottom of the buffer,
-  // we need to set the "top" line, so we need to call scr_ShowBuddyWindow()
+  // we need to set the "top" line, so we need to call scr_show_buddy_window()
   // at least once.  (Maybe it will cause a double refresh...)
   if (!chatmode && !win_entry->bd->top) {
     chatmode = TRUE;
-    scr_ShowBuddyWindow();
+    scr_show_buddy_window();
     chatmode = FALSE;
   }
 
   // Refresh the window
-  scr_UpdateBuddyWindow();
+  scr_update_buddy_window();
 
   // Finished :)
   update_panels();
 }
 
-//  scr_BufferTopBottom()
+//  scr_buffer_top_bottom()
 // Jump to the head/tail of the current buddy window
 // (top if topbottom == -1, bottom topbottom == 1)
-void scr_BufferTopBottom(int topbottom)
+void scr_buffer_top_bottom(int topbottom)
 {
   winbuf *win_entry;
   guint isspe;
@@ -2701,7 +2715,7 @@
   // Get win_entry
   if (!current_buddy) return;
   isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL;
-  win_entry = scr_SearchWindow(CURRENT_JID, isspe);
+  win_entry = scr_search_window(CURRENT_JID, isspe);
   if (!win_entry) return;
 
   win_entry->bd->cleared = FALSE;
@@ -2711,16 +2725,16 @@
     win_entry->bd->top = g_list_first(win_entry->bd->hbuf);
 
   // Refresh the window
-  scr_UpdateWindow(win_entry);
+  scr_update_window(win_entry);
 
   // Finished :)
   update_panels();
 }
 
-//  scr_BufferSearch(direction, text)
+//  scr_buffer_search(direction, text)
 // Jump to the next line containing text
 // (backward search if direction == -1, forward if topbottom == 1)
-void scr_BufferSearch(int direction, const char *text)
+void scr_buffer_search(int direction, const char *text)
 {
   winbuf *win_entry;
   GList *current_line, *search_res;
@@ -2729,7 +2743,7 @@
   // Get win_entry
   if (!current_buddy) return;
   isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL;
-  win_entry = scr_SearchWindow(CURRENT_JID, isspe);
+  win_entry = scr_search_window(CURRENT_JID, isspe);
   if (!win_entry) return;
 
   if (win_entry->bd->top)
@@ -2744,7 +2758,7 @@
     win_entry->bd->top = search_res;
 
     // Refresh the window
-    scr_UpdateWindow(win_entry);
+    scr_update_window(win_entry);
 
     // Finished :)
     update_panels();
@@ -2752,9 +2766,9 @@
     scr_LogPrint(LPRINT_NORMAL, "Search string not found");
 }
 
-//  scr_BufferPercent(n)
+//  scr_buffer_percent(n)
 // Jump to the specified position in the buffer, in %
-void scr_BufferPercent(int pc)
+void scr_buffer_percent(int pc)
 {
   winbuf *win_entry;
   GList *search_res;
@@ -2763,7 +2777,7 @@
   // Get win_entry
   if (!current_buddy) return;
   isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL;
-  win_entry = scr_SearchWindow(CURRENT_JID, isspe);
+  win_entry = scr_search_window(CURRENT_JID, isspe);
   if (!win_entry) return;
 
   if (pc < 0 || pc > 100) {
@@ -2777,16 +2791,16 @@
   win_entry->bd->top = search_res;
 
   // Refresh the window
-  scr_UpdateWindow(win_entry);
+  scr_update_window(win_entry);
 
   // Finished :)
   update_panels();
 }
 
-//  scr_BufferDate(t)
+//  scr_buffer_date(t)
 // Jump to the first line after date t in the buffer
 // t is a date in seconds since `00:00:00 1970-01-01 UTC'
-void scr_BufferDate(time_t t)
+void scr_buffer_date(time_t t)
 {
   winbuf *win_entry;
   GList *search_res;
@@ -2795,7 +2809,7 @@
   // Get win_entry
   if (!current_buddy) return;
   isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL;
-  win_entry = scr_SearchWindow(CURRENT_JID, isspe);
+  win_entry = scr_search_window(CURRENT_JID, isspe);
   if (!win_entry) return;
 
   search_res = hbuf_jump_date(win_entry->bd->hbuf, t);
@@ -2804,13 +2818,15 @@
   win_entry->bd->top = search_res;
 
   // Refresh the window
-  scr_UpdateWindow(win_entry);
+  scr_update_window(win_entry);
 
   // Finished :)
   update_panels();
 }
 
-void scr_BufferDump(const char *file)
+//  scr_buffer_dump(filename)
+// Dump the current buffer content to the specified file.
+void scr_buffer_dump(const char *file)
 {
   char *extfname;
 
@@ -2844,7 +2860,7 @@
                g_list_length(head), hbuf_get_blocks_number(head));
 }
 
-void scr_BufferList(void)
+void scr_buffer_list(void)
 {
   scr_LogPrint(LPRINT_NORMAL, "Buffer list:");
   buffer_list("[status]", statusWindow, NULL);
@@ -2859,7 +2875,7 @@
 inline void scr_set_chatmode(int enable)
 {
   chatmode = enable;
-  scr_UpdateChatStatus(TRUE);
+  scr_update_chat_status(TRUE);
 }
 
 //  scr_get_chatmode()
@@ -2892,7 +2908,7 @@
     else
       current_id = buddy_getjid(BUDDATA(current_buddy));
     if (current_id) {
-      winbuf *win_entry = scr_SearchWindow(current_id, special);
+      winbuf *win_entry = scr_search_window(current_id, special);
       if (!win_entry) return;
       iscurrentlocked = win_entry->bd->lock;
     }
@@ -3249,7 +3265,7 @@
 // If down_history is true, load the next history line.
 int readline_accept_line(int down_history)
 {
-  scr_CheckAutoAway(TRUE);
+  scr_check_auto_away(TRUE);
   if (process_line(inputLine))
     return 255;
   // Add line to history
@@ -3300,22 +3316,22 @@
 
 void readline_refresh_screen(void)
 {
-  scr_CheckAutoAway(TRUE);
-  ParseColors();
+  scr_check_auto_away(TRUE);
+  parse_colors();
   scr_Resize();
   redrawwin(stdscr);
 }
 
 void readline_disable_chat_mode(guint show_roster)
 {
-  scr_CheckAutoAway(TRUE);
+  scr_check_auto_away(TRUE);
   currentWindow = NULL;
   chatmode = FALSE;
   if (current_buddy)
     buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
   if (show_roster)
-    scr_RosterVisibility(1);
-  scr_UpdateChatStatus(FALSE);
+    scr_roster_visibility(1);
+  scr_update_chat_status(FALSE);
   top_panel(chatPanel);
   top_panel(inputPanel);
   update_panels();
@@ -3781,7 +3797,7 @@
   return c;
 }
 
-void scr_Getch(keycode *kcode)
+void scr_getch(keycode *kcode)
 {
   keyseq *mks = NULL;
   int  ks[MAX_KEYSEQ_LENGTH+1];
@@ -3866,7 +3882,7 @@
   return;
 }
 
-void scr_DoUpdate(void)
+void scr_do_update(void)
 {
   doupdate();
 }
@@ -3894,7 +3910,7 @@
 
   if (boundcmd) {
     gchar *cmdline = from_utf8(boundcmd);
-    scr_CheckAutoAway(TRUE);
+    scr_check_auto_away(TRUE);
     if (process_command(cmdline, TRUE))
       return 255; // Quit
     g_free(cmdline);
@@ -3910,9 +3926,9 @@
   return -1;
 }
 
-//  process_key(key)
+//  scr_process_key(key)
 // Handle the pressed key, in the command line (bottom).
-void process_key(keycode kcode)
+void scr_process_key(keycode kcode)
 {
   int key = kcode.value;
   int display_char = FALSE;
--- a/mcabber/mcabber/screen.h	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/screen.h	Sun Mar 14 12:09:08 2010 +0100
@@ -55,6 +55,8 @@
 int COLOR_ATTRIB[COLOR_max];
 
 extern int update_roster;
+extern gboolean chatstates_disabled;
+extern gboolean Autoaway;
 
 typedef struct {
   int value;
@@ -85,29 +87,30 @@
   MC_REMOVE
 } muccoltype;
 
-void scr_init_bindings(void);
 
-void scr_Getch(keycode *kcode);
-void process_key(keycode kcode);
-
-void scr_InitLocaleCharSet(void);
-void scr_InitCurses(void);
-void scr_TerminateCurses(void);
-gboolean scr_CursesStatus(void);
-void scr_DrawMainWindow(unsigned int fullinit);
-void scr_DrawRoster(void);
-void scr_UpdateMainStatus(int forceupdate);
-void scr_UpdateChatStatus(int forceupdate);
-void scr_RosterVisibility(int status);
 void scr_WriteIncomingMessage(const char *jidfrom, const char *text,
                               time_t timestamp, guint prefix,
                               unsigned mucnicklen);
 void scr_WriteOutgoingMessage(const char *jidto,   const char *text,
                               guint prefix, gpointer xep184);
-void scr_RemoveReceiptFlag(const char *jidto, gpointer xep184);
-void scr_ShowBuddyWindow(void);
-int  scr_BuddyBufferExists(const char *jid);
-void scr_UpdateBuddyWindow(void);
+
+void scr_getch(keycode *kcode);
+void scr_process_key(keycode kcode);
+
+void scr_init_bindings(void);
+void scr_init_locale_charset(void);
+void scr_init_curses(void);
+void scr_terminate_curses(void);
+gboolean scr_curses_status(void);
+void scr_draw_main_window(unsigned int fullinit);
+void scr_draw_roster(void);
+void scr_update_main_status(int forceupdate);
+void scr_update_chat_status(int forceupdate);
+void scr_roster_visibility(int status);
+void scr_remove_receipt_flag(const char *jidto, gpointer xep184);
+void scr_show_buddy_window(void);
+int  scr_buddy_buffer_exists(const char *jid);
+void scr_update_buddy_window(void);
 void scr_set_chatmode(int enable);
 int  scr_get_chatmode(void);
 void scr_set_multimode(int enable, char *subject);
@@ -121,44 +124,39 @@
 guint scr_gettextwidth(void);
 void  scr_line_prefix(hbb_line *line, char *prefix, guint preflen);
 
-void scr_Beep(void);
-
-bool Autoaway;
+void scr_beep(void);
+void scr_check_auto_away(int activity);
 
-void scr_CheckAutoAway(int activity);
-
-#if defined XEP0022 || defined XEP0085
-gboolean scr_ChatStatesTimeout();
-#endif
-int chatstates_disabled;
 
 // For commands...
-void scr_RosterTop(void);
-void scr_RosterBottom(void);
-void scr_RosterUpDown(int updown, unsigned int n);
-void scr_RosterPrevGroup(void);
-void scr_RosterNextGroup(void);
-void scr_RosterSearch(char *);
-void scr_RosterJumpJid(char *);
-void scr_RosterDisplay(const char *);
-void scr_BufferTopBottom(int topbottom);
-void scr_BufferClear(void);
-void scr_BufferScrollLock(int lock);
-void scr_BufferPurge(int, const char*);
-void scr_BufferPurgeAll(int);
-void scr_BufferSearch(int direction, const char *text);
-void scr_BufferPercent(int pc);
-void scr_BufferDate(time_t t);
-void scr_BufferDump(const char *file);
-void scr_RosterUnreadMessage(int);
-void scr_RosterJumpAlternate(void);
-void scr_BufferScrollUpDown(int updown, unsigned int nblines);
-bool scr_RosterColor(const char *status, const char *wildcard,
-                     const char *color);
-void scr_RosterClearColor(void);
-void scr_MucColor(const char *muc, muccoltype type);
-void scr_MucNickColor(const char *nick, const char *color);
-void scr_BufferList(void);
+void scr_roster_top(void);
+void scr_roster_bottom(void);
+void scr_roster_up_down(int updown, unsigned int n);
+void scr_roster_prev_group(void);
+void scr_roster_next_group(void);
+void scr_roster_search(char *);
+void scr_roster_jump_jid(char *);
+void scr_roster_jump_alternate(void);
+void scr_roster_unread_message(int);
+void scr_roster_display(const char *);
+
+void scr_buffer_top_bottom(int topbottom);
+void scr_buffer_clear(void);
+void scr_buffer_scroll_lock(int lock);
+void scr_buffer_purge(int, const char*);
+void scr_buffer_purge_all(int);
+void scr_buffer_search(int direction, const char *text);
+void scr_buffer_percent(int pc);
+void scr_buffer_date(time_t t);
+void scr_buffer_dump(const char *file);
+void scr_buffer_list(void);
+void scr_buffer_scroll_up_down(int updown, unsigned int nblines);
+
+bool scr_roster_color(const char *status, const char *wildcard,
+                      const char *color);
+void scr_roster_clear_color(void);
+void scr_muc_color(const char *muc, muccoltype type);
+void scr_muc_nick_color(const char *nick, const char *color);
 
 void readline_transpose_chars(void);
 void readline_forward_kill_word(void);
--- a/mcabber/mcabber/utils.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/utils.c	Sun Mar 14 12:09:08 2010 +0100
@@ -218,9 +218,9 @@
   return g_strdup(new_value);
 }
 
-//  ut_InitDebug()
+//  ut_init_debug()
 // Installs otpion guards before initial config file parsing.
-void ut_InitDebug(void)
+void ut_init_debug(void)
 {
   DebugEnabled = 0;
   FName        = NULL;
@@ -228,7 +228,7 @@
   settings_set_guard("tracelog_file",  tracelog_file_guard);
 }
 
-void ut_WriteLog(unsigned int flag, const char *data)
+void ut_write_log(unsigned int flag, const char *data)
 {
   if (!DebugEnabled || !FName) return;
 
--- a/mcabber/mcabber/utils.h	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/utils.h	Sun Mar 14 12:09:08 2010 +0100
@@ -23,8 +23,8 @@
 void fingerprint_to_hex(const unsigned char *fpr, char hex[49]);
 gboolean hex_to_fingerprint(const char * hex, char fpr[16]);
 
-void ut_InitDebug(void);
-void ut_WriteLog(unsigned int flag, const char *data);
+void ut_init_debug(void);
+void ut_write_log(unsigned int flag, const char *data);
 
 char *expand_filename(const char *fname);
 
--- a/mcabber/mcabber/xmpp.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/xmpp.c	Sun Mar 14 12:09:08 2010 +0100
@@ -298,7 +298,7 @@
                                  LmMessage *m, gpointer user_data)
 {
   char *from = jidtodisp(lm_message_get_from(m));
-  scr_RemoveReceiptFlag(from, h);
+  scr_remove_receipt_flag(from, h);
   g_free(from);
   return LM_HANDLER_RESULT_REMOVE_MESSAGE;
 }
@@ -954,7 +954,7 @@
   rosternotes = NULL;
   // Update display
   update_roster = TRUE;
-  scr_UpdateBuddyWindow();
+  scr_update_buddy_window();
 
   if (!reason)
     scr_LogPrint(LPRINT_LOGNORM, "Disconnected.");
@@ -1145,7 +1145,7 @@
     }
 
     buddylist_build();
-    scr_DrawRoster();
+    scr_draw_roster();
     goto gotmessage_return;
   }
 
@@ -1249,7 +1249,7 @@
       g_free(s);
       g_free(mbuf);
       // The topic is displayed in the chat status line, so refresh now.
-      scr_UpdateChatStatus(TRUE);
+      scr_update_chat_status(TRUE);
     }
   }
 
@@ -1920,14 +1920,14 @@
       mystatusmsg = NULL;
   }
 
-  if (!scr_CursesStatus())
+  if (!scr_curses_status())
     return;  // Called from config. file
 
   if (!Autoaway)
     update_last_use();
 
   // Update status line
-  scr_UpdateMainStatus(TRUE);
+  scr_update_main_status(TRUE);
 }
 
 
--- a/mcabber/mcabber/xmpp_iq.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/xmpp_iq.c	Sun Mar 14 12:09:08 2010 +0100
@@ -638,7 +638,7 @@
   buddylist_build();
   update_roster = TRUE;
   if (need_refresh)
-    scr_UpdateBuddyWindow();
+    scr_update_buddy_window();
   return LM_HANDLER_RESULT_REMOVE_MESSAGE;
 }
 
--- a/mcabber/mcabber/xmpp_muc.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/mcabber/xmpp_muc.c	Sun Mar 14 12:09:08 2010 +0100
@@ -446,7 +446,7 @@
     g_free(mbuf);
     // Send back an unavailable packet
     xmpp_setstatus(offline, roomjid, "", TRUE);
-    scr_DrawRoster();
+    scr_draw_roster();
     return;
   }
 
@@ -508,7 +508,7 @@
       buddy_setnickname(room_elt->data, NULL);
       buddy_del_all_resources(room_elt->data);
       buddy_settopic(room_elt->data, NULL);
-      scr_UpdateChatStatus(FALSE);
+      scr_update_chat_status(FALSE);
       update_roster = TRUE;
     }
 
@@ -619,7 +619,7 @@
     g_free(joiner_nick);
   }
 
-  scr_DrawRoster();
+  scr_draw_roster();
 }
 
 void roompresence(gpointer room, void *presencedata)
--- a/mcabber/modules/beep/beep.c	Sun Mar 14 12:24:44 2010 +0200
+++ b/mcabber/modules/beep/beep.c	Sun Mar 14 12:09:08 2010 +0100
@@ -52,7 +52,7 @@
 	/* Check if beeping is enabled */
 	if (settings_opt_get_int ("beep_enable"))
 		/* *BEEP*! */
-		scr_Beep ();
+		scr_beep ();
 }
 
 /* beep command handler */