summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/webpresence
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/plugins/webpresence
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/plugins/webpresence')
-rw-r--r--kopete/plugins/webpresence/DESIGN12
-rw-r--r--kopete/plugins/webpresence/Makefile.am27
-rw-r--r--kopete/plugins/webpresence/TODO5
-rw-r--r--kopete/plugins/webpresence/kopete_webpresence.desktop120
-rw-r--r--kopete/plugins/webpresence/kopete_webpresence_config.desktop116
-rw-r--r--kopete/plugins/webpresence/webpresence_html.xsl140
-rw-r--r--kopete/plugins/webpresence/webpresence_html_images.xsl59
-rw-r--r--kopete/plugins/webpresence/webpresence_xhtml.xsl139
-rw-r--r--kopete/plugins/webpresence/webpresence_xhtml_images.xsl60
-rw-r--r--kopete/plugins/webpresence/webpresenceplugin.cpp473
-rw-r--r--kopete/plugins/webpresence/webpresenceplugin.h123
-rw-r--r--kopete/plugins/webpresence/webpresencepreferences.cpp64
-rw-r--r--kopete/plugins/webpresence/webpresencepreferences.h50
-rw-r--r--kopete/plugins/webpresence/webpresenceprefs.ui369
14 files changed, 1757 insertions, 0 deletions
diff --git a/kopete/plugins/webpresence/DESIGN b/kopete/plugins/webpresence/DESIGN
new file mode 100644
index 00000000..d62c9c34
--- /dev/null
+++ b/kopete/plugins/webpresence/DESIGN
@@ -0,0 +1,12 @@
+Kopete Web Presence Plugin
+
+What It Does
+Provides a view of the current state of your contact list as a webpage.
+
+How It Does It
+Every so often, it writes a file containing a snapshot of who is online and who is not in your contactlist to a location you specify. This can be a local file, an FTP server, a HTTP server, or anywhere else that KIO can access.
+
+Use KIO::NetAccess to upload the files!
+
+Getting Info about Local User's Status
+Goal is to allow ppl who don't have us on their contactlist to see what our current status is and what our UIN/id is for each protocol. So we need to know (protocol, uin, status).
diff --git a/kopete/plugins/webpresence/Makefile.am b/kopete/plugins/webpresence/Makefile.am
new file mode 100644
index 00000000..7f859379
--- /dev/null
+++ b/kopete/plugins/webpresence/Makefile.am
@@ -0,0 +1,27 @@
+METASOURCES = AUTO
+
+AM_CPPFLAGS = $(KOPETE_INCLUDES) $(all_includes) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
+
+kde_module_LTLIBRARIES = kopete_webpresence.la kcm_kopete_webpresence.la
+
+kopete_webpresence_la_SOURCES = webpresenceplugin.cpp
+
+kopete_webpresence_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries)
+kopete_webpresence_la_LIBADD = ../../libkopete/libkopete.la $(LIBXML_LIBS) $(LIBXSLT_LIBS)
+
+kcm_kopete_webpresence_la_SOURCES = webpresencepreferences.cpp webpresenceprefs.ui
+kcm_kopete_webpresence_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries)
+kcm_kopete_webpresence_la_LIBADD = ../../libkopete/libkopete.la $(LIB_KUTILS)
+
+service_DATA = kopete_webpresence.desktop
+servicedir = $(kde_servicesdir)
+
+kcm_DATA = kopete_webpresence_config.desktop
+kcmdir = $(kde_servicesdir)/kconfiguredialog
+
+mydata_DATA = webpresence_html.xsl\
+ webpresence_html_images.xsl\
+ webpresence_xhtml.xsl\
+ webpresence_xhtml_images.xsl
+mydatadir = $(kde_datadir)/kopete/webpresence
+EXTRA_DIST = $(mydata_DATA)
diff --git a/kopete/plugins/webpresence/TODO b/kopete/plugins/webpresence/TODO
new file mode 100644
index 00000000..28b78c3c
--- /dev/null
+++ b/kopete/plugins/webpresence/TODO
@@ -0,0 +1,5 @@
+1) Investigate how to include the plugin's output server side to give users a start.
+1a) XSLT processing?
+
+2) Icon
+
diff --git a/kopete/plugins/webpresence/kopete_webpresence.desktop b/kopete/plugins/webpresence/kopete_webpresence.desktop
new file mode 100644
index 00000000..85068ce2
--- /dev/null
+++ b/kopete/plugins/webpresence/kopete_webpresence.desktop
@@ -0,0 +1,120 @@
+[Desktop Entry]
+Type=Service
+X-Kopete-Version=1000900
+Icon=html
+ServiceTypes=Kopete/Plugin
+X-KDE-Library=kopete_webpresence
+X-KDE-PluginInfo-Author=Will Stephenson
+X-KDE-PluginInfo-Email=will@stevello.free-online.co.uk
+X-KDE-PluginInfo-Name=kopete_webpresence
+X-KDE-PluginInfo-Version=0.8.0
+X-KDE-PluginInfo-Website=http://www.cs.ncl.ac.uk/old/people/william.stephenson
+X-KDE-PluginInfo-Category=Plugins
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+Comment=Show the status of (parts of) your contact list on a webpage
+Comment[ar]=يظهر حالة أجزاء من قائمة أتصالاتك على صفحة الشبكة
+Comment[be]=Паказвае спіс кантактаў ці яго частку на старонцы Сеціва
+Comment[bg]=Приставка за показвана състоянието на (част от) списъка с контакти като уеб страница
+Comment[bn]=একটি ওয়েবপেজে আপনার যোগাযোগ তালিকার (এর অংশের) অবস্থা প্রদর্শন করে
+Comment[bs]=Pokazuje status (dijelova) vaše kontakt liste na web stranici
+Comment[ca]=Mostra l'estatus de (parts de) la vostra llista de contactes a una pàgina web
+Comment[cs]=Zobrazí stav (části) seznamu kontaktů na webu
+Comment[cy]=Dangos cyflwr o (rannau o) eich rhestr cysylltiadau ar dudalen wê
+Comment[da]=Vis status for (dele af) din kontaktliste på en netside
+Comment[de]=Zeigt den Status (von Teilen) der eigenen Kontaktliste auf einer Internetseite
+Comment[el]=Εμφάνιση της κατάστασης της λίστας επαφών σας σε ιστοσελίδα
+Comment[es]=Mostrar el estado de (partes de) su lista de contactos en una página web
+Comment[et]=Näitab (vähemalt osa) kontaktide staatust veebileheküljel
+Comment[eu]=Erakutsi zure kontaktu zerrendaren (edo zati baten) egoera web orri batean
+Comment[fa]=وضعیت )اجزایی از( فهرست تماس شما را روی صفحۀ وب نمایش می‌دهد
+Comment[fi]=Näytä kontaktien tila www-sivulla
+Comment[fr]=Affiche l'état de connexion de votre liste (ou d'une partie) sur une page internet
+Comment[gl]=Mostra o status da túa lista de contactos (ou parte) nunha páxina web
+Comment[he]=מציא את מצב ההתחברות של חברים ברשימת הקשר שלך )או של חלקם( בעמוד WEB.
+Comment[hi]=वेब पृष्ठ पर आपकी सम्पर्क सूची की स्थिति (या आंशिक) दिखाए
+Comment[hr]=Prikazivanje statusa (dijelova) vaše liste kontakata na web stranici
+Comment[hu]=A partnerlista-tagok állapotának megjelenítése weboldalon
+Comment[is]=Sýnir stöðu (hluta) lista þinna á vefsíðu
+Comment[it]=Mostra lo stato della (o parte della) tua lista contatti su una pagina web
+Comment[ja]=コンタクトリスト (の一部) の状態をウェブページに表示
+Comment[ka]=სტატუსის ვებ გვერდზე ჩვენება
+Comment[kk]=Контакттарыңыздың тізімінің (не оның бөлігінің) күйін веб парақта көрсетеді
+Comment[km]=បង្ហាញ​ស្ថានភាព (ផ្នែក) នៃ​បញ្ជី​ទំនាក់​ទំនង​របស់​អ្នក​នៅ​លើ​ទំព័រ​វ៉េប
+Comment[lt]=Rodyti kontaktų sąrašo (sąrašo dalies) būklę internetiniame puslapyje
+Comment[mk]=Го прикажува статусот на (деловите на) вашата листа со контакти на вебстраница
+Comment[nb]=Vis tilstanden til (deler av) kontaktlista de på en nettside
+Comment[nds]=Wiest den Status (vun en poor) vun Dien Kontakten op en Nettsiet
+Comment[ne]=वेबपृष्ठमा तपाईँको सम्पर्क सूची (भागको) वस्तुस्थिति देखाउनुहोस्
+Comment[nl]=Toont de status van (delen van) uw contactenlijst op een webpagina
+Comment[nn]=Vis tilstanden til (delar av) kontaktlista på ei nettside
+Comment[pl]=Pokazuje status (części) Twojej listy kontaktów na stronie WWW
+Comment[pt]=Mostra o estado (de partes) da sua lista de contactos numa página Web
+Comment[pt_BR]=Mostra o status de (ou parte de) sua lista de contatos em uma página web
+Comment[ru]=Отображает состояние вашего списка контактов (или его части) на странице в Сети
+Comment[sk]=Zobrazenie stavu (časti) zo zoznamu kontaktov na webovej stránke
+Comment[sl]=Pokaže stanje (dela) vašega seznama stikov na spletni strani
+Comment[sr]=Приказивање статуса (делова) ваше листе контаката на веб страници
+Comment[sr@Latn]=Prikazivanje statusa (delova) vaše liste kontakata na veb stranici
+Comment[sv]=Visa status för (delar av) din kontaktlista på en webbsida
+Comment[ta]=இணைய பக்கத்தில் உங்கள் தொடர்பாளரின் நிலைப்பட்டியலை காட்டு
+Comment[tg]=Ҳолати (қисме аз) рӯйхати пайвастшавии шуморо дар саҳифаи шабака нишон медиҳад
+Comment[tr]=Bağlantı listesinde web sayfası olanların (bölümler) durumunu göster
+Comment[uk]=Показує стан вашого списку контактів (або його частини) на сторінці у Тенетах
+Comment[zh_CN]=在网页上显示您联系人的状态
+Comment[zh_HK]=在網頁上顯示您(一部份)聯絡人清單的狀態
+Comment[zh_TW]=在網頁上顯示(部份)您的聯絡人的狀態
+Name=Web Presence
+Name[ar]=موقع على الشبكة
+Name[be]=Сеціўная прысутнасць
+Name[bg]=Уеб присъствие
+Name[bn]=ওয়েব উপস্থিতি
+Name[bs]=Web prisustvo
+Name[ca]=Web de presència
+Name[cs]=Přítomnost na webu
+Name[cy]=Presenoldeb Gwê
+Name[da]=WWW-nærvær
+Name[de]=Web-Präsenz
+Name[el]=Παρουσία σε ιστοσελίδα
+Name[eo]=TTT-Prezenco
+Name[es]=Presencia Web
+Name[et]=Veebinimekiri
+Name[fa]=حضور وب
+Name[fi]=WWW-paikallaolo
+Name[fr]=Présence sur le web
+Name[gl]=Presencia na web
+Name[he]=נוכחות רשת
+Name[hi]=वेब उपस्थिति
+Name[hr]=Prisutnost na webu
+Name[hu]=Webes jelenlét
+Name[is]=Á vefnum
+Name[it]=Presenza web
+Name[ja]=ウェブプレゼンス
+Name[ka]=ვებ თვისებები
+Name[kk]=Вебте қатысу
+Name[km]=វត្តមាន​វ៉េប
+Name[lt]=Rodyti internete
+Name[mk]=Присуство на веб
+Name[nb]=Profil på nettet
+Name[nds]=Nett-Praatschap
+Name[ne]=वेब उपस्थिति
+Name[nl]=Web-aanwezigheid
+Name[nn]=Profil på nettet
+Name[pl]=Status na WWW
+Name[pt]=Presença na Web
+Name[pt_BR]=Presença Web
+Name[ro]=Prezenţă Web
+Name[ru]=Присутствие в Сети
+Name[sk]=Prítomnosť na webe
+Name[sl]=Spletna prisotnost
+Name[sr]=Присутност на Вебу
+Name[sr@Latn]=Prisutnost na Vebu
+Name[sv]=Webbnärvaro
+Name[ta]=இணைய இருப்பு
+Name[tg]=Мавҷудияти Web
+Name[tr]=Web Hazır Bulunması
+Name[uk]=Присутність у Тенет
+Name[zh_CN]=Web 状态
+Name[zh_HK]=網上狀態
+Name[zh_TW]=網頁連線
diff --git a/kopete/plugins/webpresence/kopete_webpresence_config.desktop b/kopete/plugins/webpresence/kopete_webpresence_config.desktop
new file mode 100644
index 00000000..a714d602
--- /dev/null
+++ b/kopete/plugins/webpresence/kopete_webpresence_config.desktop
@@ -0,0 +1,116 @@
+[Desktop Entry]
+Type=Service
+Icon=html
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=kopete_webpresence
+X-KDE-FactoryName=WebPrecencePreferencesFactory
+X-KDE-ParentApp=kopete_webpresence
+X-KDE-ParentComponents=kopete_webpresence
+
+Comment=Show the status of (parts of) your contact list on a web page
+Comment[ar]=يظهر حالة أجزاء من قائمة أتصالاتك على الشبكة
+Comment[be]=Паказвае стан спіса кантактаў ці яго часткі на старонцы Сеціва
+Comment[bg]=Приставка за показвана състоянието на (част от) списъка с контакти като уеб страница
+Comment[bn]=একটি ওয়েবপেজে আপনার যোগাযোগ তালিকার (এর অংশের) অবস্থা প্রদর্শন করে
+Comment[bs]=Pokazuje status (dijelova) vaše kontakt liste na web stranici
+Comment[ca]=Mostra l'estatus de (parts de) la vostra llista de contactes sobre una pàgina web
+Comment[cs]=Zobrazí stav (části) seznamu kontaktů na webu
+Comment[cy]=Dangos cyflwr o (rannau o) eich rhestr cysylltiadau ar dudalen wê
+Comment[da]=Vis status for (dele af) din kontaktliste på en netside
+Comment[de]=Zeigt den Status (von Teilen) der eigenen Kontaktliste auf einer Internetseite
+Comment[el]=Εμφάνιση της κατάστασης της λίστας επαφών σας σε ιστοσελίδα
+Comment[es]=Mostrar el estado de (partes de) su lista de contactos en una página web
+Comment[et]=Näitab (vähemalt osa) kontaktide staatust veebileheküljel
+Comment[eu]=Erakutsi zure kontaktu zerrendaren (edo zati baten) egoera web orri batean
+Comment[fa]=وضعیت )اجزایی از( فهرست تماس شما را روی صفحۀ وب نمایش می‌دهد
+Comment[fi]=Näytä kontaktien tila www-sivulla
+Comment[fr]=Afficher l'état de connexion de votre liste (ou d'une partie) sur une page internet
+Comment[gl]=Amosar o estado da (parte da) súa lista de contactos nunha páxina web
+Comment[he]=מציא את מצב ההתחברות של חברים ברשימת הקשר שלך )או של חלקם( בעמוד WEB.
+Comment[hi]=वेब पृष्ठ पर आपकी सम्पर्क सूची की स्थिति (या आंशिक) दिखाए
+Comment[hr]=Prikazivanje statusa (dijelova) vaše liste kontakata na web stranici
+Comment[hu]=A partnerek állapotának megjelenítése weboldalon
+Comment[is]=Sýnir stöðu (hluta) lista þinna á vefsíðu
+Comment[it]=Mostra lo stato (o una parte) della tua lista contatti su una pagina web
+Comment[ja]=コンタクトリスト (の一部) の状態をウェブページに表示
+Comment[ka]=სტატუსის ვებ გვერდზე ჩვენება
+Comment[kk]=Контакттарыңыздың тізімінің (не оның бөлігінің) күйін веб парақта көрсетеді
+Comment[km]=បង្ហាញ​ស្ថានភាព (ផ្នែក) នៃ​បញ្ជី​ទំនាក់​ទំនង​របស់​អ្នក​នៅ​លើ​ទំព័រ​វ៉េប
+Comment[lt]=Rodyti kontaktų sąrašo (sąrašo dalies) būklę internetiniame puslapyje
+Comment[mk]=Го прикажува статусот на (деловите на) вашата листа со контакти на вебстраница
+Comment[nb]=Vis tilstanden til (deler av) kontaktlista de på en nettside
+Comment[nds]=Wiest den Status (vun en poor) vun Dien Kontakten op en Nettsiet
+Comment[ne]=वेबपृष्ठमा तपाईँको सम्पर्क सूची (भागको) वस्तुस्थिति देखाउनुहोस्
+Comment[nl]=Toont de status van (delen van) uw contactenlijst op een webpagina
+Comment[nn]=Vis tilstanden til (delar av) kontaktlista på ei nettside
+Comment[pl]=Pokazuje status (części) Twojej listy kontaktów na stronie WWW
+Comment[pt]=Mostra o estado (de partes) da sua lista de contactos numa página Web
+Comment[pt_BR]=Mostra o status de (ou parte de) sua lista de contatos em uma página web
+Comment[ru]=Отображает состояние вашего списка контактов (или его части) на странице в Сети
+Comment[sk]=Zobrazenie stavu (časti) zo zoznamu kontaktov na webovej stránke
+Comment[sl]=Pokaže stanje (dela) vašega seznama stikov na spletni strani
+Comment[sr]=Приказивање статуса (делова) ваше листе контаката на веб страници
+Comment[sr@Latn]=Prikazivanje statusa (delova) vaše liste kontakata na veb stranici
+Comment[sv]=Visa status för (delar av) din kontaktlista på en webbsida
+Comment[ta]=இணைய பக்கத்தில் உங்கள் தொடர்பாளர் நிலைப்பட்டியலை காட்டு
+Comment[tg]=Ҳолати (қисме аз) рӯйхати пайвастшавии шуморо дар саҳифаи шабака нишон медиҳад
+Comment[tr]=Bağlantı listesinde web sayfası olanların (bölümler) durumunu göster
+Comment[uk]=Показує стан вашого списку контактів (або його частини) на сторінці у Тенетах
+Comment[zh_CN]=在网页上显示您联系人的状态
+Comment[zh_HK]=在網頁上顯示您(一部份)聯絡人清單的狀態
+Comment[zh_TW]=在網頁上顯示(部份)您的聯絡人的狀態
+Name=Web Presence
+Name[ar]=موقع على الشبكة
+Name[be]=Сеціўная прысутнасць
+Name[bg]=Уеб присъствие
+Name[bn]=ওয়েব উপস্থিতি
+Name[bs]=Web prisustvo
+Name[ca]=Web de presència
+Name[cs]=Přítomnost na webu
+Name[cy]=Presenoldeb Gwê
+Name[da]=WWW-nærvær
+Name[de]=Web-Präsenz
+Name[el]=Παρουσία σε ιστοσελίδα
+Name[eo]=TTT-Prezenco
+Name[es]=Presencia Web
+Name[et]=Veebinimekiri
+Name[fa]=حضور وب
+Name[fi]=WWW-paikallaolo
+Name[fr]=Présence sur le web
+Name[gl]=Presencia na web
+Name[he]=נוכחות רשת
+Name[hi]=वेब उपस्थिति
+Name[hr]=Prisutnost na webu
+Name[hu]=Webes jelenlét
+Name[is]=Á vefnum
+Name[it]=Presenza web
+Name[ja]=ウェブプレゼンス
+Name[ka]=ვებ თვისებები
+Name[kk]=Вебте қатысу
+Name[km]=វត្តមាន​វ៉េប
+Name[lt]=Rodyti internete
+Name[mk]=Присуство на веб
+Name[nb]=Profil på nettet
+Name[nds]=Nett-Praatschap
+Name[ne]=वेब उपस्थिति
+Name[nl]=Web-aanwezigheid
+Name[nn]=Profil på nettet
+Name[pl]=Status na WWW
+Name[pt]=Presença na Web
+Name[pt_BR]=Presença Web
+Name[ro]=Prezenţă Web
+Name[ru]=Присутствие в Сети
+Name[sk]=Prítomnosť na webe
+Name[sl]=Spletna prisotnost
+Name[sr]=Присутност на Вебу
+Name[sr@Latn]=Prisutnost na Vebu
+Name[sv]=Webbnärvaro
+Name[ta]=இணைய இருப்பு
+Name[tg]=Мавҷудияти Web
+Name[tr]=Web Hazır Bulunması
+Name[uk]=Присутність у Тенет
+Name[zh_CN]=Web 状态
+Name[zh_HK]=網上狀態
+Name[zh_TW]=網頁連線
diff --git a/kopete/plugins/webpresence/webpresence_html.xsl b/kopete/plugins/webpresence/webpresence_html.xsl
new file mode 100644
index 00000000..f768ccf5
--- /dev/null
+++ b/kopete/plugins/webpresence/webpresence_html.xsl
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <!--
+ HTML 4.01 Transitional
+ -->
+
+ <xsl:output
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ indent="yes"
+ method="html"
+ encoding="ISO-8859-1"
+ omit-xml-declaration="yes"/>
+
+ <xsl:template match="webpresence">
+ <html>
+ <head>
+ <title>My IM Status</title>
+ </head>
+ <body>
+ <p class="name"><xsl:value-of select="name"/></p>
+ <xsl:apply-templates select="accounts"/>
+ <hr/>
+ <font size="-2">
+ <xsl:text>Last update at: </xsl:text>
+ <xsl:value-of select="listdate"/>
+ </font>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="accounts">
+ <table>
+ <xsl:for-each select="account">
+ <tr>
+ <td class="protocol">
+ <xsl:apply-templates select="protocol"/>
+ </td>
+ <td class="accountname">
+ <xsl:value-of select="accountname"/>
+ </td>
+ <td class="accountstatus">
+ <xsl:apply-templates select="accountstatus"/>
+ </td>
+ <td class="accountaddress">
+ <xsl:value-of select="accountaddress"/>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="protocol">
+ <xsl:choose>
+ <xsl:when test=".='AIMProtocol'">
+ <xsl:text>AIM</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='MSNProtocol'">
+ <xsl:text>MSN</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='ICQProtocol'">
+ <xsl:text>ICQ</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='JabberProtocol'">
+ <xsl:text>Jabber</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='YahooProtocol'">
+ <xsl:text>Yahoo</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='GaduProtocol'">
+ <xsl:text>Gadu-Gadu</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='WPProtocol'">
+ <xsl:text>WinPopup</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='SMSProtocol'">
+ <xsl:text>SMS</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='IRCProtocol'">
+ <xsl:text>IRC</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Unknown</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="accountstatus">
+ <xsl:choose>
+ <xsl:when test=".='ONLINE'">
+ <font color="#00FF00">
+ <xsl:value-of select="."/>
+ </font>
+ </xsl:when>
+ <xsl:when test=".='OFFLINE'">
+ <font color="red">
+ <xsl:value-of select="."/>
+ </font>
+ </xsl:when>
+ <xsl:when test=".='AWAY'">
+ <font color="maroon">
+ <xsl:value-of select="."/>
+ </font>
+ <xsl:if test="@statusdescription != 'Away' or @awayreason">
+ <xsl:text> (</xsl:text>
+ </xsl:if>
+ <xsl:if test="@statusdescription != 'Away'">
+ <xsl:value-of select="@statusdescription"/>
+ <xsl:if test="@awayreason">
+ <xsl:text>: </xsl:text>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="@awayreason">
+ <xsl:value-of select="@awayreason"/>
+ </xsl:if>
+ <xsl:if test="@statusdescription != 'Away' or @awayreason">
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test=".='UNKNOWN'">
+ <font color="gray">
+ <xsl:value-of select="."/>
+ </font>
+ <xsl:if test="@statusdescription">
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="@statusdescription"/>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
+
+<!-- vim: set ts=4 sts=4 sw=4: -->
diff --git a/kopete/plugins/webpresence/webpresence_html_images.xsl b/kopete/plugins/webpresence/webpresence_html_images.xsl
new file mode 100644
index 00000000..5b707046
--- /dev/null
+++ b/kopete/plugins/webpresence/webpresence_html_images.xsl
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <!--
+ HTML 4.01 Transitional - protocol text replaced with icons
+
+ NOTE: You will have to create a dir 'images' at the
+ upload location containing the files named below.
+ -->
+
+ <!--
+ Import the HTML XSL sheet, and replace the <protocol>
+ handling with our own template.
+ -->
+
+ <xsl:import href="webpresence_html.xsl"/>
+
+ <!--
+ You can change the image directory with this variable.
+ -->
+
+ <xsl:variable name="images">images</xsl:variable>
+
+ <xsl:template match="protocol">
+ <xsl:choose>
+ <xsl:when test=".='MSNProtocol'">
+ <img src="{$images}/msn_protocol.png" alt="MSN" title="MSN"/>
+ </xsl:when>
+ <xsl:when test=".='ICQProtocol'">
+ <img src="{$images}/icq_protocol.png" alt="ICQ" title="ICQ"/>
+ </xsl:when>
+ <xsl:when test=".='JabberProtocol'">
+ <img src="{$images}/jabber_protocol.png" alt="Jabber" title="Jabber"/>
+ </xsl:when>
+ <xsl:when test=".='YahooProtocol'">
+ <img src="{$images}/yahoo_protocol.png" alt="Yahoo" title="Yahoo"/>
+ </xsl:when>
+ <xsl:when test=".='AIMProtocol'">
+ <img src="{$images}/aim_protocol.png" alt="AIM" title="AIM"/>
+ </xsl:when>
+ <xsl:when test=".='IRCProtocol'">
+ <img src="{$images}/irc_protocol.png" alt="IRC" title="IRC"/>
+ </xsl:when>
+ <xsl:when test=".='SMSProtocol'">
+ <img src="{$images}/sms_protocol.png" alt="SMS" title="SMS"/>
+ </xsl:when>
+ <xsl:when test=".='GaduProtocol'">
+ <img src="{$images}/gadu_protocol.png" alt="Gadu-Gadu" title="Gadu-Gadu"/>
+ </xsl:when>
+ <xsl:when test=".='WPProtocol'">
+ <img src="{$images}/winpopup_protocol.png" alt="WinPopup" title="WinPopup"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
+
+<!-- vim: set ts=4 sts=4 sw=4: -->
diff --git a/kopete/plugins/webpresence/webpresence_xhtml.xsl b/kopete/plugins/webpresence/webpresence_xhtml.xsl
new file mode 100644
index 00000000..9d749c14
--- /dev/null
+++ b/kopete/plugins/webpresence/webpresence_xhtml.xsl
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+ <!--
+ XHTML 1.0 Strict
+ -->
+
+ <xsl:output
+ doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+ indent="yes"
+ encoding="UTF-8"/>
+
+ <xsl:template match="webpresence">
+ <html>
+ <head>
+ <title>My IM Status</title>
+ </head>
+ <body>
+ <p class="name"><xsl:value-of select="name"/></p>
+ <xsl:apply-templates select="accounts"/>
+ <hr/>
+ <p style="font-size: x-small">
+ <xsl:text>Last update at: </xsl:text>
+ <xsl:value-of select="listdate"/>
+ </p>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="accounts">
+ <table>
+ <xsl:for-each select="account">
+ <tr>
+ <td class="protocol">
+ <xsl:apply-templates select="protocol"/>
+ </td>
+ <td class="accountname">
+ <xsl:value-of select="accountname"/>
+ </td>
+ <td class="accountstatus">
+ <xsl:apply-templates select="accountstatus"/>
+ </td>
+ <td class="accountaddress">
+ <xsl:value-of select="accountaddress"/>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="protocol">
+ <xsl:choose>
+ <xsl:when test=".='AIMProtocol'">
+ <xsl:text>AIM</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='MSNProtocol'">
+ <xsl:text>MSN</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='ICQProtocol'">
+ <xsl:text>ICQ</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='JabberProtocol'">
+ <xsl:text>Jabber</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='YahooProtocol'">
+ <xsl:text>Yahoo</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='GaduProtocol'">
+ <xsl:text>Gadu-Gadu</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='WPProtocol'">
+ <xsl:text>WinPopup</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='SMSProtocol'">
+ <xsl:text>SMS</xsl:text>
+ </xsl:when>
+ <xsl:when test=".='IRCProtocol'">
+ <xsl:text>IRC</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Unknown</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="accountstatus">
+ <xsl:choose>
+ <xsl:when test=".='ONLINE'">
+ <span style="color: lime">
+ <xsl:value-of select="."/>
+ </span>
+ </xsl:when>
+ <xsl:when test=".='OFFLINE'">
+ <span style="color: red">
+ <xsl:value-of select="."/>
+ </span>
+ </xsl:when>
+ <xsl:when test=".='AWAY'">
+ <span style="color: maroon">
+ <xsl:value-of select="."/>
+ </span>
+ <xsl:if test="@statusdescription != 'Away' or @awayreason">
+ <xsl:text> (</xsl:text>
+ </xsl:if>
+ <xsl:if test="@statusdescription != 'Away'">
+ <xsl:value-of select="@statusdescription"/>
+ <xsl:if test="@awayreason">
+ <xsl:text>: </xsl:text>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="@awayreason">
+ <xsl:value-of select="@awayreason"/>
+ </xsl:if>
+ <xsl:if test="@statusdescription != 'Away' or @awayreason">
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test=".='UNKNOWN'">
+ <span style="color: gray">
+ <xsl:value-of select="."/>
+ </span>
+ <xsl:if test="@statusdescription">
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="@statusdescription"/>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
+
+<!-- vim: set ts=4 sts=4 sw=4: -->
diff --git a/kopete/plugins/webpresence/webpresence_xhtml_images.xsl b/kopete/plugins/webpresence/webpresence_xhtml_images.xsl
new file mode 100644
index 00000000..8254a674
--- /dev/null
+++ b/kopete/plugins/webpresence/webpresence_xhtml_images.xsl
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+ <!--
+ XHTML 1.0 Strict - protocol text replaced with icons
+
+ NOTE: You will have to create a dir 'images' at the
+ upload location containing the files named below.
+ -->
+
+ <!--
+ Import the XHTML XSL sheet, and replace the <protocol>
+ handling with our own template.
+ -->
+
+ <xsl:import href="webpresence_xhtml.xsl"/>
+
+ <!--
+ You can change the image directory with this variable.
+ -->
+
+ <xsl:variable name="images">images</xsl:variable>
+
+ <xsl:template match="protocol">
+ <xsl:choose>
+ <xsl:when test=".='MSNProtocol'">
+ <img src="{$images}/msn_protocol.png" alt="MSN" title="MSN"/>
+ </xsl:when>
+ <xsl:when test=".='ICQProtocol'">
+ <img src="{$images}/icq_protocol.png" alt="ICQ" title="ICQ"/>
+ </xsl:when>
+ <xsl:when test=".='JabberProtocol'">
+ <img src="{$images}/jabber_protocol.png" alt="Jabber" title="Jabber"/>
+ </xsl:when>
+ <xsl:when test=".='YahooProtocol'">
+ <img src="{$images}/yahoo_protocol.png" alt="Yahoo" title="Yahoo"/>
+ </xsl:when>
+ <xsl:when test=".='AIMProtocol'">
+ <img src="{$images}/aim_protocol.png" alt="AIM" title="AIM"/>
+ </xsl:when>
+ <xsl:when test=".='IRCProtocol'">
+ <img src="{$images}/irc_protocol.png" alt="IRC" title="IRC"/>
+ </xsl:when>
+ <xsl:when test=".='SMSProtocol'">
+ <img src="{$images}/sms_protocol.png" alt="SMS" title="SMS"/>
+ </xsl:when>
+ <xsl:when test=".='GaduProtocol'">
+ <img src="{$images}/gadu_protocol.png" alt="Gadu-Gadu" title="Gadu-Gadu"/>
+ </xsl:when>
+ <xsl:when test=".='WPProtocol'">
+ <img src="{$images}/winpopup_protocol.png" alt="WinPopup" title="WinPopup"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
+
+<!-- vim: set ts=4 sts=4 sw=4: -->
diff --git a/kopete/plugins/webpresence/webpresenceplugin.cpp b/kopete/plugins/webpresence/webpresenceplugin.cpp
new file mode 100644
index 00000000..1856d94c
--- /dev/null
+++ b/kopete/plugins/webpresence/webpresenceplugin.cpp
@@ -0,0 +1,473 @@
+/*
+ webpresenceplugin.cpp
+
+ Kopete Web Presence plugin
+
+ Copyright (c) 2005 by Tommi Rantala <tommi.rantala@cs.helsinki.fi>
+ Copyright (c) 2002,2003 by Will Stephenson <will@stevello.free-online.co.uk>
+
+ Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
+
+ *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ *************************************************************************
+ */
+
+#include "config.h"
+
+#include <qdom.h>
+#include <qtimer.h>
+#include <qfile.h>
+
+#include <kdebug.h>
+#include <kconfig.h>
+#include <kgenericfactory.h>
+#include <kmessagebox.h>
+#include <ktempfile.h>
+#include <kstandarddirs.h>
+
+#ifdef HAVE_XSLT
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#include <libxslt/xsltconfig.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
+#endif
+
+#include "kopetepluginmanager.h"
+#include "kopeteprotocol.h"
+#include "kopeteaccountmanager.h"
+#include "kopeteaccount.h"
+
+#include "webpresenceplugin.h"
+
+typedef KGenericFactory<WebPresencePlugin> WebPresencePluginFactory;
+K_EXPORT_COMPONENT_FACTORY( kopete_webpresence, WebPresencePluginFactory( "kopete_webpresence" ) )
+
+WebPresencePlugin::WebPresencePlugin( QObject *parent, const char *name, const QStringList& /*args*/ )
+ : Kopete::Plugin( WebPresencePluginFactory::instance(), parent, name ),
+ shuttingDown( false ), resultFormatting( WEB_HTML )
+{
+ m_writeScheduler = new QTimer( this );
+ connect ( m_writeScheduler, SIGNAL( timeout() ), this, SLOT( slotWriteFile() ) );
+ connect( Kopete::AccountManager::self(), SIGNAL(accountRegistered(Kopete::Account*)),
+ this, SLOT( listenToAllAccounts() ) );
+ connect( Kopete::AccountManager::self(), SIGNAL(accountUnregistered(Kopete::Account*)),
+ this, SLOT( listenToAllAccounts() ) );
+
+ connect(this, SIGNAL(settingsChanged()), this, SLOT( loadSettings() ) );
+ loadSettings();
+ listenToAllAccounts();
+}
+
+WebPresencePlugin::~WebPresencePlugin()
+{
+}
+
+void WebPresencePlugin::loadSettings()
+{
+ KConfig *kconfig = KGlobal::config();
+ kconfig->setGroup( "Web Presence Plugin" );
+
+ frequency = kconfig->readNumEntry("UploadFrequency", 15);
+ resultURL = kconfig->readPathEntry("uploadURL");
+
+ resultFormatting = WEB_UNDEFINED;
+
+ if ( kconfig->readBoolEntry( "formatHTML", false ) ) {
+ resultFormatting = WEB_HTML;
+ } else if ( kconfig->readBoolEntry( "formatXHTML", false ) ) {
+ resultFormatting = WEB_XHTML;
+ } else if ( kconfig->readBoolEntry( "formatXML", false ) ) {
+ resultFormatting = WEB_XML;
+ } else if ( kconfig->readBoolEntry( "formatStylesheet", false ) ) {
+ resultFormatting = WEB_CUSTOM;
+ userStyleSheet = kconfig->readEntry("formatStylesheetURL");
+ }
+
+ // Default to HTML if we dont get anything useful from config file.
+ if ( resultFormatting == WEB_UNDEFINED )
+ resultFormatting = WEB_HTML;
+
+ useImagesInHTML = kconfig->readBoolEntry( "useImagesHTML", false );
+ useImName = kconfig->readBoolEntry("showName", true);
+ userName = kconfig->readEntry("showThisName");
+ showAddresses = kconfig->readBoolEntry("includeIMAddress", false);
+
+ // Update file when settings are changed.
+ slotWriteFile();
+}
+
+void WebPresencePlugin::listenToAllAccounts()
+{
+ // connect to signals notifying of all accounts' status changes
+ ProtocolList protocols = allProtocols();
+
+ for ( ProtocolList::Iterator it = protocols.begin();
+ it != protocols.end(); ++it )
+ {
+ QDict<Kopete::Account> accounts = Kopete::AccountManager::self()->accounts( *it );
+ QDictIterator<Kopete::Account> acIt( accounts );
+
+ for( ; Kopete::Account *account = acIt.current(); ++acIt )
+ {
+ listenToAccount( account );
+ }
+ }
+ slotWaitMoreStatusChanges();
+}
+
+void WebPresencePlugin::listenToAccount( Kopete::Account* account )
+{
+ if(account && account->myself())
+ {
+ // Connect to the account's status changed signal
+ // because we can't know if the account has already connected
+ QObject::disconnect( account->myself(),
+ SIGNAL(onlineStatusChanged( Kopete::Contact *,
+ const Kopete::OnlineStatus &,
+ const Kopete::OnlineStatus & ) ),
+ this,
+ SLOT( slotWaitMoreStatusChanges() ) ) ;
+ QObject::connect( account->myself(),
+ SIGNAL(onlineStatusChanged( Kopete::Contact *,
+ const Kopete::OnlineStatus &,
+ const Kopete::OnlineStatus & ) ),
+ this,
+ SLOT( slotWaitMoreStatusChanges() ) );
+ }
+}
+
+void WebPresencePlugin::slotWaitMoreStatusChanges()
+{
+ if ( !m_writeScheduler->isActive() )
+ m_writeScheduler->start( frequency * 1000 );
+}
+
+void WebPresencePlugin::slotWriteFile()
+{
+ m_writeScheduler->stop();
+
+ // generate the (temporary) XML file representing the current contactlist
+ KURL dest( resultURL );
+ if ( resultURL.isEmpty() || !dest.isValid() )
+ {
+ kdDebug(14309) << "url is empty or not valid. NOT UPDATING!" << endl;
+ return;
+ }
+
+ KTempFile* xml = generateFile();
+ xml->setAutoDelete( true );
+ kdDebug(14309) << k_funcinfo << " " << xml->name() << endl;
+
+ switch( resultFormatting ) {
+ case WEB_XML:
+ m_output = xml;
+ xml = 0L;
+ break;
+ case WEB_HTML:
+ case WEB_XHTML:
+ case WEB_CUSTOM:
+ m_output = new KTempFile();
+ m_output->setAutoDelete( true );
+
+ if ( !transform( xml, m_output ) )
+ {
+ //TODO: give some error to user, even better if shown only once
+ delete m_output;
+ m_output = 0L;
+
+ delete xml;
+ return;
+ }
+
+ delete xml; // might make debugging harder!
+ break;
+ default:
+ return;
+ }
+
+ // upload it to the specified URL
+ KURL src( m_output->name() );
+ KIO::FileCopyJob *job = KIO::file_move( src, dest, -1, true, false, false );
+ connect( job, SIGNAL( result( KIO::Job * ) ),
+ SLOT( slotUploadJobResult( KIO::Job * ) ) );
+}
+
+void WebPresencePlugin::slotUploadJobResult( KIO::Job *job )
+{
+ if ( job->error() ) {
+ kdDebug(14309) << "Error uploading presence info." << endl;
+ KMessageBox::queuedDetailedError( 0, i18n("An error occurred when uploading your presence page.\nCheck the path and write permissions of the destination."), 0, displayName() );
+ delete m_output;
+ m_output = 0L;
+ }
+}
+
+KTempFile* WebPresencePlugin::generateFile()
+{
+ // generate the (temporary) XML file representing the current contactlist
+ kdDebug( 14309 ) << k_funcinfo << endl;
+ QString notKnown = i18n( "Not yet known" );
+
+ QDomDocument doc;
+
+ doc.appendChild( doc.createProcessingInstruction( "xml",
+ "version=\"1.0\" encoding=\"UTF-8\"" ) );
+
+ QDomElement root = doc.createElement( "webpresence" );
+ doc.appendChild( root );
+
+ // insert the current date/time
+ QDomElement date = doc.createElement( "listdate" );
+ QDomText t = doc.createTextNode(
+ KGlobal::locale()->formatDateTime( QDateTime::currentDateTime() ) );
+ date.appendChild( t );
+ root.appendChild( date );
+
+ // insert the user's name
+ QDomElement name = doc.createElement( "name" );
+ QDomText nameText;
+ if ( !useImName && !userName.isEmpty() )
+ nameText = doc.createTextNode( userName );
+ else
+ nameText = doc.createTextNode( notKnown );
+ name.appendChild( nameText );
+ root.appendChild( name );
+
+ // insert the list of the user's accounts
+ QDomElement accounts = doc.createElement( "accounts" );
+ root.appendChild( accounts );
+
+ QPtrList<Kopete::Account> list = Kopete::AccountManager::self()->accounts();
+ // If no accounts, stop here
+ if ( !list.isEmpty() )
+ {
+ for( QPtrListIterator<Kopete::Account> it( list );
+ Kopete::Account *account=it.current();
+ ++it )
+ {
+ QDomElement acc = doc.createElement( "account" );
+ //output += h.openTag( "account" );
+
+ QDomElement protoName = doc.createElement( "protocol" );
+ QDomText protoNameText = doc.createTextNode(
+ account->protocol()->pluginId() );
+ protoName.appendChild( protoNameText );
+ acc.appendChild( protoName );
+
+ Kopete::Contact* me = account->myself();
+ QString displayName = me->property( Kopete::Global::Properties::self()->nickName() ).value().toString();
+ QDomElement accName = doc.createElement( "accountname" );
+ QDomText accNameText = doc.createTextNode( ( me )
+ ? displayName
+ : notKnown );
+ accName.appendChild( accNameText );
+ acc.appendChild( accName );
+
+ QDomElement accStatus = doc.createElement( "accountstatus" );
+ QDomText statusText = doc.createTextNode( ( me )
+ ? statusAsString( me->onlineStatus() )
+ : notKnown ) ;
+ accStatus.appendChild( statusText );
+
+ // Dont add these if we're shutting down, because the result
+ // would be quite weird.
+ if ( !shuttingDown ) {
+
+ // Add away message as an attribute, if one exists.
+ if ( me->onlineStatus().status() == Kopete::OnlineStatus::Away &&
+ !me->property("awayMessage").value().toString().isEmpty() ) {
+ accStatus.setAttribute( "awayreason",
+ me->property("awayMessage").value().toString() );
+ }
+
+ // Add the online status description as an attribute, if one exits.
+ if ( !me->onlineStatus().description().isEmpty() ) {
+ accStatus.setAttribute( "statusdescription",
+ me->onlineStatus().description() );
+ }
+ }
+ acc.appendChild( accStatus );
+
+ if ( showAddresses )
+ {
+ QDomElement accAddress = doc.createElement( "accountaddress" );
+ QDomText addressText = doc.createTextNode( ( me )
+ ? me->contactId()
+ : notKnown );
+ accAddress.appendChild( addressText );
+ acc.appendChild( accAddress );
+ }
+
+ accounts.appendChild( acc );
+ }
+ }
+
+ // write the XML to a temporary file
+ KTempFile* file = new KTempFile();
+ QTextStream *stream = file->textStream();
+ stream->setEncoding( QTextStream::UnicodeUTF8 );
+ doc.save( *stream, 4 );
+ file->close();
+ return file;
+}
+
+bool WebPresencePlugin::transform( KTempFile * src, KTempFile * dest )
+{
+#ifdef HAVE_XSLT
+ bool retval = true;
+ xmlSubstituteEntitiesDefault( 1 );
+ xmlLoadExtDtdDefaultValue = 1;
+
+ QFile sheet;
+
+ switch ( resultFormatting ) {
+ case WEB_XML:
+ // Oops! We tried to call transform() but XML was requested.
+ return false;
+ case WEB_HTML:
+ if ( useImagesInHTML ) {
+ sheet.setName( locate( "appdata", "webpresence/webpresence_html_images.xsl" ) );
+ } else {
+ sheet.setName( locate( "appdata", "webpresence/webpresence_html.xsl" ) );
+ }
+ break;
+ case WEB_XHTML:
+ if ( useImagesInHTML ) {
+ sheet.setName( locate( "appdata", "webpresence/webpresence_xhtml_images.xsl" ) );
+ } else {
+ sheet.setName( locate( "appdata", "webpresence/webpresence_xhtml.xsl" ) );
+ }
+ break;
+ case WEB_CUSTOM:
+ sheet.setName( userStyleSheet );
+ break;
+ default:
+ // Shouldn't ever reach here.
+ return false;
+ }
+
+ // TODO: auto / smart pointers would be useful here
+ xsltStylesheetPtr cur = 0;
+ xmlDocPtr doc = 0;
+ xmlDocPtr res = 0;
+
+ if ( !sheet.exists() ) {
+ kdDebug(14309) << k_funcinfo << "ERROR: Style sheet not found" << endl;
+ retval = false;
+ goto end;
+ }
+
+ // is the cast safe?
+ cur = xsltParseStylesheetFile( (const xmlChar *) sheet.name().latin1() );
+ if ( !cur ) {
+ kdDebug(14309) << k_funcinfo << "ERROR: Style sheet parsing failed" << endl;
+ retval = false;
+ goto end;
+ }
+
+ doc = xmlParseFile( QFile::encodeName( src->name() ) );
+ if ( !doc ) {
+ kdDebug(14309) << k_funcinfo << "ERROR: XML parsing failed" << endl;
+ retval = false;
+ goto end;
+ }
+
+ res = xsltApplyStylesheet( cur, doc, 0 );
+ if ( !res ) {
+ kdDebug(14309) << k_funcinfo << "ERROR: Style sheet apply failed" << endl;
+ retval = false;
+ goto end;
+ }
+
+ if ( xsltSaveResultToFile(dest->fstream(), res, cur) == -1 ) {
+ kdDebug(14309) << k_funcinfo << "ERROR: Style sheet apply failed" << endl;
+ retval = false;
+ goto end;
+ }
+
+ // then it all worked!
+ dest->close();
+
+end:
+ xsltCleanupGlobals();
+ xmlCleanupParser();
+ if (doc) xmlFreeDoc(doc);
+ if (res) xmlFreeDoc(res);
+ if (cur) xsltFreeStylesheet(cur);
+
+ return retval;
+
+#else
+ Q_UNUSED( src );
+ Q_UNUSED( dest );
+
+ return false;
+#endif
+}
+
+ProtocolList WebPresencePlugin::allProtocols()
+{
+ kdDebug( 14309 ) << k_funcinfo << endl;
+
+ Kopete::PluginList plugins = Kopete::PluginManager::self()->loadedPlugins( "Protocols" );
+ Kopete::PluginList::ConstIterator it;
+
+ ProtocolList result;
+
+ for ( it = plugins.begin(); it != plugins.end(); ++it ) {
+ result.append( static_cast<Kopete::Protocol *>( *it ) );
+ }
+
+ return result;
+}
+
+QString WebPresencePlugin::statusAsString( const Kopete::OnlineStatus &newStatus )
+{
+ if (shuttingDown)
+ return "OFFLINE";
+
+ QString status;
+ switch ( newStatus.status() )
+ {
+ case Kopete::OnlineStatus::Online:
+ status = "ONLINE";
+ break;
+ case Kopete::OnlineStatus::Away:
+ status = "AWAY";
+ break;
+ case Kopete::OnlineStatus::Offline:
+ case Kopete::OnlineStatus::Invisible:
+ status = "OFFLINE";
+ break;
+ default:
+ status = "UNKNOWN";
+ }
+
+ return status;
+}
+
+void WebPresencePlugin::aboutToUnload()
+{
+ // Stop timer. Dont need it anymore.
+ m_writeScheduler->stop();
+
+ // Force statusAsString() report all accounts as OFFLINE.
+ shuttingDown = true;
+
+ // Do final update of webpresence file.
+ slotWriteFile();
+
+ emit readyForUnload();
+}
+
+// vim: set noet ts=4 sts=4 sw=4:
+#include "webpresenceplugin.moc"
diff --git a/kopete/plugins/webpresence/webpresenceplugin.h b/kopete/plugins/webpresence/webpresenceplugin.h
new file mode 100644
index 00000000..3aea9af0
--- /dev/null
+++ b/kopete/plugins/webpresence/webpresenceplugin.h
@@ -0,0 +1,123 @@
+/*
+ webpresenceplugin.h
+
+ Kopete Web Presence plugin
+
+ Copyright (c) 2002,2003 by Will Stephenson <will@stevello.free-online.co.uk>
+
+ Kopete (c) 2002,2003 by the Kopete developers <kopete-devel@kde.org>
+
+ *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ *************************************************************************
+*/
+
+#ifndef WEBPRESENCEPLUGIN_H
+#define WEBPRESENCEPLUGIN_H
+
+#include <qvaluestack.h>
+
+#include <kio/job.h>
+
+#include "kopetecontact.h"
+#include "kopeteonlinestatus.h"
+
+class QTimer;
+class KTempFile;
+namespace Kopete { class MetaContact; }
+class KToggleAction;
+class KActionCollection;
+
+typedef QValueList<Kopete::Protocol*> ProtocolList;
+
+class WebPresencePlugin : public Kopete::Plugin
+{
+ Q_OBJECT
+
+private:
+ int frequency;
+ bool showAddresses;
+ bool useImName;
+ QString userName;
+ QString userStyleSheet;
+ bool useImagesInHTML;
+
+ // Is set to true when Kopete has notified us
+ // that we're about to be unloaded.
+ bool shuttingDown;
+
+ enum {
+ WEB_HTML,
+ WEB_XHTML,
+ WEB_XML,
+ WEB_CUSTOM,
+ WEB_UNDEFINED
+ } resultFormatting;
+
+ QString resultURL;
+
+public:
+ WebPresencePlugin( QObject *parent, const char *name, const QStringList &args );
+ virtual ~WebPresencePlugin();
+
+ virtual void aboutToUnload();
+
+protected slots:
+ void loadSettings();
+
+ /**
+ * Write a file to the specified location,
+ */
+ void slotWriteFile();
+ /**
+ * Called when an upload finished, displays error if needed
+ */
+ void slotUploadJobResult( KIO::Job * );
+ /**
+ * Called to schedule a write, after waiting to see if more changes
+ * occur (accounts tend to change status together)
+ */
+ void slotWaitMoreStatusChanges();
+ /**
+ * Sets us up to respond to account status changes
+ */
+ void listenToAllAccounts();
+ /**
+ * Sets us up to respond to a new account
+ */
+ void listenToAccount( Kopete::Account* account );
+
+protected:
+ /**
+ * Generate the file (HTML, text) to be uploaded
+ */
+ KTempFile* generateFile();
+ /**
+ * Apply named stylesheet to get content and presentation
+ */
+ bool transform( KTempFile* src, KTempFile* dest );
+ /**
+ * Helper method, generates list of all IM protocols
+ */
+ ProtocolList allProtocols();
+ /**
+ * Converts numeric status to a string
+ */
+ QString statusAsString( const Kopete::OnlineStatus &newStatus );
+ /**
+ * Schedules writes
+ */
+ QTimer* m_writeScheduler;
+
+ // The file to be uploaded to the WWW
+ KTempFile *m_output;
+};
+
+#endif
+
+// vim: set noet ts=4 sts=4 sw=4:
diff --git a/kopete/plugins/webpresence/webpresencepreferences.cpp b/kopete/plugins/webpresence/webpresencepreferences.cpp
new file mode 100644
index 00000000..9b00435a
--- /dev/null
+++ b/kopete/plugins/webpresence/webpresencepreferences.cpp
@@ -0,0 +1,64 @@
+/***************************************************************************
+ webpresencepreferences.cpp
+ -------------------
+ begin : jeu nov 14 2002
+ copyright : (C) 2002 by Olivier Goffart
+ email : ogoffart @ kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlayout.h>
+
+#include <kgenericfactory.h>
+#include <kautoconfig.h>
+#include <kurlrequester.h>
+
+#include "webpresenceprefs.h"
+#include "webpresencepreferences.h"
+
+typedef KGenericFactory<WebPresencePreferences> WebPresencePreferencesFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kopete_webpresence, WebPresencePreferencesFactory("kcm_kopete_webpresence"))
+
+WebPresencePreferences::WebPresencePreferences(QWidget *parent, const char* /*name*/, const QStringList &args)
+ : KCModule(WebPresencePreferencesFactory::instance(), parent, args)
+{
+ // Add actuall widget generated from ui file.
+ ( new QVBoxLayout( this ) )->setAutoAdd( true );
+ preferencesDialog = new WebPresencePrefsUI(this);
+ preferencesDialog->uploadURL->setMode( KFile::File );
+ preferencesDialog->formatStylesheetURL->setFilter( "*.xsl" );
+
+ // KAutoConfig stuff
+ kautoconfig = new KAutoConfig(KGlobal::config(), this, "kautoconfig");
+ connect(kautoconfig, SIGNAL(widgetModified()), SLOT(widgetModified()));
+ connect(kautoconfig, SIGNAL(settingsChanged()), SLOT(widgetModified()));
+ kautoconfig->addWidget(preferencesDialog, "Web Presence Plugin");
+ kautoconfig->retrieveSettings(true);
+}
+
+void WebPresencePreferences::widgetModified()
+{
+ emit KCModule::changed(kautoconfig->hasChanged());
+}
+
+void WebPresencePreferences::save()
+{
+ kautoconfig->saveSettings();
+}
+
+void WebPresencePreferences::defaults ()
+{
+ kautoconfig->resetSettings();
+}
+
+#include "webpresencepreferences.moc"
+
+// vim: set noet ts=4 sts=4 sw=4:
diff --git a/kopete/plugins/webpresence/webpresencepreferences.h b/kopete/plugins/webpresence/webpresencepreferences.h
new file mode 100644
index 00000000..120e7a9a
--- /dev/null
+++ b/kopete/plugins/webpresence/webpresencepreferences.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ webpresencepreferences.h
+ -------------------
+ begin : jeu nov 14 2002
+ copyright : (C) 2002 by Olivier Goffart
+ email : ogoffart @ kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef WEBPRSENCEPREFERECES_H
+#define WEBPRSENCEPREFERECES_H
+
+#include "kcmodule.h"
+
+class WebPresencePrefsUI;
+class KAutoConfig;
+
+/**
+ * Preference widget for the Now Listening plugin, copied from the Cryptography plugin
+ * @author Olivier Goffart
+ */
+class WebPresencePreferences : public KCModule {
+ Q_OBJECT
+
+public:
+ WebPresencePreferences(QWidget *parent = 0, const char *name = 0, const QStringList &args = QStringList());
+
+ virtual void save();
+ virtual void defaults();
+
+private:
+ WebPresencePrefsUI *preferencesDialog;
+ KAutoConfig *kautoconfig;
+
+private slots: // Public slots
+ void widgetModified();
+
+};
+
+#endif
+
+// vim: set noet ts=4 sts=4 sw=4:
diff --git a/kopete/plugins/webpresence/webpresenceprefs.ui b/kopete/plugins/webpresence/webpresenceprefs.ui
new file mode 100644
index 00000000..9aae819a
--- /dev/null
+++ b/kopete/plugins/webpresence/webpresenceprefs.ui
@@ -0,0 +1,369 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>WebPresencePrefsUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>WebPresencePrefsUI</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>426</width>
+ <height>554</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Uploading</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Uplo&amp;ad to:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>uploadURL</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="0" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>uploadURL</cstring>
+ </property>
+ </widget>
+ <spacer row="1" column="2">
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>449</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup2_2</cstring>
+ </property>
+ <property name="title">
+ <string>Formatting</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>formatHTML</cstring>
+ </property>
+ <property name="text">
+ <string>HTML (simple loo&amp;k)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>HTML 4.01 Transitional using the ISO-8859-1 (aka. Latin 1) character set encoding.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>HTML 4.01 Transitional formatting using ISO-8859-1 (aka. Latin 1) character set encoding.
+
+This version should be easily opened by most web browsers.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>formatXHTML</cstring>
+ </property>
+ <property name="text">
+ <string>XHTML (simple look)</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>XHTML 1.0 Strict</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The resulting page will be formatted using the XHTML 1.0 Strict W3C Recommendation. The character set encoding is UTF-8.
+
+Note that some web browsers do not support XHTML. You should also make sure your web server serves it out with the correct mime type, such as application/xhtml+xml.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>formatXML</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;XML</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Save the output in XML format using UTF-8 character set.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Save the output in XML format using the UTF-8 encoding.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>formatStylesheet</cstring>
+ </property>
+ <property name="text">
+ <string>XML transformation &amp;using this XSLT sheet:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>formatStylesheetURL</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>useImagesHTML</cstring>
+ </property>
+ <property name="text">
+ <string>Repla&amp;ce protocol text with images in (X)HTML</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Replaces the protocol names, such as MSN and IRC with images.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Replaces the protocol names, such as MSN and IRC with images.
+
+Note that you have to manually copy the PNG files into place.
+
+The following files are used by default:
+
+images/msn_protocol.png
+images/icq_protocol.png
+images/jabber_protocol.png
+images/yahoo_protocol.png
+images/aim_protocol.png
+images/irc_protocol.png
+images/sms_protocol.png
+images/gadu_protocol.png
+images/winpopup_protocol.png</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup2</cstring>
+ </property>
+ <property name="title">
+ <string>Display Name</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>showName</cstring>
+ </property>
+ <property name="text">
+ <string>Use one of &amp;your IM names</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>showAnotherName</cstring>
+ </property>
+ <property name="text">
+ <string>Use another &amp;name:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>showThisName</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>includeIMAddress</cstring>
+ </property>
+ <property name="text">
+ <string>Include &amp;IM addresses</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>93</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>formatStylesheet</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>formatStylesheetURL</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>showAnotherName</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>showThisName</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>formatXML</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>useImagesHTML</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>formatStylesheet</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>useImagesHTML</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>uploadURL</tabstop>
+ <tabstop>formatHTML</tabstop>
+ <tabstop>formatStylesheetURL</tabstop>
+ <tabstop>useImagesHTML</tabstop>
+ <tabstop>showName</tabstop>
+ <tabstop>showThisName</tabstop>
+ <tabstop>includeIMAddress</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>