diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index a2ee115ea..2136e5b2d 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -584,6 +584,38 @@ C example: int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */ ---------------------------------------- +weechat_strncasecmp +^^^^^^^^^^^^^^^^^^^ + +Locale and case independent string comparison, for 'max' chars. + +Prototype: + +[source,C] +---------------------------------------- +int weechat_strncasecmp (const char *string1, const char *string2, int max); +---------------------------------------- + +Arguments: + +* 'string1': first string for comparison +* 'string2': second string for comparison +* 'max': max chars to compare + +Return value: + +* difference between two strings: +** negative if string1 < string2 +** zero if string1 == string2 +** positive if string1 > string2 + +C example: + +[source,C] +---------------------------------------- +int diff = weechat_strncasecmp ("aabb", "aacc", 2); /* == 0 */ +---------------------------------------- + weechat_strcmp_ignore_chars ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -731,6 +763,8 @@ free (str); weechat_string_expand_home ^^^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Replace leading `~` by string with home directory. If string does not start with `~`, then same string is returned. @@ -1182,6 +1216,8 @@ str = weechat.string_remove_color(my_string, "?") weechat_string_encode_base64 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.2._ + Encode a string in base64. Prototype: @@ -1210,6 +1246,8 @@ weechat_string_encode_base64 (string, strlen (string), result); weechat_string_decode_base64 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.2._ + Decode a base64 string. Prototype: @@ -1242,6 +1280,8 @@ length = weechat_string_decode_base64 (string, result); weechat_string_is_command_char ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.2._ + Check if first char of string is a command char (default command char is '/'). Prototype: @@ -1282,6 +1322,8 @@ command_char2 = weechat.string_is_command_char("test") # == 0 weechat_string_input_for_buffer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.2._ + Return pointer to input text for buffer (pointer inside "string" argument), or NULL if it's a command. @@ -1475,6 +1517,33 @@ C example: char *next_char = weechat_utf8_next_char (string); ---------------------------------------- +weechat_utf8_char_int +^^^^^^^^^^^^^^^^^^^^^ + +Return UTF-8 char as integer. + +Prototype: + +[source,C] +---------------------------------------- +int weechat_utf8_char_int (const char *string); +---------------------------------------- + +Arguments: + +* 'string': string + +Return value: + +* UTF-8 char as integer + +C example: + +[source,C] +---------------------------------------- +int char_int = weechat_utf8_char_int ("être"); /* "ê" as integer */ +---------------------------------------- + weechat_utf8_char_size ^^^^^^^^^^^^^^^^^^^^^^ @@ -1584,6 +1653,37 @@ C example: int length_on_screen = weechat_utf8_strlen_screen ("é"); /* == 1 */ ---------------------------------------- +weechat_utf8_charcmp +^^^^^^^^^^^^^^^^^^^^ + +Compare two UTF-8 chars. + +Prototype: + +[source,C] +---------------------------------------- +int weechat_utf8_charcmp (const char *string1, const char *string2); +---------------------------------------- + +Arguments: + +* 'string1': first string for comparison +* 'string2': second string for comparison + +Return value: + +* difference between first char of each string: +** negative if char1 < char2 +** zero if char1 == char2 +** positive if char1 > char2 + +C example: + +[source,C] +---------------------------------------- +int diff = weechat_utf8_charcmp ("aaa", "ccc"); /* == -2 */ +---------------------------------------- + weechat_utf8_charcasecmp ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1926,6 +2026,39 @@ void callback (void *data, const char *filename) weechat_exec_on_files ("/tmp", 0, NULL, &callback); ---------------------------------------- +weechat_file_get_content +^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.1._ + +Get content of text file in a string. + +Prototype: + +[source,C] +---------------------------------------- +char *weechat_file_get_content (const char *filename); +---------------------------------------- + +Arguments: + +* 'filename': path and file name + +Return value: + +* content of file as string (must be freed by calling "free" after use) + +C example: + +[source,C] +---------------------------------------- +char *content; + +content = weechat_file_get_content ("/tmp/test.txt"); +/* ... */ +free (content); +---------------------------------------- + [[util]] Util ~~~~ @@ -2020,6 +2153,8 @@ weechat_util_timeval_add (&tv, 2000); /* add 2 seconds */ weechat_util_get_time_string ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.2._ + Get date/time as a string built with "strftime". Prototype: @@ -2550,6 +2685,8 @@ Hashtable functions. weechat_hashtable_new ^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Create a new hashtable. Prototype: @@ -2608,6 +2745,8 @@ struct t_hashtable *hashtable = weechat_hashtable_new (8, weechat_hashtable_set_with_size ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Add or update item in a hashtable with size for key and value. Prototype: @@ -2644,6 +2783,8 @@ weechat_hashtable_set_with_size (hashtable, "my_key", 0, weechat_hashtable_set ^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Add or update item in a hashtable. Prototype: @@ -2674,6 +2815,8 @@ weechat_hashtable_set (hashtable, "my_key", "my_value"); weechat_hashtable_get ^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Get value associated with a key in a hashtable. Prototype: @@ -2702,6 +2845,8 @@ void *value = weechat_hashtable_get (hashtable, "my_key"); weechat_hashtable_map ^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Call a function on all hashtable entries. Prototype: @@ -2742,6 +2887,8 @@ weechat_hashtable_map (hashtable, &map_cb, NULL); weechat_hashtable_get_integer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Return integer value of a hashtable property. Prototype: @@ -2773,6 +2920,8 @@ int items_count = weechat_hashtable_get_integer (hashtable, "items_count"); weechat_hashtable_add_to_infolist ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Add hashtable items to an infolist item. Prototype: @@ -2814,6 +2963,8 @@ weechat_hashtable_add_to_infolist (hashtable, infolist_item, "testhash"); weechat_hashtable_remove ^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Remove an item in a hashtable. Prototype: @@ -2838,6 +2989,8 @@ weechat_hashtable_remove (hashtable, "my_key"); weechat_hashtable_remove_all ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Remove all items in a hashtable. Prototype: @@ -2861,6 +3014,8 @@ weechat_hashtable_remove_all (hashtable); weechat_hashtable_free ^^^^^^^^^^^^^^^^^^^^^^ +_New in version 0.3.3._ + Free a hashtable. Prototype: @@ -3462,6 +3617,54 @@ option = weechat.config_search_option(config_file, section, option_name) option = weechat.config_search_option(config_file, section, "option") ---------------------------------------- +weechat_config_search_section_option +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Search a section and an option in a configuration file or section. + +Prototype: + +[source,C] +---------------------------------------- +void weechat_config_search_section_option (struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, + struct t_config_section **section_found, + struct t_config_option **option_found); +---------------------------------------- + +Arguments: + +* 'config_file': configuration file pointer +* 'section': section pointer +* 'option_name': option name +* 'section_found': pointer to section pointer, will be set to section of option, + if found +* 'option_found': pointer to an option pointer, will be set to option pointer, + if found + +C example: + +[source,C] +---------------------------------------- +struct t_config_section *ptr_section; +struct t_config_option *ptr_option; + +weechat_config_search_section_option(config_file, + section, + "option", + &ptr_section, + &ptr_option); +if (ptr_option) +{ + /* option found */ +} +else +{ + /* option not found */ +} +---------------------------------------- + weechat_config_search_with_string ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt index 648ad7337..65bfb5135 100644 --- a/doc/fr/weechat_plugin_api.fr.txt +++ b/doc/fr/weechat_plugin_api.fr.txt @@ -591,6 +591,39 @@ Exemple en C : int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */ ---------------------------------------- +weechat_strncasecmp +^^^^^^^^^^^^^^^^^^^ + +Comparaison de chaînes indépendante de la locale et de la casse, pour 'max' +caractères. + +Prototype : + +[source,C] +---------------------------------------- +int weechat_strncasecmp (const char *string1, const char *string2, int max); +---------------------------------------- + +Paramètres : + +* 'string1' : première chaîne à comparer +* 'string2' : seconde chaîne à comparer +* 'max' : nombre maximum de caractères à comparer + +Valeur de retour : + +* différence entre les deux chaînes : +** négative si string1 < string2 +** zéro si string1 == string2 +** positive si string1 > string2 + +Exemple en C : + +[source,C] +---------------------------------------- +int diff = weechat_strncasecmp ("aabb", "aacc", 2); /* == 0 */ +---------------------------------------- + weechat_strcmp_ignore_chars ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -738,6 +771,8 @@ free (str); weechat_string_expand_home ^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Remplace le `~` en début de chaîne par le répertoire "home". Si la chaîne ne débute pas par `~`, alors une chaîne identique est retournée. @@ -1196,6 +1231,8 @@ str = weechat.string_remove_color(ma_chaine, "?") weechat_string_encode_base64 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.2._ + Encode une chaîne en base64. Prototype : @@ -1224,6 +1261,8 @@ weechat_string_encode_base64 (string, strlen (string), result); weechat_string_decode_base64 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.2._ + Décode une chaîne base64. Prototype : @@ -1256,6 +1295,8 @@ length = weechat_string_decode_base64 (string, result); weechat_string_is_command_char ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.2._ + Vérifie si le premier caractère de la chaîne est un caractère de commande (le caractère par défaut de commande est '/'). @@ -1297,6 +1338,8 @@ command_char2 = weechat.string_is_command_char("test") # == 0 weechat_string_input_for_buffer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.2._ + Retourne un pointeur vers le texte envoyé vers le tampon (pointeur à l'intérieur du paramètre "string"), ou NULL si c'est une commande. @@ -1494,6 +1537,33 @@ Exemple en C : char *next_char = weechat_utf8_next_char (string); ---------------------------------------- +weechat_utf8_char_int +^^^^^^^^^^^^^^^^^^^^^ + +Retourne un caractère UTF-8 sous forme d'entier. + +Prototype : + +[source,C] +---------------------------------------- +int weechat_utf8_char_int (const char *string); +---------------------------------------- + +Paramètres : + +* 'string' : chaîne + +Valeur de retour : + +* caractère UTF-8 sous forme d'entier + +Exemple en C : + +[source,C] +---------------------------------------- +int char_int = weechat_utf8_char_int ("être"); /* "ê" comme entier */ +---------------------------------------- + weechat_utf8_char_size ^^^^^^^^^^^^^^^^^^^^^^ @@ -1605,6 +1675,37 @@ Exemple en C : int length_on_screen = weechat_utf8_strlen_screen ("é"); /* == 1 */ ---------------------------------------- +weechat_utf8_charcmp +^^^^^^^^^^^^^^^^^^^^ + +Compare deux caractères UTF-8. + +Prototype : + +[source,C] +---------------------------------------- +int weechat_utf8_charcmp (const char *string1, const char *string2); +---------------------------------------- + +Paramètres : + +* 'string1' : première chaîne pour la comparaison +* 'string2' : seconde chaîne pour la comparaison + +Valeur de retour : + +* différence entre le premier caractère de chaque chaîne : +** négative si char1 < char2 +** zéro si char1 == char2 +** positive si char1 > char2 + +Exemple en C : + +[source,C] +---------------------------------------- +int diff = weechat_utf8_charcmp ("aaa", "ccc"); /* == -2 */ +---------------------------------------- + weechat_utf8_charcasecmp ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1950,14 +2051,48 @@ void callback (void *data, const char *filename) weechat_exec_on_files ("/tmp", 0, NULL, &callback); ---------------------------------------- +weechat_file_get_content +^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.1._ + +Lit le contenu d'un fichier texte dans une chaîne de caractères. + +Prototype : + +[source,C] +---------------------------------------- +char *weechat_file_get_content (const char *filename); +---------------------------------------- + +Paramètres : + +* 'filename': chemin et nom du fichier + +Valeur de retour : + +* contenu du fichier sous forme de chaîne (doit être libérée par un appel à + "free" après utilisation) + +Exemple en C : + +[source,C] +---------------------------------------- +char *contenu; + +contenu = weechat_file_get_content ("/tmp/test.txt"); +/* ... */ +free (contenu); +---------------------------------------- + [[util]] Util ~~~~ Quelques fonctions utiles. -weechat_timeval_cmp -^^^^^^^^^^^^^^^^^^^ +weechat_util_timeval_cmp +^^^^^^^^^^^^^^^^^^^^^^^^ Compare deux structures "timeval". @@ -1965,7 +2100,7 @@ Prototype : [source,C] ---------------------------------------- -int weechat_timeval_cmp (struct timeval *tv1, struct timeval *tv2); +int weechat_util_timeval_cmp (struct timeval *tv1, struct timeval *tv2); ---------------------------------------- Paramètres : @@ -1983,14 +2118,14 @@ Exemple en C : [source,C] ---------------------------------------- -if (weechat_timeval_cmp (&tv1, &tv2) > 0) +if (weechat_util_timeval_cmp (&tv1, &tv2) > 0) { /* tv1 > tv2 */ } ---------------------------------------- -weechat_timeval_diff -^^^^^^^^^^^^^^^^^^^^ +weechat_util_timeval_diff +^^^^^^^^^^^^^^^^^^^^^^^^^ Retourne la différence (en millisecondes) entre deux structures "timeval". @@ -1998,7 +2133,7 @@ Prototype : [source,C] ---------------------------------------- -long weechat_timeval_diff (struct timeval *tv1, struct timeval *tv2); +long weechat_util_timeval_diff (struct timeval *tv1, struct timeval *tv2); ---------------------------------------- Paramètres : @@ -2014,11 +2149,11 @@ Exemple en C : [source,C] ---------------------------------------- -long diff = weechat_timeval_diff (&tv1, &tv2); +long diff = weechat_util_timeval_diff (&tv1, &tv2); ---------------------------------------- -weechat_timeval_add -^^^^^^^^^^^^^^^^^^^ +weechat_util_timeval_add +^^^^^^^^^^^^^^^^^^^^^^^^ Ajoute un intervalle (en millisecondes) à une structure "timeval". @@ -2026,7 +2161,7 @@ Prototype : [source,C] ---------------------------------------- -void weechat_timeval_add (struct timeval *tv, long interval); +void weechat_util_timeval_add (struct timeval *tv, long interval); ---------------------------------------- Paramètres : @@ -2038,12 +2173,14 @@ Exemple en C : [source,C] ---------------------------------------- -weechat_timeval_add (&tv, 2000); /* ajoute 2 secondes */ +weechat_util_timeval_add (&tv, 2000); /* ajoute 2 secondes */ ---------------------------------------- weechat_util_get_time_string ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.2._ + Retourne la date/heure sous forme de chaîne construite avec "strftime". Prototype : @@ -2571,11 +2708,13 @@ weechat.list_free(list) Hashtables ~~~~~~~~~~ -Hashtable functions. +Fonctions pour les hashtables. weechat_hashtable_new ^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Crée une nouvelle hashtable. Prototype : @@ -2636,6 +2775,8 @@ struct t_hashtable *hashtable = weechat_hashtable_new (8, weechat_hashtable_set_with_size ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Ajoute ou met à jour une entrée dans une hashtable avec une taille pour la clé et la valeur. @@ -2673,6 +2814,8 @@ weechat_hashtable_set_with_size (hashtable, "ma_cle", 0, weechat_hashtable_set ^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Ajoute ou met à jour une entrée dans la hashtable. Prototype : @@ -2703,6 +2846,8 @@ weechat_hashtable_set (hashtable, "ma_cle", "ma_valeur"); weechat_hashtable_get ^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Retourne la valeur associée à une clé dans une hashtable. Prototype : @@ -2731,6 +2876,8 @@ void *value = weechat_hashtable_get (hashtable, "ma_cle"); weechat_hashtable_map ^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Appelle une fonction pour chaque entrée d'une hashtable. Prototype : @@ -2771,6 +2918,8 @@ weechat_hashtable_map (hashtable, &map_cb, NULL); weechat_hashtable_get_integer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Retourne une valeur entière pour une propriété d'une hashtable. Prototype : @@ -2802,6 +2951,8 @@ int items_count = weechat_hashtable_get_integer (hashtable, "items_count"); weechat_hashtable_add_to_infolist ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Ajoute les éléments d'une hashtable dans un objet infolist. Prototype : @@ -2843,6 +2994,8 @@ weechat_hashtable_add_to_infolist (hashtable, infolist_item, "testhash"); weechat_hashtable_remove ^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Supprime un élément d'une hashtable. Prototype : @@ -2867,6 +3020,8 @@ weechat_hashtable_remove (hashtable, "ma_cle"); weechat_hashtable_remove_all ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Supprime tous les éléments d'une hashtable. Prototype : @@ -2890,6 +3045,8 @@ weechat_hashtable_remove_all (hashtable); weechat_hashtable_free ^^^^^^^^^^^^^^^^^^^^^^ +_Nouveau dans la version 0.3.3._ + Supprime une hashtable. Prototype : @@ -3502,6 +3659,55 @@ option = weechat.config_search_option(config_file, section, option_name) option = weechat.config_search_option(config_file, section, "option") ---------------------------------------- +weechat_config_search_section_option +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Recherche une section et une option dans un fichier de configuration ou une +section. + +Prototype : + +[source,C] +---------------------------------------- +void weechat_config_search_section_option (struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, + struct t_config_section **section_found, + struct t_config_option **option_found); +---------------------------------------- + +Paramètres : + +* 'config_file' : pointeur vers le fichier de configuration +* 'section' : pointeur vers la section +* 'option_name' : nom de l'option +* 'section' : pointeur vers un pointeur sur une section, sera alimenté avec le + pointeur vers la section de l'option trouvée +* 'option' : pointeur vers un pointeur sur une option, sera alimenté avec le + pointeur vers l'option trouvée + +Exemple en C : + +[source,C] +---------------------------------------- +struct t_config_section *ptr_section; +struct t_config_option *ptr_option; + +weechat_config_search_section_option (config_file, + section, + "option", + &ptr_section, + &ptr_option); +if (ptr_option) +{ + /* option trouvée */ +} +else +{ + /* option non trouvée */ +} +---------------------------------------- + weechat_config_search_with_string ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index 50df831c3..9f0e2b163 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -601,6 +601,39 @@ Esempio in C: int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */ ---------------------------------------- +weechat_strncasecmp +^^^^^^^^^^^^^^^^^^^ + +Confronta stringa indipendente da caso (maiuscole +o minuscole) e da locale, for 'max' chars. + +Prototipo: + +[source,C] +---------------------------------------- +int weechat_strncasecmp (const char *string1, const char *string2, int max); +---------------------------------------- + +Argomenti: + +* 'string1': prima stringa da comparare +* 'string2': seconda stringa da comparare +* 'max': max chars to compare + +Valore restituito: + +* differenze tra le due stringhe: +** negativa se stringa1 < stringa2 +** zero se stringa1 == stringa1 +** positiva se stringa1 > stringa2 + +Esempio in C: + +[source,C] +---------------------------------------- +int diff = weechat_strncasecmp ("aabb", "aacc", 2); /* == 0 */ +---------------------------------------- + weechat_strcmp_ignore_chars ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -750,6 +783,8 @@ free (str); weechat_string_expand_home ^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Sostituisce la `~` iniziale con la stringa con la cartella home. Se la stringa non inizia con `~`, viene restituita la stessa stringa. @@ -1206,6 +1241,8 @@ str = weechat.string_remove_color(my_string, "?") weechat_string_encode_base64 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.2._ + Codifica una stringa in base64. Prototype: @@ -1234,6 +1271,8 @@ weechat_string_encode_base64 (string, strlen (string), result); weechat_string_decode_base64 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.2._ + Decodifca una stringa in base64. Prototype: @@ -1266,6 +1305,8 @@ length = weechat_string_decode_base64 (string, result); weechat_string_is_command_char ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.2._ + Verifica che il primo carattere della stringa sia un carattere comando (il comando carattere predefinito è '/'). @@ -1308,6 +1349,8 @@ command_char2 = weechat.string_is_command_char("test") # == 0 weechat_string_input_for_buffer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.2._ + Restituisce il puntatore al testo in input per il buffer (puntatore all'interno dell'argomento "string"), oppure NULL se è un comando. @@ -1504,6 +1547,33 @@ Esempio in C: char *next_char = weechat_utf8_next_char (string); ---------------------------------------- +weechat_utf8_char_int +^^^^^^^^^^^^^^^^^^^^^ + +Return UTF-8 char as integer. + +Prototipo: + +[source,C] +---------------------------------------- +int weechat_utf8_char_int (const char *string); +---------------------------------------- + +Argomenti: + +* 'string': stringa + +Valore restituito: + +* UTF-8 char as integer + +Esempio in C: + +[source,C] +---------------------------------------- +int char_int = weechat_utf8_char_int ("être"); /* "ê" as integer */ +---------------------------------------- + weechat_utf8_char_size ^^^^^^^^^^^^^^^^^^^^^^ @@ -1616,6 +1686,37 @@ Esempio in C: int length_on_screen = weechat_utf8_strlen_screen ("é"); /* == 1 */ ---------------------------------------- +weechat_utf8_charcmp +^^^^^^^^^^^^^^^^^^^^ + +Confronta due caratteri UTF-8. + +Prototipo: + +[source,C] +---------------------------------------- +int weechat_utf8_charcmp (const char *string1, const char *string2); +---------------------------------------- + +Argomenti: + +* 'string1': prima stringa da comparare +* 'string2': seconda stringa da comparare + +Valore restituito: + +* differenza tra i primi caratteri di ogni stringa: +** negativa se char1 < char2 +** zero se char1 == char2 +** positivao se char1 > char2 + +Esempio in C: + +[source,C] +---------------------------------------- +int diff = weechat_utf8_charcmp ("aaa", "ccc"); /* == -2 */ +---------------------------------------- + weechat_utf8_charcasecmp ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1960,6 +2061,39 @@ void callback (void *data, const char *filename) weechat_exec_on_files ("/tmp", 0, NULL, &callback); ---------------------------------------- +weechat_file_get_content +^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nuovo nella versione 0.3.1._ + +Get content of text file in a string. + +Prototipo: + +[source,C] +---------------------------------------- +char *weechat_file_get_content (const char *filename); +---------------------------------------- + +Argomenti: + +* 'filename': path and file name + +Valore restituito: + +* content of file as string (must be freed by calling "free" after use) + +Esempio in C: + +[source,C] +---------------------------------------- +char *content; + +content = weechat_file_get_content ("/tmp/test.txt"); +/* ... */ +free (content); +---------------------------------------- + [[util]] Utilità ~~~~~~~ @@ -2054,6 +2188,8 @@ weechat_util_timeval_add (&tv, 2000); /* aggiunge 2 secondi */ weechat_util_get_time_string ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.2._ + Riceve data/ora come stringa compilata con "strftime". Prototipo: @@ -2588,6 +2724,8 @@ Funzioni per le tabelle hash. weechat_hashtable_new ^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Crea una nuova tabella hash. Prototipo: @@ -2647,6 +2785,8 @@ struct t_hashtable *hashtable = weechat_hashtable_new (8, weechat_hashtable_set_with_size ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Aggiunge o aggiorna un elemento nella tabella hash con la dimensione per la chiave ed il valore. @@ -2684,6 +2824,8 @@ weechat_hashtable_set_with_size (hashtable, "my_key", 0, weechat_hashtable_set ^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Aggiunge o aggiorna un elemento nella tabella hash. Prototipo: @@ -2714,6 +2856,8 @@ weechat_hashtable_set (hashtable, "my_key", "my_value"); weechat_hashtable_get ^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Ottiene il valore associato ad una chiave in una tabella hash. Prototipo: @@ -2742,6 +2886,8 @@ void *value = weechat_hashtable_get (hashtable, "my_key"); weechat_hashtable_map ^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Chiama una funzione su tutte le voci della tabella hash. Prototipo: @@ -2782,6 +2928,8 @@ weechat_hashtable_map (hashtable, &map_cb, NULL); weechat_hashtable_get_integer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Restituisce un valore intero per la proprietà di una tabella hash. Prototipo: @@ -2813,6 +2961,8 @@ int items_count = weechat_hashtable_get_integer (hashtable, "items_count"); weechat_hashtable_add_to_infolist ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Aggiunge elementi della tabella hash ad un elemento della lista info. Prototipo: @@ -2854,6 +3004,8 @@ weechat_hashtable_add_to_infolist (hashtable, infolist_item, "testhash"); weechat_hashtable_remove ^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Rimuove un elemento in una tabella hash. Prototipo: @@ -2878,6 +3030,8 @@ weechat_hashtable_remove (hashtable, "my_key"); weechat_hashtable_remove_all ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Rimuove tutti gli elementi in una tabella hash. Prototipo: @@ -2901,6 +3055,8 @@ weechat_hashtable_remove_all (hashtable); weechat_hashtable_free ^^^^^^^^^^^^^^^^^^^^^^ +_Nuovo nella versione 0.3.3._ + Libera una tabella hash. Prototipo: @@ -3502,6 +3658,54 @@ option = weechat.config_search_option(config_file, section, option_name) option = weechat.config_search_option(config_file, section, "option") ---------------------------------------- +weechat_config_search_section_option +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Search a section and an option in a configuration file or section. + +Prototipo: + +[source,C] +---------------------------------------- +void weechat_config_search_section_option (struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, + struct t_config_section **section_found, + struct t_config_option **option_found); +---------------------------------------- + +Arguments: + +* 'config_file': puntatore al file di configurazione +* 'section': puntatore alla sezione +* 'option_name': option name +* 'section_found': puntatore al puntatore della sezione, sarà impostato alla + sezione dell'opzione, se viene trovata +* 'option_found': puntatore al puntatore dell'opzione, sarà impostato al + puntatore di un'opzione, se viene trovata + +Esempio in C: + +[source,C] +---------------------------------------- +struct t_config_section *ptr_section; +struct t_config_option *ptr_option; + +weechat_config_search_section_option(config_file, + section, + "option", + &ptr_section, + &ptr_option); +if (ptr_option) +{ + /* opzione trovata */ +} +else +{ + /* opzione non trovata */ +} +---------------------------------------- + weechat_config_search_with_string ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^