Responsibilities are generally seperated into modules. profanity.c =========== Contains initialisation, main loop, and shutdown functions. Initialisation is loading preferences, initialising any libraries/files/data structures used. The main loop is where the work is done. It will keep checking for a new character on the input, if there is one deals with it, if not, goes around the loop again. If the character was a newline, the input line is processed, the result of processing input will either continue (TRUE) or stop (FALSE, if the input was "/quit"). Shutting down just involves clearing up resources. title_bar.c, windows.c, status_bar.c, input_win.c ================================================= These represent the different windows in Ncurses. +----------------------------------------------+ | TITLE_BAR | +----------------------------------------------+ | | | | | WINDOWS | | | | | +----------------------------------------------+ | STATUS_BAR | +----------------------------------------------+ | INPUT_WIN | +----------------------------------------------+ The interface to the UI is all through ui.h, all UI modules share this header: ui.h | | -------------------------------------------------- | | | | title_bar.c windows.c status_bar.c inp_win.c So any calls to the UI are through ui.h title_bar.c and status_bar.c are relatively trivial. windows.c --------- Contains a list of prof_win structs called _wins, which consist of: from: A string, the name of the recipient for this chat window win: An ncurses pad containing the chat contents y_pos: The current position in the chat window paged: Whether or not the pad has been paged (i.e not showing the end) The console is _wins[0], and has a special 'from' value of "_cons". This module contains things like a pointer to the console window, the index of the current window being displayed, a dirty flag that indicates the current windows should be updated next time around the loop. inp_win.c --------- Doesn't do much more than handle each character with inp_get_char(). Deals with all special chars for editing the input, HOME, PAGE UP, UP, DOWN etc. command.c ========= When the main input loop gets a '\n', process_input() is called with the line of input. This is where each command/message is handled. jabber.c ======== All interaction with libstrophe is done here. Contains a references to the libstrophe objects: connection, context etc. Functions ending 'handler' are callback handlers registered with libstrophe, e.g. for incomming messages. contact.c ========= PContact represents a contact with: name: The contacts JID, e.g. somecontact@server.org show: "Online", "Away" etc status: "I'm not here right now", "At lunch" etc I<style>pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { c