summary refs log blame commit diff stats
path: root/doc/pydoc/curses.ascii.html
blob: 1c361b0a9b0fcab9006015e6ba96476a66342cdc (plain) (tree)


















































































                                                                                                                                                                                                                                                                  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module curses.ascii</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="curses.html"><font color="#ffffff">curses</font></a>.ascii</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/lib/python3.1/curses/ascii.py">/usr/lib/python3.1/curses/ascii.py</a><br><a href="http://docs.python.org/library/curses.ascii">Module Docs</a></font></td></tr></table>
    <p><tt>Constants&nbsp;and&nbsp;membership&nbsp;tests&nbsp;for&nbsp;ASCII&nbsp;characters</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-alt"><strong>alt</strong></a>(c)</dt></dl>
 <dl><dt><a name="-ascii"><strong>ascii</strong></a>(c)</dt></dl>
 <dl><dt><a name="-ctrl"><strong>ctrl</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isalnum"><strong>isalnum</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isalpha"><strong>isalpha</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isascii"><strong>isascii</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isblank"><strong>isblank</strong></a>(c)</dt></dl>
 <dl><dt><a name="-iscntrl"><strong>iscntrl</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isctrl"><strong>isctrl</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isdigit"><strong>isdigit</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isgraph"><strong>isgraph</strong></a>(c)</dt></dl>
 <dl><dt><a name="-islower"><strong>islower</strong></a>(c)</dt></dl>
 <dl><dt><a name="-ismeta"><strong>ismeta</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isprint"><strong>isprint</strong></a>(c)</dt></dl>
 <dl><dt><a name="-ispunct"><strong>ispunct</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isspace"><strong>isspace</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isupper"><strong>isupper</strong></a>(c)</dt></dl>
 <dl><dt><a name="-isxdigit"><strong>isxdigit</strong></a>(c)</dt></dl>
 <dl><dt><a name="-unctrl"><strong>unctrl</strong></a>(c)</dt></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>ACK</strong> = 6<br>
<strong>BEL</strong> = 7<br>
<strong>BS</strong> = 8<br>
<strong>CAN</strong> = 24<br>
<strong>CR</strong> = 13<br>
<strong>DC1</strong> = 17<br>
<strong>DC2</strong> = 18<br>
<strong>DC3</strong> = 19<br>
<strong>DC4</strong> = 20<br>
<strong>DEL</strong> = 127<br>
<strong>DLE</strong> = 16<br>
<strong>EM</strong> = 25<br>
<strong>ENQ</strong> = 5<br>
<strong>EOT</strong> = 4<br>
<strong>ESC</strong> = 27<br>
<strong>ETB</strong> = 23<br>
<strong>ETX</strong> = 3<br>
<strong>FF</strong> = 12<br>
<strong>FS</strong> = 28<br>
<strong>GS</strong> = 29<br>
<strong>HT</strong> = 9<br>
<strong>LF</strong> = 10<br>
<strong>NAK</strong> = 21<br>
<strong>NL</strong> = 10<br>
<strong>NUL</strong> = 0<br>
<strong>RS</strong> = 30<br>
<strong>SI</strong> = 15<br>
<strong>SO</strong> = 14<br>
<strong>SOH</strong> = 1<br>
<strong>SP</strong> = 32<br>
<strong>STX</strong> = 2<br>
<strong>SUB</strong> = 26<br>
<strong>SYN</strong> = 22<br>
<strong>TAB</strong> = 9<br>
<strong>US</strong> = 31<br>
<strong>VT</strong> = 11<br>
<strong>controlnames</strong> = ['NUL', 'SOH', 'STX', 'ETX', 'EOT', 'ENQ', 'ACK', 'BEL', 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'SO', 'SI', 'DLE', 'DC1', 'DC2', 'DC3', ...]</td></tr></table>
</body></html>
">chat_room != NULL) && (chat_room->pending_nick_change)) { return g_hash_table_lookup(chat_room->nick_changes, new_nick); } return NULL; } /* * Flag that the user has sent a nick change to the service * and is awaiting the response */ void muc_set_room_pending_nick_change(const char * const room, const char * const new_nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { chat_room->pending_nick_change = TRUE; g_hash_table_insert(chat_room->nick_changes, strdup(new_nick), strdup(chat_room->nick)); } } /* * Returns TRUE if the room is awaiting the result of a * nick change */ gboolean muc_is_room_pending_nick_change(const char * const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { return chat_room->pending_nick_change; } else { return FALSE; } } /* * Change the current nuck name for the room, call once * the service has responded */ void muc_complete_room_nick_change(const char * const room, const char * const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { free(chat_room->nick); chat_room->nick = strdup(nick); chat_room->pending_nick_change = FALSE; g_hash_table_remove(chat_room->nick_changes, nick); } } /* * Return a list of room names * The contents of the list are owned by the chat room and should not be * modified or freed. */ GList * muc_get_active_room_list(void) { if (rooms != NULL) { return g_hash_table_get_keys(rooms); } else { return NULL; } } /* * Return current users nickname for the specified room * The nickname is owned by the chat room and should not be modified or freed */ char * muc_get_room_nick(const char * const room) { if (rooms != NULL) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { return chat_room->nick; } else { return NULL; } } else { return NULL; } } /* * Returns TRUE if the specified nick exists in the room's roster */ gboolean muc_nick_in_roster(const char * const room, const char * const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { PContact contact = g_hash_table_lookup(chat_room->roster, nick); if (contact != NULL) { return TRUE; } else { return FALSE; } } return FALSE; } /* * Add a new chat room member to the room's roster */ gboolean muc_add_to_roster(const char * const room, const char * const nick, const char * const show, const char * const status, const char * const caps_str) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); gboolean updated = FALSE; if (chat_room != NULL) { PContact old = g_hash_table_lookup(chat_room->roster, nick); if (old == NULL) { updated = TRUE; autocomplete_add(chat_room->nick_ac, nick); } else if ((g_strcmp0(p_contact_presence(old), show) != 0) || (g_strcmp0(p_contact_status(old), status) != 0)) { updated = TRUE; } PContact contact = p_contact_new(nick, NULL, NULL, NULL, NULL, FALSE); resource_presence_t resource_presence = resource_presence_from_string(show); Resource *resource = resource_new(nick, resource_presence, status, 0, caps_str); p_contact_set_presence(contact, resource); g_hash_table_replace(chat_room->roster, strdup(nick), contact); } return updated; } /* * Remove a room member from the room's roster */ void muc_remove_from_roster(const char * const room, const char * const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { g_hash_table_remove(chat_room->roster, nick); autocomplete_remove(chat_room->nick_ac, nick); } } PContact muc_get_participant(const char * const room, const char * const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { PContact participant = g_hash_table_lookup(chat_room->roster, nick); return participant; } return NULL; } /* * Return a list of PContacts representing the room members in the room's roster * The list is owned by the room and must not be mofified or freed */ GList * muc_get_roster(const char * const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { GList *result = NULL; GHashTableIter iter; gpointer key; gpointer value; g_hash_table_iter_init(&iter, chat_room->roster); while (g_hash_table_iter_next(&iter, &key, &value)) { result = g_list_insert_sorted(result, value, (GCompareFunc)_compare_participants); } return result; } else { return NULL; } } /* * Return a Autocomplete representing the room member's in the roster */ Autocomplete muc_get_roster_ac(const char * const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { return chat_room->nick_ac; } else { return NULL; } } /* * Set to TRUE when the rooms roster has been fully recieved */ void muc_set_roster_received(const char * const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { chat_room->roster_received = TRUE; } } /* * Returns TRUE id the rooms roster has been fully recieved */ gboolean muc_get_roster_received(const char * const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { return chat_room->roster_received; } else { return FALSE; } } /* * Remove the old_nick from the roster, and flag that a pending nickname change * is in progress */ void muc_set_roster_pending_nick_change(const char * const room, const char * const new_nick, const char * const old_nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { g_hash_table_insert(chat_room->nick_changes, strdup(new_nick), strdup(old_nick)); muc_remove_from_roster(room, old_nick); } } /* * Complete the pending nick name change for a contact in the room's roster * The new nick name will be added to the roster * The old nick name will be returned in a new string which must be freed by * the caller */ char * muc_complete_roster_nick_change(const char * const room, const char * const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room != NULL) { char *old_nick = g_hash_table_lookup(chat_room->nick_changes, nick); char *old_nick_cpy; if (old_nick != NULL) { old_nick_cpy = strdup(old_nick); g_hash_table_remove(chat_room->nick_changes, nick); return old_nick_cpy; } } return NULL; } static void _free_room(ChatRoom *room) { if (room != NULL) { free(room->room); free(room->nick); free(room->subject); if (room->roster != NULL) { g_hash_table_remove_all(room->roster); } if (room->nick_ac != NULL) { autocomplete_free(room->nick_ac); } if (room->nick_changes != NULL) { g_hash_table_remove_all(room->nick_changes); } free(room); } } static gint _compare_participants(PContact a, PContact b) { const char * utf8_str_a = p_contact_barejid(a); const char * utf8_str_b = p_contact_barejid(b); gchar *key_a = g_utf8_collate_key(utf8_str_a, -1); gchar *key_b = g_utf8_collate_key(utf8_str_b, -1); gint result = g_strcmp0(key_a, key_b); g_free(key_a); g_free(key_b); return result; }