<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nic0&#039;s Sphere</title>
	<atom:link href="http://www.nicosphere.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nicosphere.net</link>
	<description>Blog Linux et Informatique</description>
	<lastBuildDate>Wed, 18 Aug 2010 15:42:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Deux plugins pour weechat, nocolor et counter</title>
		<link>http://www.nicosphere.net/deux-plugins-pour-weechat-nocolor-et-counter-1823/</link>
		<comments>http://www.nicosphere.net/deux-plugins-pour-weechat-nocolor-et-counter-1823/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 15:42:47 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ncurses]]></category>
		<category><![CDATA[tchat]]></category>
		<category><![CDATA[weechat]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1823</guid>
		<description><![CDATA[Nous avons tous notre client IRC fétiche, ne serait-ce que pour suivre les projets Linuxiens favoris. Pour ma part, j&#8217;opte pour un irssi-like, weechat. Un client IRC ncurses disponible très certainement dans les dépôts de toutes les distributions Linuxiennes (c&#8217;est le cas pour Arch Linux est tout cas). J&#8217;ai voulu voir un peu le système [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/?p=1823"><img class="alignleft" src="http://www.nicosphere.net/image/weechat_icon.png" alt="weechat icon Deux plugins pour weechat, nocolor et counter" width="123" height="116" title="Deux plugins pour weechat, nocolor et counter" /></a>Nous avons tous notre client IRC fétiche, ne serait-ce que pour suivre les projets Linuxiens favoris. Pour ma part, j&#8217;opte pour un irssi-like, weechat. Un client IRC ncurses disponible très certainement dans les dépôts de toutes les distributions Linuxiennes (c&#8217;est le cas pour Arch Linux est tout cas).</p>
<p>J&#8217;ai voulu voir un peu le système de plugin proposé par weechat, (à savoir qu&#8217;il supporte beaucoup de langage, tel que perl, ruby, python, lua, tcl) et donc à l&#8217;aide de la documentation fournis sur leur site, créer deux petit scripts sans prétention (loin de là!) mais qui peuvent peut être donner des idées à certain, ou même l&#8217;envie de s&#8217;y plonger.<br />
<span id="more-1823"></span><br />
Pour ce faire, j&#8217;ai choisi python comme langage, surtout parce que leur exemple sont fournis avec python, donc ça était plus rapide, mais le choix est libre à chacun.</p>
<h2>nocolor</h2>
<p>n&#8217;étant pas toujours que sur freenode, certain IRC tolère les couleurs d&#8217;écritures&#8230; ce qui me fait pester à chaque fois, mais comme je vais pas refaire le monde, il est bien plus simple de s&#8217;adapter avec un petit script qui surprime toute forme de couleurs, gras, soulignage des messages. (tout en gardant les join/part avec les couleurs régler dans le script). Aussi curieux que ça puisse paraitre, ce n&#8217;est pas un paramètre de configuration disponible, ou je n&#8217;ai pas trouvé. Voici donc le petit script, sous un classique GPL évidemment.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#   nocolor.py</span>
<span style="color: #808080; font-style: italic;">#   Author nicolas </span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> weechat
&nbsp;
SCRIPT_NAME     = <span style="color: #483d8b;">&quot;nocolor&quot;</span>
SCRIPT_AUTHOR   = <span style="color: #483d8b;">&quot;nicolas &quot;</span>
SCRIPT_VERSION  = <span style="color: #483d8b;">&quot;0.1&quot;</span>
SCRIPT_LICENCE  = <span style="color: #483d8b;">&quot;GPL3&quot;</span>
SCRIPT_DESC     = <span style="color: #483d8b;">&quot;delet user's color&quot;</span>
&nbsp;
weechat.<span style="color: black;">register</span><span style="color: black;">&#40;</span>SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                 SCRIPT_LICENCE, SCRIPT_DESC, <span style="color: #483d8b;">&quot;&quot;</span>, <span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> nocolor_cb<span style="color: black;">&#40;</span>data, modifier, modifier_data, <span style="color: #dc143c;">string</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #483d8b;">&quot;privmsg&quot;</span> <span style="color: #ff7700;font-weight:bold;">in</span> modifier_data:
        strnocolor = weechat.<span style="color: black;">string_remove_color</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">string</span>, <span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> strnocolor
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">string</span>
&nbsp;
hook = weechat.<span style="color: black;">hook_modifier</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;weechat_print&quot;</span>, <span style="color: #483d8b;">&quot;nocolor_cb&quot;</span>, <span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Pas de quoi casser trois pattes à un canard me diriez vous, et vous avez bien raison !<br />
Pour la petite explication, un hook est placer pour modifier la ligne imprimé grâce à un callback (nocolor_cb), et une fonction existante sous weechat permet de supprimer la couleur. Il faut juste noté que la fonction weechat.register n&#8217;est pas une coquetterie de ma part, mais une fonction obligatoire pour tout script. Simple, mais cela fait son effect. Le fichier est placer dans ~/.weechat/python/autoload/nocolor.py et peut être loader à chaud par un /python load nocolor.py dans le client IRC.</p>
<h2>counter</h2>
<p>Autre script, le but est de compter les kicks et glines, stocker se compte dans un fichier ~/.weechat/python/count.var (créer s&#8217;il n&#8217;existe pas) pour que le compte soit récupérer d&#8217;une fois sur l&#8217;autre, le compte est affiché directement dans la raison du kick/gline, sous la forme « raison du kick (n°N) ».<br />
Encore une fois, rien de bien compliqué.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># -*- coding: utf-8 -*-</span>
<span style="color: #808080; font-style: italic;">#   count.py</span>
<span style="color: #808080; font-style: italic;">#   Author nicolas </span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> weechat
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">ConfigParser</span>
&nbsp;
SCRIPT_NAME     = <span style="color: #483d8b;">&quot;count&quot;</span>
SCRIPT_AUTHOR   = <span style="color: #483d8b;">&quot;nicolas &quot;</span>
SCRIPT_VERSION  = <span style="color: #483d8b;">&quot;0.1&quot;</span>
SCRIPT_LICENCE  = <span style="color: #483d8b;">&quot;GPL3&quot;</span>
SCRIPT_DESC     = <span style="color: #483d8b;">&quot;kick and gline counter&quot;</span>
&nbsp;
weechat.<span style="color: black;">register</span><span style="color: black;">&#40;</span>SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                 SCRIPT_LICENCE, SCRIPT_DESC, <span style="color: #483d8b;">&quot;&quot;</span>, <span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
home = <span style="color: #dc143c;">os</span>.<span style="color: black;">environ</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'HOME'</span><span style="color: black;">&#93;</span>
path = home + <span style="color: #483d8b;">&quot;/.weechat/python/&quot;</span>
var = <span style="color: #dc143c;">ConfigParser</span>.<span style="color: black;">RawConfigParser</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">isdir</span><span style="color: black;">&#40;</span>path<span style="color: black;">&#41;</span>:
    <span style="color: #dc143c;">os</span>.<span style="color: black;">chdir</span><span style="color: black;">&#40;</span>path<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">isfile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count.var'</span><span style="color: black;">&#41;</span>:
    var.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count.var'</span><span style="color: black;">&#41;</span>
    kick = var.<span style="color: black;">getint</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count'</span>, <span style="color: #483d8b;">'kick'</span><span style="color: black;">&#41;</span>
    gline = var.<span style="color: black;">getint</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count'</span>, <span style="color: #483d8b;">'gline'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">else</span>:
    var.<span style="color: black;">add_section</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count'</span><span style="color: black;">&#41;</span>
    kick = <span style="color: #ff4500;">0</span>
    gline = <span style="color: #ff4500;">0</span>
    var.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count'</span>, <span style="color: #483d8b;">'kick'</span>, kick<span style="color: black;">&#41;</span>
    var.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count'</span>, <span style="color: #483d8b;">'gline'</span>, gline<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">with</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count.var'</span>, <span style="color: #483d8b;">'wb'</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">as</span> configfile:
        var.<span style="color: black;">write</span><span style="color: black;">&#40;</span>configfile<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> kick_cb<span style="color: black;">&#40;</span>data, modifier, modifier_data, <span style="color: #dc143c;">string</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">global</span> kick
    kick +=<span style="color: #ff4500;">1</span>
    var.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count'</span>, <span style="color: #483d8b;">'kick'</span>, kick<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">with</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count.var'</span>, <span style="color: #483d8b;">'wb'</span><span style="color: black;">&#41;</span><span style="color: #ff7700;font-weight:bold;">as</span> configfile:
        var.<span style="color: black;">write</span><span style="color: black;">&#40;</span>configfile<span style="color: black;">&#41;</span>
    <span style="color: #dc143c;">string</span> = <span style="color: #483d8b;">&quot;%s (n°%s)&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span><span style="color: #dc143c;">string</span>, kick<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">string</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> gline_cb<span style="color: black;">&#40;</span>data, modifier, modifier_data, <span style="color: #dc143c;">string</span><span style="color: black;">&#41;</span>:
    weechat.<span style="color: black;">prnt</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;</span>, modifier_data<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">global</span> gline
    gline +=<span style="color: #ff4500;">1</span>
    var.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count'</span>, <span style="color: #483d8b;">'gline'</span>, gline<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">with</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'count.var'</span>, <span style="color: #483d8b;">'wb'</span><span style="color: black;">&#41;</span><span style="color: #ff7700;font-weight:bold;">as</span> configfile:
        var.<span style="color: black;">write</span><span style="color: black;">&#40;</span>configfile<span style="color: black;">&#41;</span>
    <span style="color: #dc143c;">string</span> = <span style="color: #483d8b;">&quot;%s (n°%s)&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span><span style="color: #dc143c;">string</span>, gline<span style="color: black;">&#41;</span>
    weechat.<span style="color: black;">prnt</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;</span>, <span style="color: #dc143c;">string</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">string</span>
&nbsp;
hook_kick = weechat.<span style="color: black;">hook_modifier</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;irc_out_kick&quot;</span>, <span style="color: #483d8b;">&quot;kick_cb&quot;</span>, <span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span>
hook_gline = weechat.<span style="color: black;">hook_modifier</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;irc_out_gline&quot;</span>, <span style="color: #483d8b;">&quot;gline_cb&quot;</span>, <span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Pour la petite explication, la 1èr moitié concerne le fichier de count.var, voir s&#8217;il existe, sinon il est créer grâce à ConfigParser. Ici sont défini deux callback non plus sur le print, mais sur la commande directement (kick, gline) pour avoir le callback correspondant.</p>
<h3>Conclusion</h3>
<p>C&#8217;est sans prétention, que je partage ces deux « plugin » pour weechat, qui ne serviront peut être à personne, mais, qui sait, peuvent aider pour l&#8217;élaboration d&#8217;autre extensions. (heureusement que le ridicule ne tue pas, j&#8217;ai un peu l&#8217;air ridicule avec ces deux scripts à deux balles :þ)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/deux-plugins-pour-weechat-nocolor-et-counter-1823/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Première bougie du blog soufflé</title>
		<link>http://www.nicosphere.net/premiere-bougie-du-blog-souffle-1813/</link>
		<comments>http://www.nicosphere.net/premiere-bougie-du-blog-souffle-1813/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 18:32:20 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[bavardage]]></category>
		<category><![CDATA[actualité]]></category>
		<category><![CDATA[nicosphere]]></category>
		<category><![CDATA[vie du blog]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1813</guid>
		<description><![CDATA[Nous y voilà, la première bougie de ce blogue soufflé, avec quelques jours de retard tout de même, puisque le tout premier article date du 6 aout 2009 ! Une occasion pour moi d&#8217;une part, de revenir sur ce qui a été fait ici, et également de faire un petit point sur l&#8217;avenir du blog. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/premiere-bougie-souffle-1813/"><img class="alignleft" src="http://www.nicosphere.net/image/champagne.png" alt="champagne Première bougie du blog soufflé" width="127" height="121" title="Première bougie du blog soufflé" /></a>Nous y voilà, la première bougie de ce blogue soufflé, avec quelques jours de retard tout de même, puisque le tout premier article date du 6 aout 2009 ! Une occasion pour moi d&#8217;une part, de revenir sur ce qui a été fait ici, et également de faire un petit point sur l&#8217;avenir du blog.</p>
<p>Mais avant d&#8217;aller plus loin, je tiens d&#8217;ores et déjà à remercier toutes les personnes qui m&#8217;ont soutenu et lu, au long de divers articles.<br />
<span id="more-1813"></span><br />
Le premier constat que je peux faire, c&#8217;est je pense avoir tenu même ligne, c&#8217;est à dire un mélange d&#8217;actualité linuxienne pouvant être plus insolite ou anecdotique pour paraitre dans les grands médias spécialisé sur le domaine tout en gardant une spécialité pour Arch Linux, ainsi que des tutoriels et pense bêtes, et comme je l&#8217;avais prévenu, un peu de programmation, le tout je pense sans tomber dans des travers de sensationnalisme qu&#8217;on peut trouver dans certains blogs sur Linux à plus grand trafic. Je ne voulais pas faire des billets d&#8217;humeur ou bien même sur des sujets tels que Hadopi, de toute façon bien d&#8217;autres personnes s&#8217;en s&#8217;ont charger au travers du net (parfois même un peu trop je trouve).</p>
<p>Autre point sur lequel je suis content, c&#8217;est mon français, et plus particulièrement mon orthographe. Bien que je fasse encore énormément de fautes, je pense avoir progresser, et cela grâce à l&#8217;écriture sur le blogue. Il y avait un énorme travail à faire sur ce point là, et le chemin est encore long, mais je m&#8217;implique pour faire moins de fautes, et apprendre les règles simples du français.</p>
<p>Vous n&#8217;aurez pas manqué de remarquer une baisse dans la parution des articles, et c&#8217;est un fait. D&#8217;une part cela prend du temps, tout en demandant une certaine dose de patience et de courage. Je regrette de ne pas publier plus souvent, et je ne compte pas laisser de côté ce blogue. sachant que certain article demande du temps à rédiger, pour regrouper la documentation, mettre en page et tout ça…</p>
<p>Quelques chiffres traditionnel de circonstance pour Nic0&#8242;s Sphere :</p>
<ul>
<li>127 Articles</li>
<li>254 Commentaires</li>
<li>Entre 100 et 200 visites par jour dépendant un peu de l&#8217;activité du blog</li>
</ul>
<p>Certains trouveront ces chiffres très dérisoire, surtout pour les blogues à gros trafic, mais pour sûr je prends plaisir à le faire, et c&#8217;est ce qui compte, sujet après sujet.</p>
<p>En dernier point, j&#8217;aimerai remercier une fois encore ceux aillant soutenu, lu ou même contribuer de près ou de loin à ce blog. Et j&#8217;espère sincèrement publier un peu plus prochainement.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/premiere-bougie-du-blog-souffle-1813/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>L&#8217;avenir de l&#8217;Arch Linux Magazine</title>
		<link>http://www.nicosphere.net/lavenir-de-larch-linux-magazine-1805/</link>
		<comments>http://www.nicosphere.net/lavenir-de-larch-linux-magazine-1805/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 14:41:08 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[magazine]]></category>
		<category><![CDATA[archlinux]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1805</guid>
		<description><![CDATA[Comme certain n&#8217;auront pas manquer de remarquer, L&#8217;Arch Linux Magazine n&#8217;est pas paru depuis avril 2010, laissant ainsi un petit trou dans le rythme de parution. Une baisse de parution que Ghost1227, l&#8217;auteur de l&#8217;ALM explique sur ce topic du forum d&#8217;Archlinux.org. Explication que je me permet de traduire ici pour qui l&#8217;anglais rebute un [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/lavenir-de-larch-linux-magazine-1805/"><img class="alignleft" src="http://www.nicosphere.net/image/arch.png" alt="archlinux" width="130" height="130" title="Lavenir de lArch Linux Magazine" /></a>Comme certain n&#8217;auront pas manquer de remarquer, L&#8217;Arch Linux Magazine n&#8217;est pas paru depuis avril 2010, laissant ainsi un petit trou dans le rythme de parution. Une baisse de parution que Ghost1227, l&#8217;auteur de l&#8217;ALM explique sur <a href="http://bbs.archlinux.org/viewtopic.php?id=100336">ce topic</a> du forum d&#8217;Archlinux.org.</p>
<p>Explication que je me permet de traduire ici pour qui l&#8217;anglais rebute un peu.<br />
<span id="more-1805"></span></p>
<blockquote><p>Récemment, On m&#8217;a demandé souvent pourquoi il n&#8217;y a pas eu de magazine ces deux derniers mois. Je pense que je vous doit une explication. Nous avions programmé un numéro spécial le mois dernier, mais les personnes avec que je travaillais on lâché au dernier moment, et je me suis retrouvé sans contenu. C&#8217;est arrivé souvent ces derniers temps, et je dois admettre que j&#8217;en ai un peu mare de ça. Comme je l&#8217;ai déjà dit souvent dans le passé, monter le magazine (et même l&#8217;ancienne newsletter) demande du travail et du temps, pour plus d&#8217;une personne. Toute fois, malgré mes appels constants à la contribution, je n&#8217;ai toujours pas plus d&#8217;une ou deux soumission par mois. J&#8217;ai fait tout ce que j&#8217;ai pu pour en facilité la communauté et rendre le processus plus facile. (jeter un œil sur la page de wiki de l&#8217;ALM par exemple), mais les retours ne sont pas loin d&#8217;être nul. Et encore, on me demande constamment quand sera la prochaine sortie, ou pourquoi j&#8217;ai manqué un mois. Si la moitié des personnes qui m&#8217;ont demandé à propos de la prochaine sortie du magazine avait mis un peu de leur temps à écrire un court article, et bien peut être que le prochain magazine serait déjà sortie. Mais la vérité, c&#8217;est que je n&#8217;ai juste pas le temps d&#8217;écrire la totalité du magazine moi même tout les mois. Donc&#8230; à partir de maintenant, le magazine sera sortie se fera au rythme des contributions, aussi souvent que j&#8217;ai de quoi sortir un numéro. Je me restreindrai à écrire un article par numéro si besoin, en plus des sections habituelle, (devland, interviews, software&#8230;) et je laisse le reste au soins de la communauté. En d&#8217;autre termes, à tout ceux qui continu de me demander ce que devient l&#8217;ALM… si vous voulez le voir, contribuez !<br />
&#8211; Ghost1227</p></blockquote>
<p>À bon entendeur… et comme toujours, si vous souhaitez participer au magazine, il suffit de suivre les démarches décritent sur <a href="http://wiki.archlinux.org/index.php/Arch_Linux_Magazine">cette page de wiki</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/lavenir-de-larch-linux-magazine-1805/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sauvegarde automatisée des bases MySQL</title>
		<link>http://www.nicosphere.net/sauvegarde-automatise-des-bases-mysql-1795/</link>
		<comments>http://www.nicosphere.net/sauvegarde-automatise-des-bases-mysql-1795/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 15:29:48 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[astuces]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sauvegarde]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1795</guid>
		<description><![CDATA[S&#8217;il y a bien deux choses à faire avec un ordinateur ou un serveur, c&#8217;est les sauvegardes, et l&#8217;automatisation. Et bien sûr, autant combiner les deux pour automatiser les sauvegardes. Les sauvegardes de bases SQL ne déroge pas à cette règle, que ce soit sur un PC personnel, ou sur un serveur, il est toujours [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/sauvegarde-automatise-des-bases-mysql-1795/"><img class="alignleft" src="http://www.nicosphere.net/image/mysql.jpg" alt="mysql Sauvegarde automatisée des bases MySQL" width="130" height="147" title="Sauvegarde automatisée des bases MySQL" /></a>S&#8217;il y a bien deux choses à faire avec un ordinateur ou un serveur, c&#8217;est les sauvegardes, et l&#8217;automatisation. Et bien sûr, autant combiner les deux pour automatiser les sauvegardes.</p>
<p>Les sauvegardes de bases SQL ne déroge pas à cette règle, que ce soit sur un PC personnel, ou sur un serveur, il est toujours important de faire des sauvegardes, et comme on n&#8217;a pas forcément envie de se connecter au phpmyadmin à chaque fois pour le faire (ça serait fait une fois dans le moi de cet sorte :þ), voici une petite astuce très simple à mettre en place.<br />
<span id="more-1795"></span></p>
<p>Si comme moi, vous aimez bien séparer les bases, en créant un user spécifique pour une application donnée, pour réduire l&#8217;utilisation de l&#8217;user root sur les bases, le petit script suivant devrait faire votre affaire. Il vous permet également d&#8217;obtenir les différentes sauvegardes dans des fichiers propre à chaque user. La syntaxe est très simple, sans avoir besoin d&#8217;explication.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
mysqldump <span style="color: #660033;">-uwordpress</span> <span style="color: #660033;">-pmonpass</span> <span style="color: #660033;">--all-databases</span> <span style="color: #000000; font-weight: bold;">&gt;</span> backup.wp.sql
mysqldump <span style="color: #660033;">-uforum</span> <span style="color: #660033;">-pmonpassquitu</span> <span style="color: #660033;">--all-databases</span> <span style="color: #000000; font-weight: bold;">&gt;</span> forum_back.sql</pre></div></div>

<p>Autant dire un jeu d&#8217;enfant !<br />
Avec bien sûr en argument :</p>
<ul>
<li>-u : user de la base à sauvegarder.</li>
<li>-p : pass correspondant à l&#8217;user.</li>
</ul>
<p>Il vous reste à rendre exécutable se script, et d&#8217;en restreindre l&#8217;accès comme tout fichier sensible, avec un chmod 700.</p>
<p>Pour l&#8217;automatiser le tout, un petit cron (tout simple avec la fréquence d&#8217;exécution voulu), et là encore pas besoin de plus d&#8217;explication pour se faire, sinon, des tutoriels sont disponible facilement là dessus.<br />
On pourrait amélioré le script en faisant des logs tournante sur plusieurs jours, car là, elle sont automatiquement effacé.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/sauvegarde-automatise-des-bases-mysql-1795/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux accessible au premier venu</title>
		<link>http://www.nicosphere.net/linux-accessible-au-premier-venu-1788/</link>
		<comments>http://www.nicosphere.net/linux-accessible-au-premier-venu-1788/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 11:44:33 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[bavardage]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[débutant]]></category>
		<category><![CDATA[logiciel]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1788</guid>
		<description><![CDATA[L&#8217;évolution au sein de Linux, ou plus précisément au sein des différentes distribution Linux est constante. À ses premières heures, Linux était réservé aux connaisseurs, informaticiens et geeks en tout genres. Pour sûr les choses on évolué de tel sorte que maintenant, n&#8217;importe qui peut utiliser et installer une distribution Linux, sans risques. Plus besoin [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/linux-accessible-au-premier-venu-1788/"><img class="alignleft" src="http://www.nicosphere.net/image/linux.jpeg" alt=" Linux accessible au premier venu" width="130" height="150" title="Linux accessible au premier venu" /></a>L&#8217;évolution au sein de Linux, ou plus précisément au sein des différentes distribution Linux est constante. À ses premières heures, Linux était réservé aux connaisseurs, informaticiens et geeks en tout genres.</p>
<p>Pour sûr les choses on évolué de tel sorte que maintenant, n&#8217;importe qui peut utiliser et installer une distribution Linux, sans risques. Plus besoin de connaissances pour installer, utiliser, administrer Linux.<br />
<span id="more-1788"></span><br />
Comme les réputations sont toujours tenaces, Linux reste dans les esprits des non-initiés comme quelque chose de compliqué, fastidieux et/ou non-aboutit. <span style="text-decoration: underline;">Linux accessible pour tous est maintenant devenu une réalité</span>, il suffit de lire quelques débats enflammés pour s&#8217;en convaincre. Paradoxal parfois même le fait de promouvoir l&#8217;esprit des Logiciels Libres au plus grand nombre, et d&#8217;un autre côté décrier les pratiques de distributions dites grand public à rendre accessible leurs produits. Cette évolution n&#8217;est pas sans diviser les opinions de la communauté, à savoir si c&#8217;est bien d&#8217;automatiser les installations, configurations, et l&#8217;administration. Mais que cela en déplaise certain, l&#8217;évolution va vers une vulgarisation de Linux. Il ne devient pas rare de lire des réflexions du genre « même ma grand-mère utilise Linux maintenant », (non pas sans un petit coup de main des petits enfants certainement). On peut souligner les installeurs automatiques rendant l&#8217;installation de Linux accessible à quelques clicks près, le tout cohabitant simplement avec Windows en dual-boot.</p>
<p>Une des grandes force de Linux est sa diversité, si tel ou tel chose ne te plaît pas sur ton PC, pas de problème tu peux prendre autre chose, c&#8217;est vrai pour les logiciels, mais aussi pour les distributions elle-même, on en dénombre une quantité impressionnante, mais ça en fait aussi sa faiblesse, comme les discussions enflammé du pourquoi tel ou tel distribution est meilleur ou je ne sais quoi encore, me faisant pensé à un titre d&#8217;un article de je ne sais plus quel site (ça pourrait être phoronix tient) stipulant : « Et si le premier danger de Linux venait de sa communauté elle-même ». Ça peut en faire une faiblesse aussi dans le sens qu&#8217;a trop diversifier, à forker à tout va, ou réécrire des applications déjà existante dans d&#8217;autre langages, pour apporté au final pas grand chose si ce n&#8217;est une division du potentiel des programmeurs, et des exemple de cela il y en a à la pelle…</p>
<p>Linux est un peu un cas unique dans les système d&#8217;exploitation Libre, que se soit chez *BSD ou Solaris, il n&#8217;y a pas des centaine de distributions, et ne fait certainement pas débats aussi virulents au sein de leur communauté.</p>
<p>Il serait difficile de parler de distributions grand public sans nommer Ubuntu et dérivée. Pour beaucoup, ce sera la distribution de transition d&#8217;un système propriétaire vers Linux, mais ce n&#8217;est pas la seul possibilité, pour ne citer que PCLinuxOS par exemple, mais beaucoup choisiront Ubuntu, peut être plus pour sa notoriété et sa communauté (documentation et forums) que pour des raisons vraiment techniques. Il peut être parfois difficile de parler d&#8217;Ubuntu sans tomber dans les travers cité plus haut, à savoir ne pas tomber dans des discussions polémiques et sans fin, du bien ou du mal des choix de directions prisent d&#8217;Ubuntu/Canonical.</p>
<p>En conclusion, (d&#8217;un bavardage s&#8217;éloignant un peu du titre), oui Linux devient accessible à tout le monde, et l&#8217;évolution ira dans ce sens inévitablement, expliquant peut être la croissance du nombre d&#8217;utilisateurs sous GNU/Linux, et oui les conflits au sein même de Linux n&#8217;est pas près de s&#8217;arrêter !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/linux-accessible-au-premier-venu-1788/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Twitturse, un client ncurses écrit en C pour twitter (suite)</title>
		<link>http://www.nicosphere.net/twitturse-un-client-ncurses-ecrit-en-c-pour-twitter-suite-1776/</link>
		<comments>http://www.nicosphere.net/twitturse-un-client-ncurses-ecrit-en-c-pour-twitter-suite-1776/#comments</comments>
		<pubDate>Sat, 22 May 2010 19:30:40 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[logiciel]]></category>
		<category><![CDATA[langage C]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ncurses]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[twitturse]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1776</guid>
		<description><![CDATA[Dans le billet précédent, je fais une présentation de mon petit projet, un client ncurses pour twitter dans une console Linux. Comme il est toujours plaisant d&#8217;en avoir un retour, et que en plus quelques demandes de nouvelles fonctionnalités ont été faites, j&#8217;ai réouvert mon IDE favoris (vim :þ) pour apporté ces nouvelles fonctionnalités. Un [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/twitturse-un-client-ncurses-ecrit-en-c-pour-twitter-suite-1776/"><img class="alignleft" src="http://www.nicosphere.net/image/twitter2.png" alt="twitter2 Twitturse, un client ncurses écrit en C pour twitter (suite)" width="130" height="130" title="Twitturse, un client ncurses écrit en C pour twitter (suite)" /></a>Dans le billet précédent, je fais une présentation de mon petit projet, un client ncurses pour twitter dans une console Linux.</p>
<p>Comme il est toujours plaisant d&#8217;en avoir un retour, et que en plus quelques demandes de nouvelles fonctionnalités ont été faites, j&#8217;ai réouvert mon IDE favoris (vim :þ) pour apporté ces nouvelles fonctionnalités.<br />
<span id="more-1776"></span><br />
Un merci à <a href="http://twitter.com/bacardi555">bacardi55</a> et <a href="http://twitter.com/hobbestigrou">hobbestigrou</a> pour avoir essayé Twitturse, pour leur retour, et leur soutient au projet.</p>
<p>Pour cette version 0.1.1, quelques nouveautés (ça reste une béta je suppose, bien que je ne l&#8217;ai pas indiqué…)</p>
<ul>
<li>(c)lear : permet d&#8217;effacer tout les tweets, en ne gardant que le dernier ;</li>
<li>(f)ollow et (u)nfollow : permet de suivre ou laisser une personne ;</li>
<li>(h)elp : en cas de trou de mémoire, une petite page résument les touches s&#8217;affiche ;</li>
<li>Lorsqu&#8217;une petite fenêtre est ouverte (pour écrire un tweet pas exemple) elle ne se trouve plus effacé au bout d&#8217;un moment, le rafraîchissement des status est bloqué ;</li>
<li>Lorsque les status son rafraichit, il ne sélectionne plus le dernier, mais reste sur celui sélectionné ;</li>
<li>Le temps de rafraîchissement des status est parsé à partir du fichier de configuration, s&#8217;il n&#8217;est pas indiqué, il sera par défaut à 60 secondes ;</li>
<li>Et je crois que c&#8217;est tout, c&#8217;est déjà pas mal :)</li>
</ul>
<p>Pour un aperçu, avec screenshots, regarder <a href="http://www.nicosphere.net/twitturse-un-client-ncurses-ecrit-en-c-pour-twitter-1765/">le billet précédent</a>.</p>
<p>L&#8217;installation n&#8217;a pas beaucoup changer par rapport à la dernière fois :</p>
<p><code>wget http://src.nicosphere.net/twitturse/twitturse-0.1.1.tar.bz2<br />
tar xvf twitturse-0.1.1.tar.bz2<br />
cd twitturse<br />
./configure --prefix=/usr<br />
make<br />
sudo make install</code></p>
<p>Ainsi qu&#8217;un petit changement dans le fichier de configuration, .twitturserc dans la racine du home :<br />
<code>login "pseudotwitter"<br />
passwd "mot_de_pass_twitter"<br />
refresh "60"</code><br />
Mais il reste compatible avec l&#8217;ancienne version puisque refresh n&#8217;est pas obligatoire.</p>
<p>Voilà, je crois que tout est dit pour cette nouvelle version de Twitturse, bon tweets à tous !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/twitturse-un-client-ncurses-ecrit-en-c-pour-twitter-suite-1776/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Twitturse, un client ncurses écrit en C pour twitter</title>
		<link>http://www.nicosphere.net/twitturse-un-client-ncurses-ecrit-en-c-pour-twitter-1765/</link>
		<comments>http://www.nicosphere.net/twitturse-un-client-ncurses-ecrit-en-c-pour-twitter-1765/#comments</comments>
		<pubDate>Thu, 20 May 2010 12:27:39 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[logiciel]]></category>
		<category><![CDATA[programmation]]></category>
		<category><![CDATA[langage C]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ncurses]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[twitturse]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1765</guid>
		<description><![CDATA[Comme beaucoup de mes applications informatique sont en console, mon client twitter n&#8217;a pas échappé à cette règle. J&#8217;ai utilisé pendant quelques temps TTYter, que je conseil pour les amateurs de consoles, écrit en perl, dont j&#8217;en consacre un billet ici. Mais rapidement on vient à en regretter qu&#8217;il ne fait pas un usage d&#8217;une [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/twitturse-un-client-ncurses-ecrit-en-c-pour-twitter-1765/"><img class="alignleft" src="http://www.nicosphere.net/image/twitter2.png" alt="twitter2 Twitturse, un client ncurses écrit en C pour twitter" width="130" height="130" title="Twitturse, un client ncurses écrit en C pour twitter" /></a>Comme beaucoup de mes applications informatique sont en console, mon client twitter n&#8217;a pas échappé à cette règle. J&#8217;ai utilisé pendant quelques temps TTYter, que je conseil pour les amateurs de consoles, écrit en perl, dont j&#8217;en consacre </a><a href="http://www.nicosphere.net/ttytter-le-client-pour-twitter-en-console-1668/">un billet ici</a>.</p>
<p>Mais rapidement on vient à en regretter qu&#8217;il ne fait pas un usage d&#8217;une bibliothèque ncurses, utilisant ainsi de façon optimisé l&#8217;espace disponible dans la console, ainsi qu&#8217;une meilleur édition des tweets.<br />
<span id="more-1765"></span><br />
Lorsque je me suis mis à twitter, je me suis mis quasiment aussitôt à la recherche d&#8217;un client ncurses, et ne trouvant pas, je m&#8217;était donc « rabattu » sur TTYter.</p>
<p><em><strong>ÉDIT:</strong> Une nouvelle version avec plus de fonctionnalité est disponible, <a href="http://www.nicosphere.net/twitturse-un-client-ncurses-ecrit-en-c-pour-twitter-suite-1776/">lire ce billet </a>pour plus de détails.</em></p>
<p>Dans l&#8217;optique d&#8217;apprentissage du langage C, rien de tel que la pratique. Je me suis mis en tête, l&#8217;idée de faire un client twitter ncurses, pour le moment vraiment très basique, le tout écrit en langage C (avec les bibliothèque ncurses, curl et libxml2). Et comme je commence à obtenir quelque chose d&#8217;un peu près fonctionnel, non pas sans (nombreux) bugs ! Je me lance à présenter ce petit projet sans grande prétention à qui veut y jeter un œil, le tout sous une licence on ne peut plus classique, la GPLv3. Pour son nom, Twitturse, ben… heu… j&#8217;avoue que je ne l&#8217;ai pas trouvé dans un moment de créativité débordante.</p>
<p>Twitturse n&#8217;utilise que peu de dépendance, et des classiques qui sont certainement déjà installer sur votre PC,</p>
<ul>
<li>ncurses : installer par défaut sur quasiment tout les système UNIX.</li>
<li>curl &amp; libxml2: disponible tout les deux dans [extra] sur Arch Linux, mais sûrement déjà installer sur votre système tellement elles sont courantes.</li>
</ul>
<h3>Les fonctionnalités</h3>
<p>Elles sont relativement réduite, mais pour moi qui ne suit pas un gros utilisateur de Twitter, ça me suffit pour un usage quotidien, oui oui, je l&#8217;utilise. En gros vous obtenez une liste de tweets navigable. Vous pouvez soit obtenir plus de détail sur le tweet sélectionné, pour le moment pas vraiment plus de détail que ça, mais par la suite j&#8217;en mettrais plus (avec espace ou entrer), soit le retweeter (avec la touche &#8216;r&#8217;). Et bien sûr vous pouvez envoyer un tweet.<br />
Voilà en gros les trois fonctions : envoyer un tweet, retweeter, voir les détails d&#8217;un tweet.<br />
Alors bien sûr, ça ne va pas loin, pas de système de recherches poussé, même pas le moyen de suivre une personne, si le courage m&#8217;en prends et qu&#8217;il n&#8217;y ait pas trop de bugs dans ce qui est déjà en place, je pourrais par la suite implémenté plus de fonctions.<br />
Mais dans l&#8217;immédiat, twitturse me permet de suivre tranquillement mes tweets quand même.</p>
<p>Voici les traditionnels screenshots pour donner une idée de ce qu&#8217;est Twitturse :</p>
<div class="wp-caption aligncenter" style="width: 610px"><img src="http://www.nicosphere.net/image/twitturse.png" alt="twitturse Twitturse, un client ncurses écrit en C pour twitter" width="600" height="1027" title="Twitturse, un client ncurses écrit en C pour twitter" /><p class="wp-caption-text">Screenshot de Twitturse</p></div>
<h3>Installation et Usage</h3>
<p>Je n&#8217;ai pas mis de paquet disponible sur AUR pour les Archers, car, bien que ce ne soit pas difficile je n&#8217;ai pas voulu encombrer AUR avec une version qui reste encore expérimental. Par la suite, si jamais j&#8217;obtiens quelque chose de pas trop buggé pourquoi pas le mettre sur AUR effectivement pour une installation encore plus facile. Cependant, l&#8217;installation n&#8217;est pas des plus compliqué, il suffit de suivre cette démarche : (et libre à vous de l&#8217;installer avec un PKGBUILD de votre convenance)<br />
<code>wget http://src.nicosphere.net/twitturse/twitturse-0.1.0-beta.tar.bz2<br />
tar xvf twitturse-0.1.0-beta.tar.bz2<br />
cd twitturse<br />
./configure --prefix=/usr<br />
make<br />
sudo make install</code></p>
<p>Pour fonctionner veuillez mettre dans la racine de votre home .twitturserc contenant les indications suivante:<br />
<code>login "pseudotwitter"<br />
passwd "mot_de_pass_twitter"</code><br />
Ce devrait être suffisant pour fonctionner.</p>
<p>À partir de là :</p>
<ul>
<li>Enter ou Espace : voir le tweet courant.</li>
<li>t : permet d&#8217;écrire un tweet (echape pour annuler).</li>
<li>r : retweet le tweet courant.</li>
</ul>
<p>Pour les désagréments et bugs connu, parfois l&#8217;affichage au lancement ne se fait pas correctement (pas souvent cela dit, et juste le fait de relancer peut arranger cela), l&#8217;application par en segfault si la connexion internet est coupé (pas encore de gestion de timeout avec curl), et un soucis d&#8217;affichage pendant une petite seconde lors de l&#8217;envoi d&#8217;un (re)tweet. Je vais essayé d&#8217;arranger tout cela si possible dans une version futur.</p>
<p>Un dernier petit mot pour ceux suivant ce blog, et qui n&#8217;auront pas manqué de remarqué un ralentissement dans le rythme de parution de billet, et il est vrai que ces derniers temps, j&#8217;ai écris plus de lignes de C que des lignes sur mon blog, non pas que l&#8217;envie sois partie, mais le temps consacré à la programmation est juste plus importante. Je vais quand même essayer de refaire des parutions plus fréquente prochainement.</p>
<p>Bon tweets à tous.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/twitturse-un-client-ncurses-ecrit-en-c-pour-twitter-1765/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Exemple de file avec deux pointeurs en langage C</title>
		<link>http://www.nicosphere.net/exemple-de-file-avec-deux-pointeurs-en-langage-c-1752/</link>
		<comments>http://www.nicosphere.net/exemple-de-file-avec-deux-pointeurs-en-langage-c-1752/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 11:28:48 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[programmation]]></category>
		<category><![CDATA[tutoriel]]></category>
		<category><![CDATA[débutant]]></category>
		<category><![CDATA[langage C]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1752</guid>
		<description><![CDATA[Voici un petit exemple de file en langage C, dont la file est défini par deux pointeurs, l&#8217;un pour le début et l&#8217;autre pour la fin de file, ainsi qu&#8217;un compteur d&#8217;élément. L&#8217;avantage, c&#8217;est de ne pas avoir besoin de parcourir la file pour toutes actions dessus, et également utile lorsqu&#8217;une application peut demander indépendamment [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/exemple-de-file-avec-deux-pointeurs-en-langage-c-1752"><img class="alignleft" src="http://www.nicosphere.net/image/c.jpg" alt="langage_c" width="130" height="114" title="Exemple de file avec deux pointeurs en langage C" /></a>Voici un petit exemple de file en langage C, dont la file est défini par deux pointeurs, l&#8217;un pour le début et l&#8217;autre pour la fin de file, ainsi qu&#8217;un compteur d&#8217;élément.</p>
<p>L&#8217;avantage, c&#8217;est de ne pas avoir besoin de parcourir la file pour toutes actions dessus, et également utile lorsqu&#8217;une application peut demander indépendamment de filer ou défiler.<br />
<span id="more-1752"></span><br />
<em><strong>EDIT</strong> Après en avoir discuté, le code ci dessous n&#8217;est pas totalement fonctionnel dans l&#8217;état,  et c&#8217;est vrai qu&#8217;il ne libère pas la mémoire comme il devrai, je vais revoir ça au plus vite :þ</em><br />
<em><strong>REÉDIT</strong> Voilà, c&#8217;est corrigé, normalement ça devrais être bon cette fois ci. (merci à <strong>Tuxce</strong> pour son aide)</em></p>
<p>Comme je voulais m&#8217;exercer sur les files, et normalement on reverra cette file dans un prochain billet avec toujours une application. Il est bon d&#8217;avoir les deux pointeur, et d&#8217;écrire l&#8217;algorithme pour que la file soit opérationnelle pour enfiler/défiler, sans la parcourir à chaque fois. Comme d&#8217;habitude, j&#8217;ai essayé de commenter le code pour qu&#8217;il soit suffisamment clair à parcourir.</p>
<p>Ce que fait cette application :<br />
Elle enfile les éléments à partir d&#8217;un fichier &laquo;&nbsp;file.txt&nbsp;&raquo; (au même endroit que l&#8217;exécutable) pour pouvoir la défiler après, en défilant le contenu sur le terminal. Dans cette application, le file/défile se fait de façon séquentiel, c&#8217;est à dire l&#8217;un après l&#8217;autre, mais pourrait être réutiliser pour une application non-séquentiel. (si je ne me suis pas trompé :þ, mais comme je vais l&#8217;utiliser plus tard, je confirmerai par la suite).<br />
Il est certain que cela pourrait être amélioré.</p>
<p>Voilà, (que de blabla…) place au code !</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include &lt;string.h&gt;</span>
&nbsp;
<span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> node_t
<span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>buffer<span style="color: #339933;">;</span>
    <span style="color: #993333;">struct</span> node_t <span style="color: #339933;">*</span>next<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> node_t<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> file_t
<span style="color: #009900;">&#123;</span>
    node_t <span style="color: #339933;">*</span>first<span style="color: #339933;">;</span>
    node_t <span style="color: #339933;">*</span>last<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> count<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> file_t<span style="color: #339933;">;</span>
&nbsp;
file_t<span style="color: #339933;">*</span> initFile <span style="color: #009900;">&#40;</span>file_t <span style="color: #339933;">*</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
node_t<span style="color: #339933;">*</span> initNode <span style="color: #009900;">&#40;</span>node_t <span style="color: #339933;">*</span>node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> enfileNode <span style="color: #009900;">&#40;</span>node_t <span style="color: #339933;">*</span>node<span style="color: #339933;">,</span> file_t <span style="color: #339933;">*</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
node_t<span style="color: #339933;">*</span> defileNode <span style="color: #009900;">&#40;</span>file_t <span style="color: #339933;">*</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">void</span> freeNode <span style="color: #009900;">&#40;</span>node_t <span style="color: #339933;">*</span>node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">void</span> freeFile <span style="color: #009900;">&#40;</span>file_t <span style="color: #339933;">*</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">int</span> main <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* On déclare et initialise l'indispensable pour créer une file
     */</span>
    file_t <span style="color: #339933;">*</span>file <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
    file <span style="color: #339933;">=</span> initFile<span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #808080; font-style: italic;">/* On déclare et initialise l'indispensable pour ouvrir le fichier.
     */</span>
    FILE <span style="color: #339933;">*</span>fichier <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
    fichier <span style="color: #339933;">=</span> fopen <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;file.txt&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> buffer<span style="color: #009900;">&#91;</span>BUFSIZ<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>fichier <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>fgets <span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">,</span> BUFSIZ<span style="color: #339933;">,</span> fichier<span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #808080; font-style: italic;">/* Création d'une node */</span>
            node_t <span style="color: #339933;">*</span>node <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
            node <span style="color: #339933;">=</span> initNode<span style="color: #009900;">&#40;</span>node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>node<span style="color: #339933;">-&gt;</span>buffer <span style="color: #339933;">=</span> strndup <span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">,</span> BUFSIZ<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Erreur avec strndup<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>enfileNode <span style="color: #009900;">&#40;</span>node<span style="color: #339933;">,</span> file<span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> EXIT_FAILURE<span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>
        fclose<span style="color: #009900;">&#40;</span>fichier<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        fprintf <span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Ouverture de fichier impossible<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> EXIT_FAILURE<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>file<span style="color: #339933;">-&gt;</span>count <span style="color: #339933;">!=</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        file<span style="color: #339933;">-&gt;</span>first <span style="color: #339933;">=</span> defileNode <span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    freeFile <span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
    <span style="color: #b1b100;">return</span> EXIT_SUCCESS<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Fonction permettant d'initialiser les différents éléments
 * des pointeurs qui servent à repérer la position du début et fin
 * de la file, plus un compteur du nombres d'éléments présent.
 */</span>
file_t<span style="color: #339933;">*</span> initFile <span style="color: #009900;">&#40;</span>file_t <span style="color: #339933;">*</span>file<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    file <span style="color: #339933;">=</span> malloc <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>file_t<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    file<span style="color: #339933;">-&gt;</span>first <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
    file<span style="color: #339933;">-&gt;</span>last <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
    file<span style="color: #339933;">-&gt;</span>count <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> file<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* De même avec un node de la file, on l'initialise.
 */</span>
node_t<span style="color: #339933;">*</span> initNode <span style="color: #009900;">&#40;</span>node_t <span style="color: #339933;">*</span>node<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    node <span style="color: #339933;">=</span> malloc <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>node_t<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    node<span style="color: #339933;">-&gt;</span>buffer <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
    node<span style="color: #339933;">-&gt;</span>next <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> node<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Fonction enfilant la node, si la liste est vide, la node correspond 
 * au début et à la fin de la liste.
 */</span>
<span style="color: #993333;">int</span> enfileNode <span style="color: #009900;">&#40;</span>node_t <span style="color: #339933;">*</span>node<span style="color: #339933;">,</span> file_t <span style="color: #339933;">*</span>file<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>file<span style="color: #339933;">-&gt;</span>count <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        file<span style="color: #339933;">-&gt;</span>first <span style="color: #339933;">=</span> node<span style="color: #339933;">;</span>
        file<span style="color: #339933;">-&gt;</span>last <span style="color: #339933;">=</span> node<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        file<span style="color: #339933;">-&gt;</span>last<span style="color: #339933;">-&gt;</span>next <span style="color: #339933;">=</span> node<span style="color: #339933;">;</span>
        file<span style="color: #339933;">-&gt;</span>last <span style="color: #339933;">=</span> node<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    file<span style="color: #339933;">-&gt;</span>count<span style="color: #339933;">++;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Et on défile la liste en écrivant dans le terminal le résultat.
 * si la liste devient vide (dernier élément défilé) on réinitialise
 * la file.
 */</span>
node_t<span style="color: #339933;">*</span> defileNode <span style="color: #009900;">&#40;</span>file_t <span style="color: #339933;">*</span>file<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
        node_t <span style="color: #339933;">*</span>buffnext <span style="color: #339933;">=</span> file<span style="color: #339933;">-&gt;</span>first<span style="color: #339933;">-&gt;</span>next<span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/* la donnée de la node n'est que redirigé sur une sortie standard,
         * mais on pourrait facilement la rediriger vers un fichier ou toute
         * autre sortie (sock par exemple)
         */</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span> file<span style="color: #339933;">-&gt;</span>first<span style="color: #339933;">-&gt;</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        freeNode<span style="color: #009900;">&#40;</span>file<span style="color: #339933;">-&gt;</span>first<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        file<span style="color: #339933;">-&gt;</span>first <span style="color: #339933;">=</span> buffnext<span style="color: #339933;">;</span>
        file<span style="color: #339933;">-&gt;</span>count<span style="color: #339933;">--;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>file<span style="color: #339933;">-&gt;</span>count <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            file<span style="color: #339933;">-&gt;</span>first <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
            file<span style="color: #339933;">-&gt;</span>last <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> file<span style="color: #339933;">-&gt;</span>first<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Utilitaire pour libérer la node et la file en fin d'usage.
 */</span>
<span style="color: #993333;">void</span> freeNode<span style="color: #009900;">&#40;</span>node_t <span style="color: #339933;">*</span>buffer<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  free<span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">-&gt;</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  free<span style="color: #009900;">&#40;</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> freeFile<span style="color: #009900;">&#40;</span>file_t <span style="color: #339933;">*</span>file<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    free<span style="color: #009900;">&#40;</span>file<span style="color: #339933;">-&gt;</span>first<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    free<span style="color: #009900;">&#40;</span>file<span style="color: #339933;">-&gt;</span>last<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    free<span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/exemple-de-file-avec-deux-pointeurs-en-langage-c-1752/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Socket en langage C pour bot IRC avec fichier de configuration</title>
		<link>http://www.nicosphere.net/socket-en-langage-c-pour-bot-irc-avec-fichier-de-configuration-1744/</link>
		<comments>http://www.nicosphere.net/socket-en-langage-c-pour-bot-irc-avec-fichier-de-configuration-1744/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 09:49:05 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[programmation]]></category>
		<category><![CDATA[langage C]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tchat]]></category>
		<category><![CDATA[tutoriel]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1744</guid>
		<description><![CDATA[Ce billet est en complément du précédent article, le but étant de faire un petit bot IRC en langage C se connectant via un petit fichier de configuration parsant les informations tel que le nom, l&#8217;host, le port, les salons à rejoindre.. En soit le bot ne fait rien de spécial, c&#8217;est uniquement l&#8217;implémentation des [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/socket-en-langage-c-pour-bot-irc-avec-fichier-de-configuration-1744"><img class="alignleft" src="http://www.nicosphere.net/image/c.jpg" alt="langage_c" width="130" height="114" title="Socket en langage C pour bot IRC avec fichier de configuration" /></a>Ce billet est en complément du précédent article, le but étant de faire un petit bot IRC en langage C se connectant via un petit fichier de configuration parsant les informations tel que le nom, l&#8217;host, le port, les salons à rejoindre..</p>
<p>En soit le bot ne fait rien de spécial, c&#8217;est uniquement l&#8217;implémentation des fonctionnalités de bases, mais l&#8217;ajout de quelques fonctionnalité serait facile à partir de ce code.<br />
<span id="more-1744"></span><br />
J&#8217;espère avoir commenté suffisamment et pas codé trop comme un cochon pour rendre la compréhension du code facile. Bien que mes billets sur la programmation n&#8217;attirent jamais de commentaires, je suis preneur de tout suggestions d&#8217;amélioration sur le fond comme sur la forme, c&#8217;est aussi par la critique qu&#8217;on apprend. Le code est sous GPL, en gros, faites en ce que vous voulez du moment que l&#8217;auteur de départ est gardé. Le bot ne fonctionnera que dans un environnement Linux (PC ou serveur) mais l&#8217;adaptation pour un environnement Windows n&#8217;est pas compliqué à faire.</p>
<p><em><strong>ÉDIT: </strong> depuis la publication de ce code, il a encore changé dans le fonctionnement général (voir mon commentaire tout en bas de page pour plus de détail.</em></p>
<p>Trêve de bavardage, passons aux choses sérieuses !</p>
<h3>bot.conf</h3>
<p>Tout d&#8217;abord, le fichier de configuration devant être nommé « bot.conf » et se trouvant au même endroit que l&#8217;exécutable pour qu&#8217;il fonctionne correctement, en soit, rien de très original dans se fichier et je ne pense pas qu&#8217;il y ait besoin de plus de commentaires :þ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">############################################</span>
<span style="color: #808080; font-style: italic;">#   Fichier de configuration pour CBot</span>
<span style="color: #808080; font-style: italic;">#       Nic0 (25/04/10)</span>
<span style="color: #808080; font-style: italic;">############################################</span>
&nbsp;
host <span style="color: #483d8b;">&quot;irc.freenode.net&quot;</span>
port <span style="color: #483d8b;">&quot;6667&quot;</span>
<span style="color: #808080; font-style: italic;"># Ne pas utiliser de caractère spéciaux autre</span>
<span style="color: #808080; font-style: italic;"># que ceux autoriser sur l'irc.</span>
nick <span style="color: #483d8b;">&quot;CBot&quot;</span>
ident <span style="color: #483d8b;">&quot;CBot&quot;</span>
realname <span style="color: #483d8b;">&quot;Nic0's Bot&quot;</span>
<span style="color: #808080; font-style: italic;"># les salons doivent être séparer par des virgules</span>
salon <span style="color: #483d8b;">&quot;#archlinux,#archlinux-fr&quot;</span></pre></td></tr></table></div>

<h3>main.c</h3>
<p>Bien que le code aurait pu être splitté en plusieurs fichier facilement, pour une meilleurs disposition ici, j&#8217;ai garder tout dans un seul fichier, là non plus, normalement pas besoin d&#8217;autre commentaire que ceux qui sont dans le code. Bonne lecture à ceux s&#8217;y lançant :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/***********************************************************
*
*       CBot v0.2       (26/04/10)
*
*   by Nic0 &lt;nicolas.caen at gmail.com&gt;
*   Si vous redistribuez ce code, merci de ne pas effacer
*   ces données, et de rajouter les vôtres. (GPL)
*
************************************************************/</span>
&nbsp;
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;string.h&gt;</span>
<span style="color: #339933;">#include &lt;errno.h&gt;</span>
&nbsp;
<span style="color: #339933;">#include &lt;unistd.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/socket.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/types.h&gt;</span>
<span style="color: #339933;">#include &lt;netinet/in.h&gt;</span>
<span style="color: #339933;">#include &lt;netdb.h&gt;</span>
&nbsp;
<span style="color: #339933;">#define MAXBUFF 512</span>
<span style="color: #339933;">#define NBR_ELEMENT 6</span>
&nbsp;
<span style="color: #339933;">#define ERROR fprintf (stderr, \
        &quot;%s:%d Error (%d) : %s\n&quot;, \
        __FILE__, __LINE__, \
        errno, strerror(errno))</span>
&nbsp;
<span style="color: #993333;">struct</span> Configuration
<span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>host<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> port<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>nick<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>ident<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>realname<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>user<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>salon<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">int</span> initSocket <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> sockaddr_in <span style="color: #339933;">*</span>sockname<span style="color: #339933;">,</span> 
                <span style="color: #993333;">struct</span> hostent <span style="color: #339933;">*</span>host_address<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> Configuration <span style="color: #339933;">*</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> initSocketConnect <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> Configuration <span style="color: #339933;">*</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> socketAction <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> pong <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> getConfiguration <span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> Configuration <span style="color: #339933;">*</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> extractConfig <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>element<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>concatString <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>str1<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>str2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">void</span> freeStruct <span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> Configuration <span style="color: #339933;">*</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">int</span> main <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>   
    <span style="color: #993333;">struct</span> sockaddr_in sockname<span style="color: #339933;">;</span>
    <span style="color: #993333;">struct</span> hostent <span style="color: #339933;">*</span>host_address<span style="color: #339933;">;</span>
    <span style="color: #993333;">struct</span> Configuration config<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> sock <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>getConfiguration <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>config<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
        <span style="color: #b1b100;">return</span> EXIT_FAILURE<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>initSocket <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>sock<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>sockname<span style="color: #339933;">,</span> host_address<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>config<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
        <span style="color: #b1b100;">return</span> EXIT_FAILURE<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>initSocketConnect <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>sock<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        close <span style="color: #009900;">&#40;</span>sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> EXIT_FAILURE<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    freeStruct <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #993333;">char</span> buffer <span style="color: #009900;">&#91;</span><span style="color: #0000dd;">2048</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>recv<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> buffer<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>buffer<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            ERROR<span style="color: #339933;">;</span>
            close <span style="color: #009900;">&#40;</span>sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">return</span> EXIT_FAILURE<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span> buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>socketAction <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>sock<span style="color: #339933;">,</span> buffer<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
            ERROR<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> EXIT_SUCCESS<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*  Fonction permettant de créer la socket et de la connecter au serveur IRC.
 */</span>
<span style="color: #993333;">int</span> initSocket <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> sockaddr_in <span style="color: #339933;">*</span>sockname<span style="color: #339933;">,</span> 
                <span style="color: #993333;">struct</span> hostent  <span style="color: #339933;">*</span>host_address<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> Configuration <span style="color: #339933;">*</span>config<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #808080; font-style: italic;">/*  Obtention de l'adresse de la machine distante à partir de l'host.
 */</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>host_address <span style="color: #339933;">=</span> gethostbyname <span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>host<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*  Création d'une socket.
 */</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock <span style="color: #339933;">=</span> socket <span style="color: #009900;">&#40;</span>PF_INET<span style="color: #339933;">,</span> SOCK_STREAM<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*  Connexion de la socket au server distant
 */</span>
    sockname<span style="color: #339933;">-&gt;</span>sin_family <span style="color: #339933;">=</span> host_address <span style="color: #339933;">-&gt;</span>h_addrtype<span style="color: #339933;">;</span>
    sockname<span style="color: #339933;">-&gt;</span>sin_port <span style="color: #339933;">=</span> htons <span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>port<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    memcpy <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span><span style="color: #009900;">&#40;</span>sockname<span style="color: #339933;">-&gt;</span>sin_addr.<span style="color: #202020;">s_addr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> host_address<span style="color: #339933;">-&gt;</span>h_addr<span style="color: #339933;">,</span> host_address<span style="color: #339933;">-&gt;</span>h_length<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>connect <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> sockaddr <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> sockname<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> sockaddr_in<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*  Fonction permettant d'envoyer les paramètres de bases pour rejoindre un salon, avec
 *  le choix du pseudo et identifiant
 */</span>
<span style="color: #993333;">int</span> initSocketConnect <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> Configuration <span style="color: #339933;">*</span>config<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>send<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> config<span style="color: #339933;">-&gt;</span>nick<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>nick<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>send<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> config<span style="color: #339933;">-&gt;</span>user<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>user<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>send<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> config<span style="color: #339933;">-&gt;</span>salon<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>salon<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    ERROR<span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*  Fonction envoyant la réponse au ping
 */</span>
<span style="color: #993333;">int</span> pong <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>buffer<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    buffer<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'O'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>send<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> buffer<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*  Fonction traitant le buffer pour savoir quel action on doit lui associer.
 *  Ici, seul la réponse au Ping est traité et le cas de fermeture de la socket
 *  par le serveur distant.
 *  Pour rajouter des fonctionnalité au bot, 
 *  c'est ici qu'il est le plus simple de le faire.
 */</span>
<span style="color: #993333;">int</span> socketAction <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>buffer<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strncmp<span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;PING :&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">6</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>pong<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> buffer<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            close<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strncmp<span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;ERROR :Closing Link:&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">20</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        close <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*  Fonction permettant de récupérer les données lu dans le fichier de configuration
 *  Chaque éléments reconnu est stocké dans la structure Configuration, 
 *  Il lui est rajouté dans cette fonction le nécessaire pour être envoyer directement
 *  dans la socket (une fois sortie de cette fonction, tout est prêt à l'emploi.
 *  Si un # est rencontré en 1er caractère, on considère que c'est un commentaire
 *  et est alors exclu.
 */</span>
<span style="color: #993333;">int</span> getConfiguration <span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> Configuration <span style="color: #339933;">*</span>config<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    FILE <span style="color: #339933;">*</span>fichier<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> filebuff<span style="color: #009900;">&#91;</span>MAXBUFF<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> nbrElement <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
    fichier <span style="color: #339933;">=</span> fopen <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;bot.conf&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>fichier <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>fgets <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> MAXBUFF<span style="color: #339933;">,</span> fichier<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>filebuff<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'#'</span><span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>strncmp <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;host&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>    
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>host <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>strdup<span style="color: #009900;">&#40;</span>strchr <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>extractConfig<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>host<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        nbrElement<span style="color: #339933;">++;</span>
                        <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                ERROR<span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>strncmp <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;port&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                config<span style="color: #339933;">-&gt;</span>port <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
                <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>tmp <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>tmp <span style="color: #339933;">=</span> strdup <span style="color: #009900;">&#40;</span>strchr <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>extractConfig<span style="color: #009900;">&#40;</span>tmp<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>port <span style="color: #339933;">=</span> atoi<span style="color: #009900;">&#40;</span>tmp<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                            nbrElement<span style="color: #339933;">++;</span>
                            free<span style="color: #009900;">&#40;</span>tmp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                            <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                ERROR<span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>strncmp <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;nick&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>tmp <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
                config<span style="color: #339933;">-&gt;</span>nick <span style="color: #339933;">=</span> strdup <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;NICK &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>tmp <span style="color: #339933;">=</span> strdup <span style="color: #009900;">&#40;</span>strchr <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>extractConfig <span style="color: #009900;">&#40;</span>tmp<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>concatString <span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>nick<span style="color: #339933;">,</span> tmp<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>concatString <span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>nick<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                nbrElement<span style="color: #339933;">++;</span>
                                free<span style="color: #009900;">&#40;</span>tmp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
                            <span style="color: #009900;">&#125;</span>
                ERROR<span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>strncmp <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;ident&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>ident <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>strdup<span style="color: #009900;">&#40;</span>strchr <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>extractConfig<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>ident<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        nbrElement<span style="color: #339933;">++;</span>
                        <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                ERROR<span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>strncmp <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;realname&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">8</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>realname <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>strdup<span style="color: #009900;">&#40;</span>strchr <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>extractConfig<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>realname<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        nbrElement<span style="color: #339933;">++;</span>
                        <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                ERROR<span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>strncmp <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;salon&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>tmp <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
                config<span style="color: #339933;">-&gt;</span>salon <span style="color: #339933;">=</span> strdup <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;JOIN &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>tmp <span style="color: #339933;">=</span> strdup <span style="color: #009900;">&#40;</span>strchr <span style="color: #009900;">&#40;</span>filebuff<span style="color: #339933;">,</span> <span style="color: #ff0000;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>extractConfig <span style="color: #009900;">&#40;</span>tmp<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>concatString <span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>salon<span style="color: #339933;">,</span> tmp<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>concatString <span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>salon<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                nbrElement<span style="color: #339933;">++;</span>
                                free<span style="color: #009900;">&#40;</span>tmp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
                            <span style="color: #009900;">&#125;</span>
                ERROR<span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        fclose <span style="color: #009900;">&#40;</span>fichier<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>nbrElement <span style="color: #339933;">==</span> NBR_ELEMENT<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>user <span style="color: #339933;">=</span> strdup<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;USER &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>concatString <span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>user<span style="color: #339933;">,</span> config<span style="color: #339933;">-&gt;</span>ident<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>concatString <span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>user<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot; <span style="color: #000099; font-weight: bold;">\&quot;</span>localhost<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\&quot;</span>irc_server<span style="color: #000099; font-weight: bold;">\&quot;</span> :&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>concatString <span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>user<span style="color: #339933;">,</span> config<span style="color: #339933;">-&gt;</span>realname<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>concatString <span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>user<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span>
                            <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        fprintf <span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;The configuration file doesn't seem to contain enought or to much data<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*  Utilitaire: lorsque l'élément en question est lu dans le fichier de configuration
 *  il apparait sous la forme &quot;element&quot;, cette fonction enlève donc les &quot;&quot; pour ne laisser
 *  que l'élément.
 */</span>
<span style="color: #993333;">int</span> extractConfig <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>element<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">int</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">do</span> <span style="color: #009900;">&#123;</span>
        element<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> element<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        i<span style="color: #339933;">++;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>element<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #339933;">&amp;&amp;</span> i <span style="color: #339933;">&lt;=</span> <span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">&gt;=</span> <span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;An error has occured in the configuration file, a double-quote is missing<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    element<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*  Utilitaire permettant de concaténer deux chaine de façon dynamique
 */</span>
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>concatString <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>str1<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>str2<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>result<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> len1<span style="color: #339933;">,</span> len2<span style="color: #339933;">;</span>
    len1 <span style="color: #339933;">=</span> strlen<span style="color: #009900;">&#40;</span>str1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    len2 <span style="color: #339933;">=</span> strlen<span style="color: #009900;">&#40;</span>str2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>NULL <span style="color: #339933;">==</span> <span style="color: #009900;">&#40;</span>result <span style="color: #339933;">=</span> realloc <span style="color: #009900;">&#40;</span>str1<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>len1 <span style="color: #339933;">+</span> len2 <span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #993333;">sizeof</span> <span style="color: #339933;">*</span>result<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span>NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    memcpy <span style="color: #009900;">&#40;</span>result <span style="color: #339933;">+</span> len1<span style="color: #339933;">,</span> str2<span style="color: #339933;">,</span> len2 <span style="color: #339933;">+</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> result<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*  Une fois les informations envoyé, on libère la structure.
 */</span>
<span style="color: #993333;">void</span> freeStruct <span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> Configuration <span style="color: #339933;">*</span>config<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    free<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>host<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    free<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>nick<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    free<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>ident<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    free<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>realname<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    free<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>user<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    free<span style="color: #009900;">&#40;</span>config<span style="color: #339933;">-&gt;</span>salon<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/socket-en-langage-c-pour-bot-irc-avec-fichier-de-configuration-1744/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Socket en langage C pour bot IRC</title>
		<link>http://www.nicosphere.net/socket-en-langage-c-pour-bot-irc-1735/</link>
		<comments>http://www.nicosphere.net/socket-en-langage-c-pour-bot-irc-1735/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 13:16:43 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[programmation]]></category>
		<category><![CDATA[langage C]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tchat]]></category>
		<category><![CDATA[TCP]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1735</guid>
		<description><![CDATA[Une petite application en langage C, un simple bot IRC permettant de se connecter au serveur, joindre et joindre un salon, et bien sûr répondre au PING. L&#8217;avantage de ce code, c&#8217;est de ne pas avoir grand chose dans la fonction main, l&#8217;initiation, la connexion et les réponses au ping se font dans des fonctions [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/socket-en-langage-c-pour-bot-irc-1735"><img class="alignleft" src="http://www.nicosphere.net/image/c.jpg" alt="langage_c" width="130" height="114" title="Socket en langage C pour bot IRC" /></a>Une petite application en langage C, un simple bot IRC permettant de se connecter au serveur, joindre et joindre un salon, et bien sûr répondre au PING.</p>
<p>L&#8217;avantage de ce code, c&#8217;est de ne pas avoir grand chose dans la fonction main, l&#8217;initiation, la connexion et les réponses au ping se font dans des fonctions à part, permettant une meilleur maniabilité du code que si tout était dans la fonction main.<br />
<span id="more-1735"></span></p>
<p>La prochaine étape sera de le rendre encore un peu plus malléable, en lisant les paramètres de connexion dans un fichier de configuration plutôt que directement dans le code source.</p>
<p>À partir de là, il est facile d&#8217;implémenter des fonctionnalités au bot, pour qu&#8217;il réponde à diverse commande.</p>
<p>Le code n&#8217;est prévu que pour Linux et ne fonctionnera pas sur Windows, mais le principe restant le même, il peut servir d&#8217;exemple. (fonctionnant sur les serveur sous Linux)</p>
<p>Pour le faire fonctionner, recopier le texte dans un fichier « main.c » et bien sûr un :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gcc</span> main.c <span style="color: #660033;">-o</span> bot</pre></div></div>

<p><strong>EDIT: </strong> La prochaine version (avec fichier de configuration) qui reprend une partie de ce code sera amélioré dans son ensemble. (<a href="http://www.nicosphere.net/socket-en-langage-c-pour-bot-irc-avec-fichier-de-configuration-1744/">disponible sur ce billet</a>)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/***************************************
*       IRCBOT
*           Nic0 (24/04/10)
****************************************/</span>
&nbsp;
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;string.h&gt;</span>
<span style="color: #339933;">#include &lt;errno.h&gt;</span>
&nbsp;
<span style="color: #339933;">#include &lt;unistd.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/socket.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/types.h&gt;</span>
<span style="color: #339933;">#include &lt;netinet/in.h&gt;</span>
<span style="color: #339933;">#include &lt;netdb.h&gt;</span>
&nbsp;
<span style="color: #339933;">#define PORT 6667</span>
<span style="color: #339933;">#define HOST &quot;irc.freenode.net&quot;</span>
&nbsp;
<span style="color: #339933;">#define ERROR fprintf (stderr, \
        &quot;%s:%d Error (%d) : %s\n&quot;, \
        __FILE__, __LINE__, \
        errno, strerror(errno))</span>
&nbsp;
<span style="color: #993333;">int</span> initSocket <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> sockaddr_in <span style="color: #339933;">*</span>sockname<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> hostent <span style="color: #339933;">*</span>host_address<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> initSocketConnect <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> socketAction <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> pong <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">int</span> main <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>   
    <span style="color: #993333;">struct</span> sockaddr_in sockname<span style="color: #339933;">;</span>
    <span style="color: #993333;">struct</span> hostent <span style="color: #339933;">*</span>host_address<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> sock <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>initSocket <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>sock<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>sockname<span style="color: #339933;">,</span> host_address<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
        <span style="color: #b1b100;">return</span> EXIT_FAILURE<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>initSocketConnect <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>sock<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        close <span style="color: #009900;">&#40;</span>sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> EXIT_FAILURE<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #993333;">char</span> buffer <span style="color: #009900;">&#91;</span><span style="color: #0000dd;">2048</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>recv<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> buffer<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>buffer<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            ERROR<span style="color: #339933;">;</span>
            close <span style="color: #009900;">&#40;</span>sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">return</span> EXIT_FAILURE<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span> buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>socketAction <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>sock<span style="color: #339933;">,</span> buffer<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
            ERROR<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
    <span style="color: #b1b100;">return</span> EXIT_SUCCESS<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*  Fonction permettant de créer la socket et de la connecter au serveur IRC.
 */</span>
<span style="color: #993333;">int</span> initSocket <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> sockaddr_in <span style="color: #339933;">*</span>sockname<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> hostent <span style="color: #339933;">*</span>host_address<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #808080; font-style: italic;">/*  Obtention de l'adresse de la machine distante à partir de l'host.
 */</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>host_address <span style="color: #339933;">=</span> gethostbyname <span style="color: #009900;">&#40;</span>HOST<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*  Création d'une socket.
 */</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock <span style="color: #339933;">=</span> socket <span style="color: #009900;">&#40;</span>PF_INET<span style="color: #339933;">,</span> SOCK_STREAM<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*  Connexion de la socket au server distant
 */</span>
    sockname<span style="color: #339933;">-&gt;</span>sin_family <span style="color: #339933;">=</span> host_address <span style="color: #339933;">-&gt;</span>h_addrtype<span style="color: #339933;">;</span>
    sockname<span style="color: #339933;">-&gt;</span>sin_port <span style="color: #339933;">=</span> htons <span style="color: #009900;">&#40;</span>PORT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    memcpy <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span><span style="color: #009900;">&#40;</span>sockname<span style="color: #339933;">-&gt;</span>sin_addr.<span style="color: #202020;">s_addr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> host_address<span style="color: #339933;">-&gt;</span>h_addr<span style="color: #339933;">,</span> host_address<span style="color: #339933;">-&gt;</span>h_length<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>connect <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> sockaddr <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> sockname<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> sockaddr_in<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*  Fonction permettant d'envoyer les paramètres de bases pour rejoindre un salon, avec
 *  le choix du pseudo et identifiant
 */</span>
<span style="color: #993333;">int</span> initSocketConnect <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>nick <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;NICK ircbot<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>user <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;USER Haz <span style="color: #000099; font-weight: bold;">\&quot;</span>localhost<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\&quot;</span>irc_server<span style="color: #000099; font-weight: bold;">\&quot;</span> :Nic0 s Bot<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>join <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;JOIN #ubuntu,#archlinux,#linux<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>send<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> nick<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>nick<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>send<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> user<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>user<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>send<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> join<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>join<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*  Fonction envoyant la réponse au ping
 */</span>
<span style="color: #993333;">int</span> pong <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>buffer<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    buffer<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'O'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>send<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> buffer<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ERROR<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*  Fonction traitant le buffer pour savoir quel action on doit lui associer.
 *  Ici, seul la réponse au Ping est traiter, et le cas de fermeture de la socket
 *  par le serveur distant.
 *  Pour rajouter des fonctionnalité au bot, 
 *  c'est ici qu'il est le plus simple de le faire.
 */</span>
<span style="color: #993333;">int</span> socketAction <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>buffer<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strstr<span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;PING :&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL <span style="color: #339933;">&amp;&amp;</span> buffer<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'P'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>pong<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> buffer<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            close<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strstr<span style="color: #009900;">&#40;</span>buffer<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;ERROR :Closing Link:&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL <span style="color: #339933;">&amp;&amp;</span> buffer<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'E'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        close <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/socket-en-langage-c-pour-bot-irc-1735/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pourquoi mon PC n&#8217;est plus Linux Only</title>
		<link>http://www.nicosphere.net/pourquoi-mon-pc-nest-plus-linux-only-1728/</link>
		<comments>http://www.nicosphere.net/pourquoi-mon-pc-nest-plus-linux-only-1728/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 11:17:24 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[bavardage]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1728</guid>
		<description><![CDATA[Je ne sais plus depuis combien de temps je suis en simple boot, uniquement avec Linux (Arch Linux pour être plus précis). Mais ce week-end, Windows vient de gagner une place dans un coin perdu de mon disque dur. Une petite tentative ici d&#8217;expliquer le pourquoi de la chose. De ce qui pourrait être perçu [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" src="http://www.nicosphere.net/image/linux_windows.png" alt="linux windows" width="130" height="74" title="Pourquoi mon PC nest plus Linux Only" />Je ne sais plus depuis combien de temps je suis en simple boot, uniquement avec Linux (Arch Linux pour être plus précis). Mais ce week-end, Windows vient de gagner une place dans un coin perdu de mon disque dur.<br />
Une petite tentative ici d&#8217;expliquer le pourquoi de la chose. De ce qui pourrait être perçu comme un retour en arrière.<br />
<span id="more-1728"></span><br />
Comme toutes choses, Linux a ses avantages et ses inconvénients, je ne reviens pas sur les avantages, nombreuses fois expliqués ici dans des billets d&#8217;introductions sur Linux, mais plutôt sur les inconvénients. Pour moi il ne sont pas nombreux et bien connu de la communauté :</p>
<ul>
<li>Les jeux vidéo ;</li>
<li>Les drivers / support matériels.</li>
</ul>
<p>Pour les drivers, on le sait, et on y fait attention, comme pour le choix d&#8217;une imprimante. Alors que pour windows un « CD d&#8217;installation » est fournis en général avec le matériel. Pour Linux, il faut trouver le bon driver, pour la plupart des cas cela ne pose pas de problème, mais si le périphérique est un peu trop exotique, il y a un risque de ne pas trouver de pilote pour le faire tourner.</p>
<p>Pour les jeux, c&#8217;est bien connu aussi que Linux ne supporte pas tout les jeux, que pour les faire tournés faut soit wine soit playonlinux. Beaucoup de jeux sont quand même supporté, suffit de voir la liste fournis par les deux applications, mais d&#8217;une part, passer par de l&#8217;émulation (plus ou moins) n&#8217;est pas forcément une bonne chose niveau performance, de l&#8217;autre part, tout les jeux ne sont pas supporté, même si les plus courant le sont, je ne suis pas forcément amateur de ce que la majorité des personnes veuille jouer. Il existe bien sûr des jeux prévu nativement pour Linux, et sans vouloir dénigrer l&#8217;excellent travail fournis par les développeurs, ces jeux ne sont pas à la hauteur de certains jeux commerciaux, et ne possèdent pas non plus les moyens financier des grosses industries du jeux vidéos, et même si le répertoire de jeux natif sous Linux grandis, le choix reste encore limité aux plus classique.</p>
<p>Il peut y avoir d&#8217;autres raisons je suppose poussant à l&#8217;utilisation de Windows, comme certain logiciels professionnels ne tournant qu&#8217;avec Windows, même si bien souvent c&#8217;est une fausse raison car l&#8217;alternative sérieuse existe, mais c&#8217;est plus que tel ou tel logiciel est imposé par l&#8217;entreprise.</p>
<p>Pour en revenir à mon cas, c&#8217;est pour les jeux que j&#8217;ai décidé de remettre Windows, bien que je ne sois pas un gros joueur, pouvoir m&#8217;assurer de pouvoir faire fonctionner un jeu out-of-the-box, ne pas choisir un jeu en fonction de sa compatibilité avec Linux, mais juste prendre un jeu qui me fait plaisir, c&#8217;est quand même important. Bien sûr je comprends les valeurs des Logiciels Libres et tout ça, mais je ne suis pas au point de boycotter toute technologie propriétaire si elle présente un large intérêt par rapport aux alternatives libres. Même si retrouver Windows fait drôle au début, j&#8217;espère même en avoir un nouveau regard dessus avec toute ses choses que j&#8217;ai appris grâce à Linux.</p>
<p>Techniquement, l&#8217;installation s&#8217;est passé plutôt simplement et sans aucune perte de données, j&#8217;ai retrouvé mon CD de Vista, avec sa licence. Un truc curieux à l&#8217;installation quand même, j&#8217;ai deux disques durs, le but étant de mettre Windows sur le deuxième, et sur une partition à part. Lors de l&#8217;installation, il m&#8217;a reconnu correctement les deux disques dures et les partitions, mais lorsque j&#8217;ai choisi la partition (formaté en ntfs) un « Windows ne trouve aucun volume système conforme aux critères d&#8217;installation » le plus curieux c&#8217;est qu&#8217;il m&#8217;a suffit de débrancher le 1èr DD, pour ne mettre que celui prévu pour Windows, et ça fonctionné… C&#8217;est là certain mystère de Windows, dès l&#8217;installation, après avoir rebrancher tout ça, réarranger mon Grub, et quelques drivers réinstaller, c&#8217;est une installation qui s&#8217;est fait sans difficulté vraiment.</p>
<p>Me voilà donc avec un nouvel OS sur mon PC, Arch Linux restant mon OS principal et de tout les jours. Peut être que la prochaine fois, se sera au tour d&#8217;un *BSD d&#8217;avoir une petite place sur mon disque dur pour changer des machines virtuels. Les avis sur la question peuvent différer mais n&#8217;est-ce-pas limiter l&#8217;utilisation et la capacité de mon ordinateur que de ne pas pouvoir avoir accès à tout les jeux existant ?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/pourquoi-mon-pc-nest-plus-linux-only-1728/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Arch Linux Magazine avril 2010</title>
		<link>http://www.nicosphere.net/arch-linux-magazine-avril-2010-1725/</link>
		<comments>http://www.nicosphere.net/arch-linux-magazine-avril-2010-1725/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 18:46:51 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[archlinux]]></category>
		<category><![CDATA[magazine]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1725</guid>
		<description><![CDATA[Nous y voilà enfin, la traduction d&#8217;Arch Linux Magazine est publié, un peu en retard cette fois ci, alors que le numéro était sortie dans les temps en anglais. Remercions catwell, gyo et Nic0 pour la traduction et la relecture. Mais pour être honnête je n&#8217;ai pas participé autant que d&#8217;habitude. Pour prendre votre copie [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/arch-linux-magazine-avril-2010-1725/"><img class="alignleft" src="http://www.nicosphere.net/image/archfr.png" alt="archfr Arch Linux Magazine avril 2010" width="130" height="130" title="Arch Linux Magazine avril 2010" /></a>Nous y voilà enfin, la traduction d&#8217;Arch Linux Magazine est publié, un peu en retard cette fois ci, alors que le numéro était sortie dans les temps en anglais.</p>
<p>Remercions catwell, gyo et Nic0 pour la traduction et la relecture. Mais pour être honnête je n&#8217;ai pas participé autant que d&#8217;habitude.</p>
<p>Pour prendre votre copie de l&#8217;Arch Linux Magazine, c&#8217;est par là, en <a href="http://archlinux.fr/archlinux-magazine/arch-linux-magazine-avril-2010">français</a> ou en <a href="http://www.archlinux.org/news/493/">anglais</a>.<br />
<span id="more-1725"></span><br />
Le mois dernier nous avions une version un peu réduite de l&#8217;ALM, ce qui était surtout un appel à la communauté pour la contribution. Je dois dire que son appel à plutôt bien fonctionné, pas mal de contributeurs se sont montré sur freenode (#archlinux-magazine) pour apporter différentes contributions. C&#8217;est donc un retour à une publication « normal » cette fois ci.</p>
<p>Le numéro d&#8217;avril étant sortie pour le 1er avril, le magazine était disponible avec une particularité, celle d&#8217;être complètement à l&#8217;envers, rendant la lecture difficile, mais avec quelques lignes de commandes, ou des astuces, il est possible de remettre le PDF dans le bonne ordre. Dès le lendemain, la version normal fut mis à disposition.</p>
<p>Sans plus attendre, un aperçu du sommaire :</p>
<ul>
<li>Editorial</li>
<li>Côté Dev.</li>
<li>Un point sur le Schwag</li>
<li>Contribution de la communauté</li>
<li>ArchCon 2010</li>
<li>Critique du Asus UL30A CULV</li>
<li>Photos de bureau</li>
</ul>
<p>Bonne lecture à tous.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/arch-linux-magazine-avril-2010-1725/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arch Linux met en place un dépôt pour tester Xorg 1.8</title>
		<link>http://www.nicosphere.net/arch-linux-met-en-place-un-depot-pour-tester-xorg-1-8-1687/</link>
		<comments>http://www.nicosphere.net/arch-linux-met-en-place-un-depot-pour-tester-xorg-1-8-1687/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 23:20:08 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[actualité]]></category>
		<category><![CDATA[archlinux]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1687</guid>
		<description><![CDATA[Xorg 1.8 étant fraîchement sortie, et dans les temps en plus, un dépôt spécialement mis en place par les développeurs d&#8217;Arch Linux pour pouvoir tester ce nouveau xorg, sans déstabiliser pour autant les utilisateurs du dépôt [testing]. Pour ceux souhaitant avoir un aperçu des nouveauté de Xorg 1.8.0, vous pouvez lire ce billet, X.Org Server [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/arch-linux-met-en-place-un-depot-pour-tester-xorg-1-8-1687"><img class="alignleft" src="http://www.nicosphere.net/image/xorg.png" alt="xorg Arch Linux met en place un dépôt pour tester Xorg 1.8" width="130" height="110" title="Arch Linux met en place un dépôt pour tester Xorg 1.8" /></a>Xorg 1.8 étant fraîchement sortie, et dans les temps en plus, un dépôt spécialement mis en place par les développeurs d&#8217;Arch Linux pour pouvoir tester ce nouveau xorg, sans déstabiliser pour autant les utilisateurs du dépôt [testing].</p>
<p>Pour ceux souhaitant avoir un aperçu des nouveauté de Xorg 1.8.0, vous pouvez lire ce billet, <a href="http://www.nicosphere.net/x-org-server-1-8-release-candidate-2-1597/">X.Org Server 1.8 Release Candidate 2</a> qui est toujours d&#8217;actualité.<br />
<span id="more-1687"></span><br />
L&#8217;annonce est faite par Jan de Groot, un développeur d&#8217;Arch Linux, sur la mailing liste <a href="http://thread.gmane.org/gmane.linux.arch.devel/10920">[arch-dev-public]</a>.</p>
<blockquote><p>« Il y a un nouveau dépôt pour les paquets de xorg-server 1.8. Comme cette sortie demande de nouveaux drivers et de nouvelles configurations, j&#8217;ai décidé de les mettre dans leur propre dépôt pour ne pas casser testing pour la plupart des utilisateurs. Les paquets ont été compilés avec testing, mais comme cette nouvelle version ne dépend plus d&#8217;OpenSSL, cela devrait fonctionner avec core+extra. Le kernel 2.6.33 de testing est recommandé à cause de DRI dans cette version. »<br />
&#8211; Jan de Groot</p></blockquote>
<p>(source, <a href="http://thread.gmane.org/gmane.linux.arch.devel/10920">mailing list</a>)</p>
<p>Pour ceux voulant se lancer dans l&#8217;utilisation, quelques recommandation quand même, savoir ce que vous faites, suivre la mailing liste pendant cette période de transition, et si votre xorg-server est tout cassé, ben… <strong>ne pas venir pleurer</strong> (trop fort) sur le forum :þ. Mais bon après tout, c&#8217;est un peu l&#8217;esprit d&#8217;Arch Linux, de se lancer dans ce genre d&#8217;aventures.</p>
<p>C&#8217;est donc à vos risques et périls que vous pouvez activer le dépôt de la façon suivante, dans le pacman.conf, à mettre au dessus des dépôts de testing et community-testing :</p>
<p><code>[xorg18]<br />
Include =/etc/pacman.d/mirrorlist</code></p>
<p>Comme expliqué dans <a href="http://www.nicosphere.net/x-org-server-1-8-release-candidate-2-1597/">le billet précédant</a>, c&#8217;est avec son lot de changement qu&#8217;apporte xorg 1.8, tel que la suppression complète d&#8217;HAL, et l&#8217;apparition d&#8217;un répertoire de configuration /etc/X11/xorg.conf.d/<br />
Attention tout de fois, pour le moment, il n&#8217;y a pas encore de driver nvidia de disponible.<br />
<em><strong>EDIT</strong> : Il s&#8217;agit ici du driver proprio nvidia ici, toute fois, ceux étant avec le driver nouveau pour nvidia ne devrait pas poser de soucis. (plus de détail sur la ML)</em></p>
<p>Jan de Groot conseil la lecture de <a href="https://fedoraproject.org/wiki/Input_device_configuration">cette documentation</a> pour les changements de configuration.</p>
<p>Je ne conseil donc cette expérimentation qu&#8217;aux archers avertis, mais pour ceux souhaitant faire le pas, amusez vous bien et bon courage :þ</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/arch-linux-met-en-place-un-depot-pour-tester-xorg-1-8-1687/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>TTYtter, le client pour twitter en console</title>
		<link>http://www.nicosphere.net/ttytter-le-client-pour-twitter-en-console-1668/</link>
		<comments>http://www.nicosphere.net/ttytter-le-client-pour-twitter-en-console-1668/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 13:04:46 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[logiciel]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ncurses]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1668</guid>
		<description><![CDATA[Comme certains pourraient avoir remarqué, depuis peu je me suis mis à « twitter ». Les raisons pour ça sont multiples, et je ne vais pas vous ennuyer à les expliquer. Comme sûrement beaucoup de personnes, je me suis cherché un client pour ne pas passer par leur site, et avoir ça sous la main avec une [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/ttytter-le-client-pour-twitter-en-console-1668/"><img class="alignleft" src="http://www.nicosphere.net/image/twitter2.png" alt="twitter2 TTYtter, le client pour twitter en console" width="130" height="130" title="TTYtter, le client pour twitter en console" /></a>Comme certains pourraient avoir remarqué, depuis peu je me suis mis à « twitter ». Les raisons pour ça sont multiples, et je ne vais pas vous ennuyer à les expliquer.</p>
<p>Comme sûrement beaucoup de personnes, je me suis cherché un client pour ne pas passer par leur site, et avoir ça sous la main avec une application stable et fonctionnel, bien incorporé dans mon bureau.<br />
<span id="more-1668"></span><br />
Je me suis d&#8217;abord tourné vers Pino, qui en soi est très satisfaisant. Mais comme pour la plupart de mes applications, je me suis mis à chercher un client, soit ncurses ou au moins en console.</p>
<p>Je n&#8217;ai pas trouvé d&#8217;applications en ncurses proprement dite, alors ça ne veux pas dire qu&#8217;il n&#8217;en existe pas, peut être que j&#8217;ai mal chercher, et si quelqu&#8217;un en a une sous la main je suis preneur, ou si quelqu&#8217;un se sent le courage d&#8217;en coder une :þ. À défaut, c&#8217;est sur le client <a href="http://www.floodgap.com/software/ttytter/">TTYtter</a> que je me suis penché, un client en mode console uniquement, écrit en perl et en 4&#8217;000 lignes de code plutôt bien commenté.</p>
<div class="wp-caption aligncenter" style="width: 403px"><img src="http://www.nicosphere.net/image/ttytter.jpg" alt="ttytter TTYtter, le client pour twitter en console" width="393" height="400" title="TTYtter, le client pour twitter en console" /><p class="wp-caption-text">Exemple de screenshot de ttytter (repris sur le net)</p></div>
<p>L&#8217;avantage de ce client, c&#8217;est qu&#8217;il est suffisamment complet pour en avoir un usage régulier, offrant bien plus que la simple possibilité d&#8217;envoyer un « tweet ».<br />
Des fonctions de recherches avancées sont en effet disponible, et un peu près tout ce qu&#8217;un client tel que pino pourrait proposer en GUI. Il est possible de suivre, rechercher une personnes, voir ses tweets, ses statistiques, rechercher sur des tags, possibilité de raccourcir les URI, support des notifications, support SSL, et plus encore. Les commandes sont également instinctive.</p>
<p>Pour les commandes de bases :</p>
<ul>
<li>/refresh : pour forcé la mise à jour des tweets (automatique normalement).</li>
<li>/again : remontre les tweets.</li>
<li>/again pseudo : montre les derniers tweets d&#8217;une personne spécifique.</li>
<li>/whois pseudo : montre des stats sur la personne.</li>
<li>/ruler : permet d&#8217;afficher une petite règle pour savoir si on ne dépasse pas les 140 caractères.</li>
<li>/follow et /leave (+pseudo): pour suivre et son contraire.</li>
<li>/rt : retweet.</li>
<li>/help : affiche l&#8217;écran d&#8217;aide.</li>
<li>Bien d&#8217;autres encore…</li>
</ul>
<p>par exemple, un /whois nic0sphere retourne (en plus de l&#8217;avatar en asciiArt, voir plus loin)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Nic0 <span style="color: #7a0874; font-weight: bold;">&#40;</span>nic0sphere<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>f:<span style="color: #000000;">18</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">13</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>u:<span style="color: #000000;">35</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #ff0000;">&quot;Passionné d'informatique et de GNU/Linux, bloggeur sur le Libre.&quot;</span>
URL:            http:<span style="color: #000000; font-weight: bold;">//</span>www.nicosphere.net
Location:       Normandie
Picture:        http:<span style="color: #000000; font-weight: bold;">//</span>a3.twimg.com<span style="color: #000000; font-weight: bold;">/</span>profile_images<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">772151641</span><span style="color: #000000; font-weight: bold;">/</span>avatar_normal.jpg</pre></div></div>

<p>Au niveau de la configuration, cela se passe dans un classique fichier .ttytterrc. En suivant le site officiel, et quelques fichier trouver par ci par là, j&#8217;en suis pour le moment à ça:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ttytterrc</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">user</span>=nic0sphere:<span style="color: #000000; font-weight: bold;">***</span>pass<span style="color: #000000; font-weight: bold;">***</span>
<span style="color: #007800;">pause</span>=auto
<span style="color: #007800;">vcheck</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">ansi</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">hold</span>=<span style="color: #000000;">15</span>
<span style="color: #007800;">newline</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">slowpost</span>=<span style="color: #000000;">7</span>
<span style="color: #007800;">readline</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">wrap</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">avatar</span>=<span style="color: #c20cb9; font-weight: bold;">lynx</span> <span style="color: #660033;">-source</span> <span style="color: #000000; font-weight: bold;">%</span>U <span style="color: #000000; font-weight: bold;">|</span> djpeg <span style="color: #660033;">-pnm</span> <span style="color: #000000; font-weight: bold;">|</span> ppmascii <span style="color: #660033;">-photo</span> <span style="color: #660033;">-x2</span> <span style="color: #660033;">-winx</span>=<span style="color: #000000;">4</span></pre></div></div>

<p>La dernière ligne nécessite l&#8217;installation d&#8217;un <a href="http://www.floodgap.com/software/ppmascii/ppmascii.txt">petit programme</a> en perl. Placé dans /usr/bin/ppmascii avec les droits d&#8217;exécution approprié. Cela permettra lors de la commande /whois, d&#8217;obtenir l&#8217;avatar de la personne en asciiArt, qui je dois dire est plutôt amusant. Le rendu de l&#8217;avatar en asciiArt diffère d&#8217;un avatar à l&#8217;autre, le miens, n&#8217;étant pas très contrasté, n&#8217;est pas des plus révélateur de la capacité du programme. Je n&#8217;ai pas mis de notification, mais c&#8217;est un choix personnel, il est possible de le rajouter. (on peut placer le programme ailleurs, en modifiant la commande suivant &laquo;&nbsp;avatar&nbsp;&raquo;)</p>
<p>Pour le plaisir, j&#8217;ai fait un screenshot de mon avatar, avec le rendu réel en console, pour bien l&#8217;apprécier, le mieux c&#8217;est de prendre un peu de recule (comme dans tout les AsciiArt).</p>
<div class="wp-caption aligncenter" style="width: 510px"><img src="http://www.nicosphere.net/image/avatarart.png" alt="avatar_acsiiart" width="500" height="675" title="TTYtter, le client pour twitter en console" /><p class="wp-caption-text">Screenshot de mon avatar en AsciiArt</p></div>
<p>Plutôt simple d&#8217;utilisation, mais suffisamment fonctionnel quand même, TTYtter ne prend pas de place et est léger, agréable donc à l&#8217;utilisation. Pour moi, c&#8217;est adopté. La seul chose qui me reste à trouver comment faire, c&#8217;est de mettre les différents pseudo dans une couleur spécifique, car pour le moment, ils n&#8217;apparaissent qu&#8217;en gras. (dès que je trouve je met ça là :þ)</p>
<p>Bon tweets à tous, et bon week-end pascal :)</p>
<p><em><strong>EDIT</strong>: Pour aller plus loin dans la configuration et les explications je conseille la lecture <a href="http://logive.free.fr/?p=453">du billet de Logive</a>. Notamment pour une gestion en multi-session, et gestion de tags plus affiné. Une bonne lecture en tout cas pour approfondir le sujet.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/ttytter-le-client-pour-twitter-en-console-1668/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Comment sauver un fichier avec Vim sans être root</title>
		<link>http://www.nicosphere.net/comment-sauver-un-fichier-avec-vim-sans-etre-root-1659/</link>
		<comments>http://www.nicosphere.net/comment-sauver-un-fichier-avec-vim-sans-etre-root-1659/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 13:29:44 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[logiciel]]></category>
		<category><![CDATA[astuces]]></category>
		<category><![CDATA[commande]]></category>
		<category><![CDATA[ncurses]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1659</guid>
		<description><![CDATA[Sous Linux, surtout pour des distributions tel qu&#8217;Arch Linux, il n&#8217;est pas rare d&#8217;avoir besoin de configurer des fichiers éditable uniquement avec un accès root, comme le sont les fichiers du répertoire /etc/. À qui ce n&#8217;est pas arrivé d&#8217;ouvrir un fichier de configuration, chercher une ligne, réfléchir comment la modifier pour l&#8217;avoir correctement… et… [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/comment-sauver-un-fichier-avec-vim-sans-etre-root-1659"><img src="http://www.nicosphere.net/wp-content/uploads/2010/03/vim.png" alt="vim Comment sauver un fichier avec Vim sans être root" title="vim" width="130" height="130" class="alignleft size-full wp-image-1662" /></a>Sous Linux, surtout pour des distributions tel qu&#8217;Arch Linux, il n&#8217;est pas rare d&#8217;avoir besoin de configurer des fichiers éditable uniquement avec un accès root, comme le sont les fichiers du répertoire /etc/.</p>
<p>À qui ce n&#8217;est pas arrivé d&#8217;ouvrir un fichier de configuration, chercher une ligne, réfléchir comment la modifier pour l&#8217;avoir correctement… et… au moment de modifier, s&#8217;apercevoir qu&#8217;on est qu&#8217;en simple user, et donc sans les droits d&#8217;écriture requis pour sauvegarder le fichier.<br />
<span id="more-1659"></span><br />
En tout cas, ce genre d&#8217;anecdote m&#8217;est déjà arrivé, et je ne dois pas être le seul.</p>
<p>Comme j&#8217;utilise très souvent mon éditeur de texte favori Vim, dont je ne connais pas toutes les astuces, loin de là, c&#8217;est en lisant <a href="http://www.cyberciti.biz/faq/vim-vi-text-editor-save-file-without-root-permission/">cet article</a> de tuxradar, que la solution toute simple est exposé.</p>
<p>Lorsque vous avez votre fichier ouvert, et même effectuer les changements, alors que vous ne pouvez normalement pas sauvegarder le fichier car n&#8217;avez pas les droits requis, et donc en accès read-only, il suffit de rentrer la commande suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">:<span style="color: #c20cb9; font-weight: bold;">w</span> <span style="color: #000000; font-weight: bold;">!</span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">tee</span> <span style="color: #000000; font-weight: bold;">%</span></pre></div></div>

<p>Pour les explications :</p>
<ul>
<li>:w &#8211; classique, c&#8217;est pour écrire le fichier.</li>
<li>!sudo &#8211; appel de la commande sudo.</li>
<li>tee &#8211; la sortie de la commande write (:w) est redirigé en utilisant la commande tee. % désignant l&#8217;actuel nom de fichier. En gros, la commande tee est utilisé en root pour prendre la sortie et l&#8217;écrire dans le fichier repésenté par %.</li>
</ul>
<p>Cette manipulation résulte à un avertissement, disant que le fichier a été modifier, ainsi que le tampon dans Vim et propose de recharger le fichier : (C)harger le fichier ou (L)oad the file si c&#8217;est en anglais.</p>
<p>Voici une astuce efficace, car très simple à se souvenir, et pouvant être bien utile, évitant quelques « oups, oublier d&#8217;ouvrir le fichier en root ». </p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/comment-sauver-un-fichier-avec-vim-sans-etre-root-1659/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Yaourt, nouvelle version sortie du wrapper de pacman d&#8217;ArchLinux</title>
		<link>http://www.nicosphere.net/yaourt-nouvelle-version-sortie-wrapper-pacman-linux-1646/</link>
		<comments>http://www.nicosphere.net/yaourt-nouvelle-version-sortie-wrapper-pacman-linux-1646/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 12:45:14 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[actualité]]></category>
		<category><![CDATA[archlinux]]></category>
		<category><![CDATA[logiciel]]></category>
		<category><![CDATA[yaourt]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1646</guid>
		<description><![CDATA[Yaourt est le wrapper de pacman, qui est lui le paquage manager d&#8217;Arch Linux. Les premières versions de Yaourt datant quand même de 2006, il permet entre autre d&#8217;effectuer des recherches dans AUR, et c&#8217;est dans les recherches qu&#8217;il est intéressant car affiche des résultats complets, tel que si le paquet est déjà installé et [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/yaourt-nouvelle-version-sortie-wrapper-pacman-linux-1646"><img class="alignleft" src="http://www.nicosphere.net/image/yaourt.png" alt="yaourt Yaourt, nouvelle version sortie du wrapper de pacman dArchLinux" width="130" height="102" title="Yaourt, nouvelle version sortie du wrapper de pacman dArchLinux" /></a>Yaourt est le wrapper de pacman, qui est lui le paquage manager d&#8217;Arch Linux. Les premières versions de Yaourt datant quand même de 2006, il permet entre autre d&#8217;effectuer des recherches dans AUR, et c&#8217;est dans les recherches qu&#8217;il est intéressant car affiche des résultats complets, tel que si le paquet est déjà installé et affiche les votes sur AUR.<br />
<span id="more-1646"></span><br />
<br />
Son développement ayant freiné depuis quelques temps, tout en restant maintenu quand même. La bonne nouvelle, c&#8217;est que depuis quelques semaines maintenant, le développement de Yaourt est repartie de façon intensive.</p>
<p>Et c&#8217;est dans la globalité de son fonctionnement que Yaourt a été revu. On peut dire qu&#8217;un gros travail a été fournit par Tuxce (le co-auteur de yaourt) en collaboration avec Wain (le fondateur de yaourt).</p>
<p>La différence notable pour l&#8217;utilisateur est avant tout la vitesse ! En effet, la vitesses des recherches est grandement améliorée, très agréable donc à l&#8217;utilisation de mon yaourt préféré.</p>
<p>Voici le changelog complet pour cette dernière version, consultable sur <a href="http://archlinux.fr/yaourt">cette page</a> :</p>
<p>version 0.9.3 (26/03/10)  version à 99,9% de Tuxce</p>
<ul>
<li>VITESSE! yaourt utilise une application externe (package-query de tuxce) pour les requêtes sur alpm et aur</li>
<li>Traduction Italienne de Vincezo et en Turc de Samed</li>
<li>Propose de surpprimer un paquetage si il est en conflit avec….</li>
<li>Meilleure détection des commandes à  utiliser avec sudo</li>
<li>Meilleur support du chemin du lockfile de la db pacman</li>
<li>Correction d’erreur d’utilisation d’un shell différent en tant que root</li>
<li>Correction de la détection de ‘provides’ dans les PKGBUILD</li>
<li>Passage à rsync pour correction du téléchargement des sources des paquetages de community</li>
<li>Pas besoin des privilèges root pour savoir quels paquetages sont à mettre à jour</li>
<li>Nouvelle option diffeditor dans yaourtrc pour pacdiffviewer</li>
</ul>
<p>Une bonne nouvelle pour notre yaourt national, et une bonne occasion pour remercier tuxce et wain pour le travail fournis. Pour ceux souhaitant réagir sur le développement de yaourt, un thread est disponible sur <a href="http://forums.archlinux.fr/topic5678.html">le forum d&#8217;ArchLinux.fr</a>.</p>
<p>Et comme on dit par ici, yaourt c&#8217;est bon, mangez-en !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/yaourt-nouvelle-version-sortie-wrapper-pacman-linux-1646/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Phrack est toujours là</title>
		<link>http://www.nicosphere.net/phrack-est-toujours-la-1628/</link>
		<comments>http://www.nicosphere.net/phrack-est-toujours-la-1628/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 12:25:18 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[actualité]]></category>
		<category><![CDATA[magazine]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1628</guid>
		<description><![CDATA[Phrack, ce mythique magazine « underground » du milieu des années 80 est toujours présent ! Dans son apogée c&#8217;était un magazine influant, distribué sur Internet, avec des sorties régulières, et de réputation à égale avec le magazine 2600 (papier cette fois). D&#8217;une part Phrack diffusait des articles vraiment intéressant et technique, mais c&#8217;est aussi une [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/phrack-est-toujours-la-1628"><img class="alignleft" src="http://www.nicosphere.net/image/phrack.png" alt="phrack Phrack est toujours là" width="130" height="102" title="Phrack est toujours là" /></a>Phrack, ce mythique magazine « underground » du milieu des années 80 est toujours présent !</p>
<p>Dans son apogée c&#8217;était un magazine influant, distribué sur Internet, avec des sorties régulières, et de réputation à égale avec le magazine 2600 (papier cette fois).<br />
<span id="more-1628"></span><br />
<br />
D&#8217;une part Phrack diffusait des articles vraiment intéressant et technique, mais c&#8217;est aussi une vision de la scène international de hacker, en faisant partie intégrante de son histoire. Une approche de l&#8217;histoire de « l&#8217;underground » ne peut être faite sans cité Phrack, ainsi que Knight Lightning et Taran King, les fondateurs de Phrack.</p>
<p>Malheuresement, les contributions ont été moindre , et les sorties peu fréquente depuis la fin des années 90, avec en moyenne un numéro par an, le dernier numéro étant sortie en juin 2009. Tout les numéros sont disponible gratuitement, et ce depuis le tout premier, datant quand même de novembre 1985, et sont <a href="http://www.phrack.com/issues.html">téléchargeable</a> en tar.gz ( pas de .zip bien sûr :þ ).</p>
<p>Mais Phrack survit et le fait savoir !</p>
<p>Phrack lance <a href="http://www.phrack.org/cfp_p67.txt">un appel à la contribution</a>, tout en confirmant un nouveau numéro, #67, pour cet été dont la date est fixé au 11 juillet 2010. Bien sûr ça laisse le temps de voir venir, mais c&#8217;est toujours bon de les savoir actif. Pour ceux suivant un peu (même de loin), un changement niveau de l&#8217;équipe notable est fait puisque The Circle of Lost Hackers se retire laissant de bels contributions dans les numéros 64, 65 et 66.</p>
<p>Pour anecdote, Gentoo dispose d&#8217;un paquetage « phrack » disponible avec portage, permettant de télécharger une partie ou l&#8217;intégralité des numéros de Phrack !</p>
<p>Bonne lecture à ceux qui se lance dans la lecture d&#8217;anciens numéros.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/phrack-est-toujours-la-1628/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Le choix de navigateur fait doubler le téléchargement d&#8217;Opera</title>
		<link>http://www.nicosphere.net/choix-navigateur-microsoft-double-chargement-opera-1614/</link>
		<comments>http://www.nicosphere.net/choix-navigateur-microsoft-double-chargement-opera-1614/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 15:07:42 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[actualité]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[libre]]></category>
		<category><![CDATA[navigateur]]></category>
		<category><![CDATA[opera]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1614</guid>
		<description><![CDATA[Depuis peu, en europe, Microsoft présente un écran permettant de choisir le navigateur préféré. Alors que cette écran n&#8217;est disponible que depuis le début du mois de mars, les premières retombés se font sentir pour le navigateur Opera. En effet, selon ce communiqué de presse, les téléchargements d&#8217;Opera ont plus que doubler en moyenne en [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/choix-navigateur-microsoft-double-chargement-opera-1614"><img class="alignleft" src="http://www.nicosphere.net/image/opera.png" alt="opera Le choix de navigateur fait doubler le téléchargement dOpera" width="130" height="109" title="Le choix de navigateur fait doubler le téléchargement dOpera" /></a>Depuis peu, en europe, Microsoft présente un écran permettant de choisir le navigateur préféré. Alors que cette écran n&#8217;est disponible que depuis le début du mois de mars, les premières retombés se font sentir pour le navigateur Opera.</p>
<p>En effet, selon <a href="http://www.opera.com/press/releases/2010/03/18/">ce communiqué de presse</a>, les téléchargements d&#8217;Opera ont plus que doubler en moyenne en Europe, et les chiffres sont éloquent.<br />
<span id="more-1614"></span></p>
<blockquote><p>Following the introduction of the Choice Screen in Europe, Opera Software is experiencing a dramatic uptake on downloads of its latest browser, Opera 10.50. After the Choice Screen launch in early March, on average, more than half of the European downloads of Opera’s latest browser come directly from the Choice Screen.</p></blockquote>
<p>Opera met l&#8217;accent sur le fait que la moitié de leur chargement proviennent de cet écran laissant le choix entre les divers navigateurs.</p>
<p>Une fois n&#8217;est pas coutûme pour moi de faire un billet si court, mais l&#8217;information ne vaux pas non plus de grosses explications.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/choix-navigateur-microsoft-double-chargement-opera-1614/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Programme de l&#8217;ArchCon 2010, la conférence d&#8217;Arch Linux</title>
		<link>http://www.nicosphere.net/programme-de-larchcon-2010-la-conference-darch-linux-1609/</link>
		<comments>http://www.nicosphere.net/programme-de-larchcon-2010-la-conference-darch-linux-1609/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 14:27:53 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[actualité]]></category>
		<category><![CDATA[archcon]]></category>
		<category><![CDATA[archlinux]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1609</guid>
		<description><![CDATA[L&#8217;ArchCon est une conférence faite par et pour Arch Linux, elle se tiendra à Toronto (Canada) le 22 et 23 juillet 2010. On y retrouvera quelques grandes figures de l&#8217;équipe de développement d&#8217;ArchLinux. Bien sûr, pour nous français, ça fait un peu loin pour y aller, mais rien n&#8217;empêche de jeter un petit coup d&#8217;œil [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/programme-de-larchcon-2010-la-conference-darch-linux-1609/"><img class="alignleft" src="http://www.nicosphere.net/image/arch.png" alt="archlinux" width="130" height="130" title="Programme de lArchCon 2010, la conférence dArch Linux" /></a>L&#8217;ArchCon est une conférence faite par et pour Arch Linux, elle se tiendra à Toronto (Canada) le 22 et 23 juillet 2010. On y retrouvera quelques grandes figures de l&#8217;équipe de développement d&#8217;ArchLinux.</p>
<p>Bien sûr, pour nous français, ça fait un peu loin pour y aller, mais rien n&#8217;empêche de jeter un petit coup d&#8217;œil aux conférences déjà prévues, de plus, quelques demandes de rediffusion vidéo ont étaient faite pour que ceux ne pouvant s&#8217;y rendre puissent quand même suivre les conférences, en anglais of course.<br />
<span id="more-1609"></span></p>
<p>Les conférences sont détaillées, en anglais, sur une partie du site canadien, normalement réservé au shwag (les goodies pour ceux qui ne connaissent pas).<br />
Si vous voulez tout savoir de suite, c&#8217;est <a href="http://www.archlinux.ca/archcon2010/?cat=4">par ici</a> le programme !<br />
Un petit aperçu du programme (traduction partiel de la page cité ci-dessus) :</p>
<h2>Arch Linux Projets</h2>
<p>Présenté par <strong>Dan McGee</strong></p>
<p>Il y a beaucoup de pièces de puzzle qui s&#8217;assemblent pour faire tenir debout une distribution et la rendre active. Bien que Arch Linux ait une des plus petite équipe de développement des distributions Linux « connu », nous avons pas mal de projet sous développement. Du site web à l&#8217;initscript, en passant par les outils de management des dépôts. Cette conférence va essayer de montrer quelques projets d&#8217;ArchLinux.</p>
<p>Vous pouvez également être intéressé par cette conférence si vous cherchez à contribuer à ArchLinux, mais si vous n&#8217;êtes pas sûr par où commencer. Venant d&#8217;un gars qui est devenu développeur grâce à son travail sur pacman, j&#8217;espère que cela va aussi montrer comment s&#8217;investir et gagner le respect des développeurs actuel, et éventuellement devenir un membre d&#8217;un projet.</p>
<p>Dan est un développeur d&#8217;ArchLinux depuis 3 ans, et est le dev principal de pacman, mais également des contributions diverses que se soit sur le site, ou le serveur.</p>
<h2>Hacking Pacman</h2>
<p>Présenté par <strong>Dan McGee</strong></p>
<p>Une pièce critique de toutes distributions est les paquets et la façon dont elle les prend en charge. Alors que certains manageurs de paquets peuvent être frustrant, les archers trouvent que pacman va droit au but et fait vraiment ce que l&#8217;on en veut de lui. Cette conférence va regarder brièvement comment pacman fonctionne sur un haut niveau, puis descendre dans ses entrailles, pour voir ce qu&#8217;il fait et comment il le fait. Nous pouvons aussi voir les makepkg et autres scripts. Le plus important, je vais vous montrer comment le développement fonctionne si vous êtes intéressé pour vous y investir, ou voulez une fonctionnalité particulière qui n&#8217;existe pas encore.</p>
<h2>Goggles Music Manager</h2>
<p>Présenté par <strong>Sander Jansen</strong></p>
<p>En 2010 et sur ArchLinux, il existe des tonnes de players, alors pourquoi devriez vous choisir Goggles Music Manager ? Pourquoi développer encore un autre player ? Et pourquoi les gens cherche encore le player « parfait » ? Je vous montrerai comme l&#8217;utiliser, comment organiser sa collection de musique avec. Je montrerai aussi quelques nouveautés et fonctionnalités intéressantes qui sont en développement. Nous regarderons aussi derrière la scène, et discuterons de mes motivations à l&#8217;avoir développer, du design et du choix des composants qu&#8217;il dépend.</p>
<h2>Uzbl</h2>
<p>Présenté par <strong>Dieter Plaetinck</strong></p>
<p>Uzbl est très différent des autres navigateurs web (même des « légers »). Je décrirai l&#8217;idée du design et de l&#8217;implémentation d&#8217;Uzbl, j&#8217;expliquerai la philosophie derrière cela, ainsi que quelques exemples pratique de comment l&#8217;intégrer dans votre bureau.</p>
<h2>AIF: Arch Installation Framework</h2>
<p>Présenté par <strong>Dieter Plaetinck</strong></p>
<p>Depuis aout 2009, AIF s&#8217;occupe d&#8217;installer le système d&#8217;ArchLinux sur votre ordinateur. Un installeur est quelque chose un peu délicat dans la façon dont il doit faire l&#8217;installation, et c&#8217;est sujet à des opinions divergentes. Dans cette conférence sera expliqué les choix du design, les détails de son implémentation, et plus important: un aperçu des fonctionnalités et comment les utiliser.</p>
<p>Puis un peu plus en profondeur sur comment l&#8217;interaction et l&#8217;automatisation de l&#8217;installation fonctionne. Puis, des sujets comme lvm, encryption, installation imprévu et customiser l&#8217;installeur selon vos besoins. En gros, tout ce que vous devriez savoir sur l&#8217;installation du système d&#8217;Arch, et les plans pour le futur.</p>
<h2>Autres</h2>
<ul>
<li>Discussion autour de KDE (par Troy Unrau)</li>
<li>ArchLinux dans le milieu professionnel (par Jason Chu)</li>
<li>Présentation d&#8217;un LiveCD d&#8217;ArchLinux (par Matt Wood)</li>
<li>Autres…</li>
</ul>
<p>Des conférences qui peuvent être intéressantes à suivre, et j&#8217;espère également qu&#8217;ils diffuseront les vidéos des diverses conférences. Un pas de plus vers la domination du monde d&#8217;ArchLinux ! :þ</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/programme-de-larchcon-2010-la-conference-darch-linux-1609/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>X.Org Server 1.8 Release Candidate 2</title>
		<link>http://www.nicosphere.net/x-org-server-1-8-release-candidate-2-1597/</link>
		<comments>http://www.nicosphere.net/x-org-server-1-8-release-candidate-2-1597/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 01:23:41 +0000</pubDate>
		<dc:creator>Nic0</dc:creator>
				<category><![CDATA[actualité]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[logiciel]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://www.nicosphere.net/?p=1597</guid>
		<description><![CDATA[Contrairement à la dernière sortie de Xorg qui s&#8217;était bien fait attendre, la sortie de la version finale 1.8 devrait presque se faire dans les temps, annoncée pour le 31 mars lors de la sortie du 1.7, on peut dire qu&#8217;ils sont dans les temps. Une occasion de regarder quelques nouveautés que les développeurs de [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nicosphere.net/x-org-server-1-8-release-candidate-2-1597"><img class="alignleft" src="http://www.nicosphere.net/image/xorg.png" alt="xorg X.Org Server 1.8 Release Candidate 2" width="130" height="110" title="X.Org Server 1.8 Release Candidate 2" /></a>Contrairement à la dernière sortie de Xorg qui s&#8217;était bien fait attendre, la sortie de la version finale 1.8 devrait presque se faire dans les temps, annoncée pour le 31 mars lors de la sortie du 1.7, on peut dire qu&#8217;ils sont dans les temps.</p>
<p>Une occasion de regarder quelques nouveautés que les développeurs de Xorg nous réservent.<br />
<span id="more-1597"></span><br />
Les articles auxquels je fais référence sont écrit en anglais, mais de la bonne lecture pour aller plus loin dans les explications.</p>
<p>Le premier changement est dans leur fonctionnement de développement, puisque Xorg server 1.8 sera le premier a suivre un processus tout comme le noyau de Linux, chaque développeur s&#8217;occupe de leurs codes dans leur propre branche, et c&#8217;est par une demande de « pull » que le code est mergé dans la branche principal (master).(<a href="http://www.phoronix.com/scan.php?page=news_item&amp;px=NzU5Nw">voir article</a>) Ce qui leurs permettent d&#8217;avoir un meilleur contrôle sur le cycle développement entre autre, mais une meilleur gestion dans l&#8217;ensemble aussi. (voir <a href="http://lwn.net/Articles/355821/">LWN</a> 2eme partie)</p>
<p>De la version 1.4 à 1.7 Xorg a utilisé HAL pour plusieurs raisons en input (uniquement input, pas d&#8217;output), comme trouver les périphériques lors du démarrage, ou encore lorsqu&#8217;un d&#8217;eux est branché à chaud. Comme le projet HAL n&#8217;est plus maintenu, Xorg le remplace par udev, comme ils l&#8217;expliquent sur <a href="http://www.x.org/wiki/XorgHAL">cette page</a> de wiki.</p>
<p>L&#8217;apparition d&#8217;un dossier /etc/X11/xorg.conf.d dans lequel sera stocké les fichiers de configuration relatifs aux périphériques sera un changement notable pour l&#8217;utilisateur, tout de fois, le comptabilité du bon vieux xorg.conf sera quand même maintenu si les nouveaux fichiers ne sont pas présent, comme le précise <a href="http://www.phoronix.com/scan.php?page=news_item&amp;px=NzgxNw">cet article</a>. (et si le cœur vous en dit de voir <a href="http://lists.x.org/archives/xorg-devel/2009-December/004210.html">le patch</a> du changement de conf).</p>
<p>Une autre nouveauté de ce xorg est le support du protocole DRI 2.2, ce qui devrait permettre de supporter des extensions supplémentaire de OpenGL/GLX  tel que SGI_video_sync, OML_swap_control et SGI_swap_interval, SGI_swap_control, SGIX_swap_barrier, etc…</p>
<p>Des changements qui semblent prometteur, et une version finale qui ne devrait plus trop tarder.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicosphere.net/x-org-server-1-8-release-candidate-2-1597/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
