[cpif] r351 - trunk/backend

svn at argo.es svn at argo.es
Mon Sep 10 19:23:01 CEST 2007


Author: jcea
Date: Mon Sep 10 19:22:59 2007
New Revision: 351

Log:
Mas soporte de hilos 'sticky'

Modified:
   trunk/backend/database.py

Modified: trunk/backend/database.py
==============================================================================
--- trunk/backend/database.py	(original)
+++ trunk/backend/database.py	Mon Sep 10 19:22:59 2007
@@ -494,6 +494,29 @@
         posicion_hilos_no_leidos[metatag][hilo]=ultimo
   usuario["ultimo mensaje conocido"]=global_last
 
+def listado_stickies_personal(conn,usuario,metatag) :
+  root=conn.get_root()
+  hilos=root["hilos"]["hilos"]
+  usuario=root["usuarios"]["usuarios"][normaliza_nick(usuario)]
+  hilo2last_msg=root["seguimiento_no_leidos"]
+
+  no_leidos=usuario["punto de lectura no leidos"][metatag]
+  monitor_hilos=usuario["monitor hilos"]
+
+  resultado=[]
+
+  metatag=root["metatags"]["metatags"][metatag]
+  stickies=metatag["sticky"]
+  r=[(hilo2last_msg[hilo_num],hilo_num) for hilo_num in stickies]
+  r.sort()
+  r.reversed()
+  for dummy,hilo_num in r :
+    hilo=hilos["hilo_num"]
+# If we modified the data returned, we must adjust also the peer "plain threads" function.
+    resultado.append((hilo_num,hilo["titulo"],hilo_num in no_leidos,hilo_num in monitor_hilos,"read only" in hilo))
+
+  return resultado
+
 def listado_hilos_personal(conn,usuario,ts,ts2,metatag) :
   root=conn.get_root()
   hilos=root["hilos"]["hilos"]
@@ -504,8 +527,12 @@
 
   resultado=[]
 
-  for ts,hilo in root["metatags"]["metatags"][metatag]["TS2hilo"].items_range(ts,ts2) :
+  metatag=root["metatags"]["metatags"][metatag]
+  stickies=metatag["sticky"]
+  for ts,hilo in metatag["TS2hilo"].items_range(ts,ts2) :
     hilo_num,hilo=hilo
+    if hilo_num in stickies : continue
+# If we modified the data returned, we must adjust also the peer "sticky" function.
     resultado.append((hilo_num,hilo["titulo"],hilo_num in no_leidos,hilo_num in monitor_hilos,"read only" in hilo))
 
   return resultado



More information about the cpif mailing list