1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Tidied up design doc

This commit is contained in:
James Booth 2012-05-24 00:51:55 +01:00
parent 7e62076347
commit 1b7170243c

43
DESIGN
View File

@ -13,28 +13,29 @@ character on the input, if there is one deals with it, if not, goes around the
loop again. loop again.
If the character was a newline, the input line is processed, the result of If the character was a newline, the input line is processed, the result of
processing profanity will either continue (TRUE) or stop (FALSE). processing input will either continue (TRUE) or stop (FALSE, if the input
was "/quit").
Shutting down just involves clearing up resources. Shutting down just involves clearing up resources.
title_bar.c, windows.c, status_bar.c, input_win.c title_bar.c, windows.c, status_bar.c, input_win.c
================================================= =================================================
Represent the different windows in Ncurses. These represent the different windows in Ncurses.
---------------------------------------------- +----------------------------------------------+
| TITLE_BAR | | TITLE_BAR |
---------------------------------------------- +----------------------------------------------+
| | | |
| | | |
| WINDOWS | | WINDOWS |
| | | |
| | | |
---------------------------------------------- +----------------------------------------------+
| STATUS_BAR | | STATUS_BAR |
---------------------------------------------- +----------------------------------------------+
| INPUT_WIN | | INPUT_WIN |
---------------------------------------------- +----------------------------------------------+
The interface to the UI is all through windows.h, all UI modules share this The interface to the UI is all through windows.h, all UI modules share this
header: header:
@ -51,7 +52,7 @@ header:
So any calls to the UI are through windows.h So any calls to the UI are through windows.h
title_bar.c and status_bar.c are pretty trivial. title_bar.c and status_bar.c are relatively trivial.
windows.c windows.c
--------- ---------
@ -59,14 +60,14 @@ windows.c
Contains a list of prof_win structs called _wins, which consist of: Contains a list of prof_win structs called _wins, which consist of:
from: A string, the name of the recipient for this chat window from: A string, the name of the recipient for this chat window
win: An ncurses pad containing the chat win: An ncurses pad containing the chat contents
y_pos: The current position in the chat window y_pos: The current position in the chat window
paged: Whether or not the pad has been paged (i.e not showing the end) 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". 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 This module contains things like a pointer to the console window, the index
of the current window being displayed, a dirty flag that indicated the current of the current window being displayed, a dirty flag that indicates the current
windows should be updated next time around the loop. windows should be updated next time around the loop.
inp_win.c inp_win.c
@ -87,17 +88,17 @@ jabber.c
======== ========
All interaction with libstrophe is done here. Contains a references to the All interaction with libstrophe is done here. Contains a references to the
libstrophe objects, connection, context etc. libstrophe objects: connection, context etc.
Functions ending 'handler' are callback handlers registered with libstrophe, Functions ending 'handler' are callback handlers registered with libstrophe,
for incomming messages etc. e.g. for incomming messages.
contact.c contact.c
========= =========
PContact represents a contact with: PContact represents a contact with:
name: The contact full JID, e.g. somecontact@server.org name: The contacts JID, e.g. somecontact@server.org
show: "Online", "Away" etc show: "Online", "Away" etc
status: "I'm not here right now", "At lunch" etc status: "I'm not here right now", "At lunch" etc
@ -109,9 +110,9 @@ contact_list.c
Currently has two purposes. Currently has two purposes.
Firstly stores a live list of online contacts. Live meaning jabber.c will First, stores a live list of online contacts. "Live" meaning jabber.c will
call contact_list_add() and contact_list_remove() as it gets presence call contact_list_add() and contact_list_remove() as it gets presence
notifications. notifications from the server.
Secondly it is used for autocompleting contact names when typing them, hence Secondly it is used for autocompleting contact names when typing them, hence
it stores the contact in a PAutocomplete, described later. it stores the contact in a PAutocomplete, described later.
@ -128,13 +129,13 @@ preferences.c
Deals with loading and setting preferences saved in ~/.profanity. Deals with loading and setting preferences saved in ~/.profanity.
Also allows autocomplete of previous JIDs the use has logged in with Also allows autocomplete of previous JIDs the user has logged in with
(stored in ~/.profanity) by storing them in a PAutocomplete. (stored in ~/.profanity) by storing them in a PAutocomplete.
common.c common.c
======== ========
Functions written where older versions of GLib does not have them. Functions written for compatibility with older versions of GLib.
util.c util.c
====== ======
@ -144,7 +145,7 @@ Some util functions, should probably move to common.c.
log.c log.c
===== =====
Stored a reference to the log file, and provides functions for writing to it. Stores a reference to the log file, and provides functions for writing to it.
Library like modules Library like modules
==================== ====================
@ -152,8 +153,8 @@ Library like modules
prof_history.c and prof_autocomplete.c implement a generic way to deal with prof_history.c and prof_autocomplete.c implement a generic way to deal with
command history and command autocompletion respectively. command history and command autocompletion respectively.
The rest of Profanity uses them indirectly, via history.c for example. The rest of Profanity uses them indirectly, via history.c for example,
And they know nothing about Profanity (no includes). and they know nothing about Profanity (no includes to profanity modules).
These modules use opaque pointers so all access must be through functions These modules use opaque pointers so all access must be through functions
exposed in their headers. exposed in their headers.
@ -166,7 +167,7 @@ Profanity.
prof_autocomplete.c prof_autocomplete.c
------------------- -------------------
Two type are PAutocomplete can be created. Two types of PAutocomplete can be created.
p_autocomplete_new() creates a PAutocomplete that can store strings, the p_autocomplete_new() creates a PAutocomplete that can store strings, the
simple case. simple case.