Skip to content

Commit

Permalink
Updated Loudmouth docs. JS version of docs browser will gracefully de…
Browse files Browse the repository at this point in the history
…grade if JS is not supported.
  • Loading branch information
josip committed Mar 1, 2010
1 parent fb691c0 commit 031bb67
Show file tree
Hide file tree
Showing 312 changed files with 3,462 additions and 467 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
@@ -1,6 +1,3 @@
[submodule "addons/Generys"]
path = addons/Generys
url = git://github.com/josip/generys.git
[submodule "addons/CInvoke"]
path = addons/CInvoke
url = git://github.com/fredreichbier/io-cinvoke.git
1 change: 0 additions & 1 deletion addons/CInvoke
Submodule CInvoke deleted from 1aabb4
7 changes: 3 additions & 4 deletions addons/Loudmouth/io/JID.io
@@ -1,7 +1,5 @@
#Regex

JID := Object clone do(
//metadoc JID category networking
//metadoc JID category Networking
//metadoc JID description Object for representing JIDs.
#_jidRegex = "(.+)@([^/]+)/?(.*)?" asRegex

Expand All @@ -14,7 +12,8 @@ JID := Object clone do(
//doc JID asString Converts JID to string with all available parts included.
asString ::= nil

/*doc JID with(jid) Extracts all parts of a provided <code>Sequence</code> and returns new <code>JID</code> clone.
/*doc JID with(jid)
Extracts all parts of a provided <code>Sequence</code> and returns new <code>JID</code> clone.
<pre><code>
j := JID with("cow@moo.com/Alpes")
j username == "cow"
Expand Down
16 changes: 8 additions & 8 deletions addons/Loudmouth/io/Loudmouth.io
Expand Up @@ -34,8 +34,8 @@ acc connect
Loudmouth startMainLoop
</pre></code>*/
/*doc Loudmouth types *
<p>Returns status codes and message types.</p>
/*doc Loudmouth types
<p>Object containing status codes and message types.</p>
<pre><code>
Loudmouth with("username@server.com", "password") do(
handleConnect = method(
Expand Down Expand Up @@ -72,17 +72,17 @@ Loudmouth startMainLoop
setHost(jid host)\
setResource(jid resource))

//doc Loudmouth handleConnect() Slot called once connection is established.
//doc Loudmouth handleConnect Slot called once connection is established.
handleConnect := method()
//doc Loudmouth handleConnectFailure() Slot called when server is not reachable.
//doc Loudmouth handleConnectFailure Slot called when server is not reachable.
handleConnectFailure := method()
//doc Lodumouth handleAuthenticated() Slot called upon successful authentication.
//doc Lodumouth handleAuthenticated Slot called upon successful authentication.
handleAuthenticated := method()
//doc Loudmouth handleAuthenticationFailure() Slot called if username/password combinaton is wrong.
//doc Loudmouth handleAuthenticationFailure Slot called if username/password combinaton is wrong.
handleAuthenticationFailure := method()
//doc Loudmouth handleDisconnect() Slot called upon closing the connection with the server.
//doc Loudmouth handleDisconnect Slot called upon closing the connection with the server.
handleDisconnect := method()
//doc Loudmouth handleSslFailure() Slot called if SSL-related problems arrive. Method should return <code>true</code> if it wishes make a connection without SSL, <code>false</code> otherwise.
//doc Loudmouth handleSslFailure Slot called if SSL-related problems arrive. Method should return <code>true</code> if it wishes make a connection without SSL, <code>false</code> otherwise.
handleSslFailure := method(true)
//doc Loudmouth handleMessage(xmppMessage) Slot called when an message arrives via XMPP stream. <code>xmppMessage</code> is a <code>LoudmouthMessage</code> object.
# Overwrite this method in your clone
Expand Down
2 changes: 1 addition & 1 deletion addons/Loudmouth/io/LoudmouthMessage.io
Expand Up @@ -72,7 +72,7 @@ LoudmouthMessage := Object clone do(

XmppChatMessage := LoudmouthMessage clone do(
//metadoc XmppChatMessage category Networking
//doc XmppChatMessage create() Creates a new <code>LoudmouthMessage</code> with chat <code>type</code> and random id value.
//doc XmppChatMessage create Creates a new <code>LoudmouthMessage</code> with chat <code>type</code> and random id value.
create := method(
super(with("""<message from="" to="" id="lm.io.#{self uniqueHexId}" type="chat"></message>""" interpolate)))
)
18 changes: 18 additions & 0 deletions addons/Loudmouth/source/IoLoudmouth.c
Expand Up @@ -164,21 +164,25 @@ void IoLoudmouth_free(IoLoudmouth *self) {
}

/*** Loudmouth slots ***/
//doc Loudmouth startMainLoop Starts GMainLoop. Should be called after connection is established with the server.
IoObject *IoLoudmouth_startMainLoop(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
main_loop = g_main_loop_new(main_context, FALSE);
g_main_loop_run(main_loop);
return self;
}

//doc Loudmouth stopMainLoop
IoObject *IoLoudmouth_stopMainLoop(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
g_main_loop_quit(main_loop);
return self;
}

//doc Loudmouth isSslSupported
IoObject *IoLoudmouth_isSSLSupported(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
return IOBOOL(self, lm_ssl_is_supported());
}

//doc Loudmouth registerAccount(server, username, password) Registers a new account at XMPP server. Returns <code>true</code> or <code>false</code>.
IoObject *IoLoudmouth_registerAccount(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
char *server = IoMessage_locals_cStringArgAt_(m, locals, 0),
*username = IoMessage_locals_cStringArgAt_(m, locals, 1),
Expand Down Expand Up @@ -237,6 +241,7 @@ IoObject *IoLoudmouth_registerAccount(IoLoudmouth *self, IoObject *locals, IoMes
return IOBOOL(self, success);
}

//doc Loudmouth connect Connects to the server. Returns <code>self</code>.
IoObject *IoLoudmouth_connect(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
// Q: Should we io_free() these?
IoSeq* username = IoObject_getSlot_(self, IOSYMBOL("username"));
Expand Down Expand Up @@ -279,14 +284,25 @@ IoObject *IoLoudmouth_connect(IoLoudmouth *self, IoObject *locals, IoMessage *m)
return self;
}

//doc Loudmouth disconnect Disconnects from server and returns <code>true</code> if it succeeds.
IoObject *IoLoudmouth_disconnect(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
return IOBOOL(self, lm_connection_close(LMCONN(self), NULL));
}

//doc Loudmouth isConnected
IoObject *IoLoudmouth_isConnected(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
return IOBOOL(self, lm_connection_is_authenticated(LMCONN(self)));
}

/*doc Loudmouth status
Returns status connection. Possible return values are:
<ul>
<li><code>Loudmouth types CLOSED</code></li>
<li><code>Loudmouth types OPENING</code></li>
<li><code>Loudmouth types OPEN</code></li>
<li><code>Loudmouth types AUTHENTICATING</code></li>
<li><code>Loudmouth types AUTHENTICATED</code></li>
</ul>*/
IoObject *IoLoudmouth_status(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
IoSeq *status = IOSYMBOL("unknown");
switch(lm_connection_get_state(LMCONN(self))) {
Expand All @@ -300,6 +316,7 @@ IoObject *IoLoudmouth_status(IoLoudmouth *self, IoObject *locals, IoMessage *m)
return status;
}

//doc Loudmouth send(toJid, message) Sends an message (<code>Sequence</code>) to provided JID (<code>Sequence</code>). Returns <code>true</code> or <code>false</code>.
IoObject *IoLoudmouth_send(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
char *to = IoMessage_locals_cStringArgAt_(m, locals, 0);
char *msg_body = IoMessage_locals_cStringArgAt_(m, locals, 1);
Expand All @@ -318,6 +335,7 @@ IoObject *IoLoudmouth_send(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
return IOBOOL(self, success);
}

//doc Loudmouth sendRaw(body) Sends raw text over XMPP stream. Returns <code>true</code> if no errors occur.
IoObject *IoLoudmouth_sendRaw(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
char *seq = IoMessage_locals_cStringArgAt_(m, locals, 0);
int success = lm_connection_send_raw(LMCONN(self), seq, NULL);
Expand Down
1 change: 1 addition & 0 deletions build/AddonBuilder.io
Expand Up @@ -111,6 +111,7 @@ AddonBuilder := Object clone do(
)

pathForLib := method(name,
name containsSeq("/") ifTrue(return(name))
libNames := list("." .. dllSuffix, ".a", ".lib") map(suffix, "lib" .. name .. suffix)
libSearchPaths detect(path,
libDirectory := Directory with(path)
Expand Down
23 changes: 0 additions & 23 deletions docs/IoReference.html

This file was deleted.

59 changes: 39 additions & 20 deletions docs/docs.css
Expand Up @@ -11,6 +11,10 @@ a {
text-decoration: none;
}

a:active {
outline: 0;
}

body {
font-family: 'Helvetica Neue', 'Helvetica', sans-serif;
margin: 8px 8px 8px 4em;
Expand Down Expand Up @@ -202,16 +206,23 @@ code {
margin: 1em 0 3em 2em;
}

#search {
position: fixed;
right: 4em;
}

#searchResults {
position: absolute;
position: fixed;
right: 4em;
list-style: none;
min-width: 200px;
padding: 2px;
margin: 20px 0 0 0;
margin: 20px -6px 0 0;
text-indent: 0;
z-index: 2;
background: #000;
-webkit-box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
background: rgba(0, 0, 0, 0.9);
-webkit-box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
-moz-box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
}

#searchResults li a {
Expand All @@ -226,31 +237,39 @@ code {
}

#browser {
background: rgba(255, 255, 255, 0.9);
border: 0;
margin-left: 0;
line-height: 1.2em;
}

#browser ol {
list-style: none;
text-indent: 0;
padding: 0;
display: block;
#browser td.column {
text-align: left;
width: 12em;
float: left;
margin: 0;
}

#browser li {
padding: 2px 0;
#slots {
width: auto !important;
}

#slots a:active {
font-weight: bold;
color: #000;
}

#protoDescription, #protoSlots {
margin: 0 0 0 8em;
line-height: 1.2em;
width: 40em;
}

#slots li.description {
border-top: 3px double #ddd;
margin: 1em 0 0 0;
padding: 1em 0 0 0;
#protoDescription {
margin-top: 6em;
padding-bottom: 5em;
border-bottom: 1px solid #ddd;
}

#slotDescriptions {
margin: 6em 0 0 0;
#protoSlots {
margin-top: 3em;
}

span.args {
Expand Down

0 comments on commit 031bb67

Please sign in to comment.