changeset 422:8eb2839a565c

Rename various functions.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 24 May 2012 08:11:34 +0300
parents 4b7cd24dc943
children 6727fec3c326
files main.c
diffstat 1 files changed, 35 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Thu May 24 07:59:59 2012 +0300
+++ b/main.c	Thu May 24 08:11:34 2012 +0300
@@ -235,7 +235,7 @@
     return th_strcasecmp((char *) s1, (char *) s2);
 }
 
-nn_window_t *findWindow(const char *id)
+nn_window_t *nnwin_find(const char *id)
 {
     int i;
 
@@ -249,7 +249,7 @@
 }
 
 
-BOOL openWindow(const char *name, BOOL curwin)
+BOOL nnwin_open(const char *name, BOOL curwin)
 {
     int i;
     nn_window_t *res;
@@ -273,7 +273,7 @@
 }
 
 
-void closeWindow(nn_window_t *win)
+void nnwin_close(nn_window_t *win)
 {
     int i;
     if (win == NULL) return;
@@ -288,7 +288,7 @@
 }
 
 
-void updateStatus(void)
+void nnwin_update_statusline(void)
 {
     char tmpStr[128];
     int i;
@@ -338,7 +338,7 @@
 }
 
 
-void printEditBuf(nn_editbuf_t *buf)
+void nnwin_update_editbuf(nn_editbuf_t *buf)
 {
     char *tmp;
     if (editWin == NULL || buf == NULL) return;
@@ -370,7 +370,7 @@
 }
 
 
-int printWin(WINDOW *win, const char *fmt)
+int nnwin_print(WINDOW *win, const char *fmt)
 {
     const char *s = fmt;
     int col = 0;
@@ -403,7 +403,7 @@
 
 #define QPUTCH(ch) th_vputch(&(win->buf), &(win->bufsize), &(win->len), ch)
 
-int nn_window_print(nn_window_t *win, const char *fmt)
+int nnwin_print_buf(nn_window_t *win, const char *fmt)
 {
     const char *s = fmt;
     int col = 0;
@@ -465,7 +465,7 @@
 }
 
 
-BOOL updateMainWin(BOOL force)
+BOOL nnwin_update_main(BOOL force)
 {
     int h, offs;
     qringbuf_t *buf;
@@ -488,7 +488,7 @@
     for (offs = buf->size - h - currWin->pos; offs >= 0 && offs < buf->size - currWin->pos && offs < buf->size; offs++)
     {
         if (buf->data[offs] != NULL)
-            printWin(mainWin, buf->data[offs]);
+            nnwin_print(mainWin, buf->data[offs]);
     }
 
     currWin->dirty = FALSE;
@@ -549,8 +549,8 @@
     if (!optDaemon && (flags & LOG_WINDOW))
     {
         nn_window_t *tmp = win != NULL ? win : chatWindows[0];
-        if (flags & LOG_STAMP) nn_window_print(tmp, tmpStr);
-        nn_window_print(tmp, buf);
+        if (flags & LOG_STAMP) nnwin_print_buf(tmp, tmpStr);
+        nnwin_print_buf(tmp, buf);
     }
 
     th_free(buf);
@@ -701,7 +701,7 @@
             *tmp = 0;
 
             isIgnored = setIgnoreMode && checkIgnoreList(in_name);
-            win = findWindow(in_name);
+            win = nnwin_find(in_name);
 
             if (win != NULL)
             {
@@ -781,7 +781,7 @@
     p = nn_dbldecode_str(str);
     if (!p) return -1;
 
-    win = findWindow(p);
+    win = nnwin_find(p);
     nn_userhash_insert(nnUsers, nn_username_encode(p));
 
     printMsg(NULL, "! ˝3˝%s˝0˝ ˝2˝ADDED.˝0˝\n", p);
@@ -805,7 +805,7 @@
     p = nn_dbldecode_str(str);
     if (!p) return -1;
 
-    win = findWindow(p);
+    win = nnwin_find(p);
     nn_userhash_delete(nnUsers, nn_username_encode(p));
 
     printMsg(NULL, "! ˝3˝%s˝0˝ ˝1˝DELETED.˝0˝\n", p);
@@ -964,7 +964,7 @@
             {
                 name = nn_username_decode(th_strdup(user->name));
                 printMsgQ(currWin, "Opening PRV query for '%s'.\n", name);
-                if (openWindow(name, TRUE))
+                if (nnwin_open(name, TRUE))
                     printMsgQ(currWin, "In PRV query with '%s'.\n", name);
                 th_free(name);
             }
@@ -1007,10 +1007,10 @@
         char *name = str_trim_left(buf + 6);
         if (strlen(name) > 0)
         {
-            nn_window_t *win = findWindow(name);
+            nn_window_t *win = nnwin_find(name);
             if (win != NULL)
             {
-                closeWindow(win);
+                nnwin_close(win);
                 printMsgQ(currWin, "Closed PRV query to '%s'.\n", name);
             }
             else
@@ -1022,7 +1022,7 @@
         {
             if (currWin != chatWindows[0])
             {
-                closeWindow(currWin);
+                nnwin_close(currWin);
                 currWin = chatWindows[0];
             }
         }
@@ -1125,7 +1125,7 @@
 }
 
 
-void closeWindows(void)
+void nnwin_close_windows(void)
 {
     if (mainWin) delwin(mainWin);
     if (statusWin) delwin(statusWin);
@@ -1133,13 +1133,13 @@
 }
 
 
-BOOL initializeWindows(void)
+BOOL nnwin_initialize_windows(void)
 {
     int w, h;
 
     getmaxyx(stdscr, h, w);
 
-    closeWindows();
+    nnwin_close_windows();
 
     mainWin = subwin(stdscr, h - 4, w, 0, 0);
     statusWin = subwin(stdscr, 1, w, h - 4, 0);
@@ -1152,7 +1152,7 @@
 }
 
 
-void updateWindows(void)
+void nnwin_update_all(void)
 {
     if (mainWin) redrawwin(mainWin);
     if (statusWin) redrawwin(statusWin);
@@ -1586,7 +1586,7 @@
 
         cursesInit = TRUE;
 
-        if (!initializeWindows())
+        if (!nnwin_initialize_windows())
             goto err_exit;
 
 #ifdef PDCURSES
@@ -1596,13 +1596,13 @@
         memset(chatWindows, 0, sizeof(chatWindows));
         chatWindows[0] = nn_window_new(NULL);
         currWin = chatWindows[0];
-        updateStatus();
+        nnwin_update_statusline();
     }
 
     // Check if we have username and password
     if (cursesInit && (optUserName == NULL || optPassword == NULL))
     {
-        printWin(editWin, "You can avoid this prompt by issuing '/save' after logging in.\n");
+        nnwin_print(editWin, "You can avoid this prompt by issuing '/save' after logging in.\n");
         optUserName = promptRequester(editWin, "NN username: ", FALSE);
         optPassword = promptRequester(editWin, "NN password: ", TRUE);
     }
@@ -1695,8 +1695,8 @@
         nn_editbuf_clear(editBuf);
 
         // First update of screen
-        printEditBuf(editBuf);
-        updateStatus();
+        nnwin_update_editbuf(editBuf);
+        nnwin_update_statusline();
 
         printMsg(NULL, "%s v%s - %s\n", th_prog_name, th_prog_version, th_prog_fullname);
         printMsg(NULL, "%s\n", th_prog_author);
@@ -1854,7 +1854,7 @@
                     erase();
                     timeout(SET_DELAY);
 
-                    if (!initializeWindows())
+                    if (!nnwin_initialize_windows())
                     {
                         errorMsg("Error resizing curses chatWindows\n");
                         isError = TRUE;
@@ -2015,7 +2015,7 @@
                     break;
 
                 case 0x0c: // Ctrl + L
-                    updateWindows();
+                    nnwin_update_all();
                     update = updateMain = TRUE;
                     break;
 
@@ -2062,13 +2062,13 @@
             }
             while (c != ERR && !exitProg && ++cnt < 10);
 
-            updateMainWin(updateMain);
+            nnwin_update_main(updateMain);
 
             if (update || firstUpdate)
             {
                 // Update edit line
-                updateStatus();
-                printEditBuf(editBuf);
+                nnwin_update_statusline();
+                nnwin_update_editbuf(editBuf);
                 firstUpdate = FALSE; // a nasty hack ...
             }
 
@@ -2091,8 +2091,8 @@
                 nn_conn_send_msg(conn, optUserNameEnc, "%%2FSetFontColor%%20%%2Dcolor%%20%06X", optUserColor);
             }
 
-            updateStatus();
-            printEditBuf(editBuf);
+            nnwin_update_statusline();
+            nnwin_update_editbuf(editBuf);
             updateCount = 0;
         }
 
@@ -2129,7 +2129,7 @@
     {
         if (curVis != ERR)
             curs_set(curVis);
-        closeWindows();
+        nnwin_close_windows();
         endwin();
         THMSG(1, "NCurses deinitialized.\n");
     }