Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
07cfaaf2
Commit
07cfaaf2
authored
25 years ago
by
Johan Schön
Browse files
Options
Downloads
Patches
Plain Diff
Added handling of unread texts in Membership
Rev: lib/modules/Protocols.pmod/LysKOM.pmod/Session.pike:1.7
parent
fed6fb1c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Protocols.pmod/LysKOM.pmod/Session.pike
+104
-51
104 additions, 51 deletions
lib/modules/Protocols.pmod/LysKOM.pmod/Session.pike
with
104 additions
and
51 deletions
lib/modules/Protocols.pmod/LysKOM.pmod/Session.pike
+
104
−
51
View file @
07cfaaf2
// $Id: Session.pike,v 1.
6
1999/0
7/19 16
:0
3
:5
4 mirar
Exp $
// $Id: Session.pike,v 1.
7
1999/0
9/28 02
:0
8
:5
9 js
Exp $
//! module Protocols
//! module Protocols
//! submodule LysKOM
//! submodule LysKOM
//! class Session
//! class Session
...
@@ -452,6 +452,8 @@ class Membership
...
@@ -452,6 +452,8 @@ class Membership
object conf;
object conf;
object err;
void create(object mb,int pers)
void create(object mb,int pers)
{
{
person=pers;
person=pers;
...
@@ -472,16 +474,63 @@ class Membership
...
@@ -472,16 +474,63 @@ class Membership
}
}
}
}
// FETCHER(unread,ProtocolTypes.TextMapping,_unread,local_to_global,@({conf->no,1,255}))
int number_unread()
int number_unread()
{
{
return (conf->no_of_texts+conf->first_local_no-1)
return (conf->no_of_texts+conf->first_local_no-1)
-last_text_read -sizeof(read_texts);
-last_text_read -sizeof(read_texts);
}
}
array(Text) _unread_texts;
array(object) get_unread_texts_blocking()
{
int i=last_text_read+1;
mapping(int:int) local_to_global = ([]);
if(i > conf->no_of_texts)
return (_unread_texts = ({ }) );
/* Get all the global numbers after last-text-read */
while(1)
{
ProtocolTypes.TextMapping textmapping=con->local_to_global(conf->no,i,255);
ProtocolTypes.LocalToGlobalBlock block=textmapping->block;
if(block->densep) /* Use TextList */
{
ProtocolTypes.TextList textlist=block->dense;
int j=textmapping->range_begin;
foreach(textlist->texts, int global)
local_to_global[j++]=global;
}
else /* Use array(TextNumberPair) */
{
foreach(block->sparse, ProtocolTypes.TextNumberPair pair)
local_to_global[pair->local_number]=pair->global_number;
}
if(!textmapping->later_texts_exists)
break;
i=textmapping->range_end;
}
mapping unread_numbers =
local_to_global -
mkmapping(read_texts,allocate(sizeof(read_texts)));
return /*_unread_texts =*/ map( sort(values(local_to_global)), text );
}
mixed `[](string what)
mixed `[](string what)
{
{
switch (what)
switch (what)
{
{
case "unread_texts":
return _unread_texts || get_unread_texts_blocking();
case "last_time_read":
case "last_time_read":
case "read_texts":
case "read_texts":
case "last_text_read":
case "last_text_read":
...
@@ -492,8 +541,12 @@ class Membership
...
@@ -492,8 +541,12 @@ class Membership
case "type":
case "type":
case "number_unread":
case "number_unread":
return ::`[](what);
return ::`[](what);
}
}
}
}
mixed `->(string what) { return `[](what); }
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment